[libcalamares] Fix tests for umask != 022

- My usual test environment has umask set to 022, but on one dev
   box it is 002, leading to test failures (which show the test
   was bad, not that the umask-setting code is bad)
This commit is contained in:
Adriaan de Groot 2019-08-30 06:35:53 -04:00
parent 9053b9cecf
commit 66ee6ac673
2 changed files with 7 additions and 2 deletions

View File

@ -155,8 +155,10 @@ LibCalamaresTests::testUmask()
QTemporaryFile ft;
QVERIFY( ft.open() );
// m gets the previous value of the mask (depends on the environment the
// test is run in, might be 002, might be 077), ..
mode_t m = CalamaresUtils::setUMask( 022 );
QCOMPARE( CalamaresUtils::setUMask( m ), m );
QCOMPARE( CalamaresUtils::setUMask( m ), 022 ); // But now most recently set was 022
for ( mode_t i = 0; i <= 0777 /* octal! */; ++i )
{

View File

@ -25,7 +25,10 @@
namespace CalamaresUtils
{
/// @brief Wrapper for umask(2)
/** @brief Wrapper for umask(2)
*
* Like umask(2), sets the umask and returns the previous value of the mask.
*/
DLLEXPORT mode_t setUMask( mode_t u );
/** @brief RAII for setting and re-setting umask.