Unix: fix tst_QFile when run as root

Because tests are usually run as root on some setups, it does not
make sense to test for the right permissions of a readonly file.

Change-Id: I484f88722d3a9ce7123edc0fb57acae528fa194e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Rafael Roquetto 2013-05-30 14:55:22 -03:00 committed by The Qt Project
parent 528fd2149e
commit d4dba8a5c4

View File

@ -1192,6 +1192,13 @@ void tst_QFile::permissions()
#ifdef Q_OS_WIN
if (qt_ntfs_permission_lookup)
QEXPECT_FAIL("readonly", "QTBUG-25630", Abort);
#endif
#ifdef Q_OS_UNIX
if (strcmp(QTest::currentDataTag(), "readonly") == 0) {
// in case accidentally run as root
if (::getuid() == 0)
QSKIP("Running this test as root doesn't make sense");
}
#endif
QCOMPARE((memberResult == QFile::Permissions(perms)), expected);
QCOMPARE((staticResult == QFile::Permissions(perms)), expected);