summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qdir
diff options
context:
space:
mode:
authorKurt Korbatits <kurt.korbatits@nokia.com>2012-02-09 11:15:32 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-09 06:53:05 +0100
commit951c0b7afa2538037795644bf9759d0574ef99fd (patch)
tree7f28f98930ed6bdcd44b9149e1c078a1da932e5b /tests/auto/corelib/io/qdir
parent7f403f368eac8a0ebba83a1c30e83ff0a3963acb (diff)
Fixed qdir unittest to handle being run as root
- Added checks to see if running as root and skip as needed Change-Id: I4f94d5bfe511c6dfda315854b7cd1f64efe6e4f4 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Diffstat (limited to 'tests/auto/corelib/io/qdir')
-rw-r--r--tests/auto/corelib/io/qdir/tst_qdir.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp
index 539bea5e8d..6a48d7e60f 100644
--- a/tests/auto/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp
@@ -385,6 +385,10 @@ void tst_QDir::removeRecursively()
void tst_QDir::removeRecursivelyFailure()
{
+#ifdef Q_OS_UNIX
+ if (::getuid() == 0)
+ QSKIP("Running this test as root doesn't make sense");
+#endif
const QString tmpdir = QDir::currentPath() + "/tmpdir/";
const QString path = tmpdir + "undeletable";
QDir().mkpath(path);
@@ -1932,6 +1936,10 @@ void tst_QDir::isRelative()
void tst_QDir::isReadable()
{
+#ifdef Q_OS_UNIX
+ if (::getuid() == 0)
+ QSKIP("Running this test as root doesn't make sense");
+#endif
QDir dir;
QVERIFY(dir.isReadable());
@@ -1961,7 +1969,10 @@ void tst_QDir::cdBelowRoot()
QCOMPARE(root.path(), ROOT);
QVERIFY(root.cd(CD_INTO));
QCOMPARE(root.path(), DIR);
-
+#ifdef Q_OS_UNIX
+ if (::getuid() == 0)
+ QSKIP("Running this test as root doesn't make sense");
+#endif
QDir dir(DIR);
QVERIFY(!dir.cd("../.."));
QCOMPARE(dir.path(), DIR);