Fixed qstandardpaths unittest to handle being run as root
authorKurt Korbatits <kurt.korbatits@nokia.com>
Thu, 9 Feb 2012 01:27:15 +0000 (11:27 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 9 Feb 2012 05:53:10 +0000 (06:53 +0100)
- testCustomRuntimeDirectory test skips if run as root

Change-Id: Idcc2a1db5d8a96b2ec0248b8b1c392fffc0b2e11
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp

index 1e288e2..ebfd640 100644 (file)
@@ -229,6 +229,11 @@ void tst_qstandardpaths::testRuntimeDirectory()
 
 void tst_qstandardpaths::testCustomRuntimeDirectory()
 {
+#if defined(Q_OS_UNIX)
+    if (::getuid() == 0)
+        QSKIP("Running this test as root doesn't make sense");
+#endif
+
 #ifdef Q_XDG_PLATFORM
     qputenv("XDG_RUNTIME_DIR", QFile::encodeName("/tmp"));
     // It's very unlikely that /tmp is 0600 or that we can chmod it