Skip some qsavefile auto tests

Some of the QSaveFile tests are not applicable with root privileges.

Change-Id: I1a22906c0b14acf144f1849719152dfe9d79f426
Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
Bernd Weimer 2014-05-13 11:14:32 +02:00 committed by The Qt Project
parent 6315745770
commit b8f96418ed

View File

@ -47,9 +47,8 @@
#include <qdir.h> #include <qdir.h>
#include <qset.h> #include <qset.h>
#if defined(Q_OS_UNIX) #if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
# include <unistd.h> // for geteuid #include <unistd.h> // for geteuid
# include <sys/types.h>
#endif #endif
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
@ -199,6 +198,10 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnDir_data()
void tst_QSaveFile::transactionalWriteNoPermissionsOnDir() void tst_QSaveFile::transactionalWriteNoPermissionsOnDir()
{ {
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
#if !defined(Q_OS_VXWORKS)
if (::geteuid() == 0)
QSKIP("Test is not applicable with root privileges");
#endif
QFETCH(bool, directWriteFallback); QFETCH(bool, directWriteFallback);
QTemporaryDir dir; QTemporaryDir dir;
QVERIFY(dir.isValid()); QVERIFY(dir.isValid());
@ -253,6 +256,10 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnDir()
void tst_QSaveFile::transactionalWriteNoPermissionsOnFile() void tst_QSaveFile::transactionalWriteNoPermissionsOnFile()
{ {
#if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
if (::geteuid() == 0)
QSKIP("Test is not applicable with root privileges");
#endif
// Setup an existing but readonly file // Setup an existing but readonly file
QTemporaryDir dir; QTemporaryDir dir;
QVERIFY(dir.isValid()); QVERIFY(dir.isValid());
@ -299,6 +306,10 @@ void tst_QSaveFile::transactionalWriteCanceled()
void tst_QSaveFile::transactionalWriteErrorRenaming() void tst_QSaveFile::transactionalWriteErrorRenaming()
{ {
#if defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
if (::geteuid() == 0)
QSKIP("Test is not applicable with root privileges");
#endif
QTemporaryDir dir; QTemporaryDir dir;
QVERIFY(dir.isValid()); QVERIFY(dir.isValid());
const QString targetFile = dir.path() + QString::fromLatin1("/outfile"); const QString targetFile = dir.path() + QString::fromLatin1("/outfile");