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>
This commit is contained in:
parent
7f403f368e
commit
951c0b7afa
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user