From 951c0b7afa2538037795644bf9759d0574ef99fd Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Thu, 9 Feb 2012 11:15:32 +1000 Subject: 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 Reviewed-by: Jason McDonald --- tests/auto/corelib/io/qdir/tst_qdir.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests/auto/corelib/io/qdir') 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); -- cgit v1.2.3