From d4dba8a5c414bfdd7cbec6e6ee133f04604b2d2c Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Thu, 30 May 2013 14:55:22 -0300 Subject: [PATCH] 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 --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index cca4655f58..42dca7fc66 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -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);