tst_QSaveFile: skip test that fails when run as root

FAIL!  : tst_QSaveFile::retryTransactionalWrite() '!file.open(QIODevice::WriteOnly)' returned FALSE. ()
   Loc: [/home/tjmaciei/src/qt/qt5/qtbase/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp(156)]

strace reveals:
access("/TEMPDIR/outfile.ro", W_OK) = 0

Change-Id: Ibdc95e9af7bd456a94ecfffd1603eb371aadb02b
Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
Thiago Macieira 2020-04-08 15:21:55 -03:00
parent 36feab8bf4
commit 135d98134f

View File

@ -136,6 +136,10 @@ void tst_QSaveFile::retryTransactionalWrite()
{
#ifndef Q_OS_UNIX
QSKIP("This test is Unix only");
#else
// root can open the read-only file for writing...
if (geteuid() == 0)
QSKIP("This test does not work as the root user");
#endif
QTemporaryDir dir;
QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));