summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-04-11 01:00:13 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-04-11 14:59:13 +0200
commit58a42898006f221807a08557f588a2d973a7ada2 (patch)
tree62d92617eae5df5aae666ea0902159498b285b24 /tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
parent033d01bd6e2aef740ad1408a04d3ca0ae3b9ba9b (diff)
parent1ec350e35fcea87c527b36cf429b595731059240 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts: tests/auto/network/socket/platformsocketengine/platformsocketengine.pri Change-Id: I22daf269a8f28f80630b5f521b91637531156404
Diffstat (limited to 'tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp')
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index a1f9ca0b87..c5dafb1a29 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -1889,10 +1889,11 @@ void tst_QFileInfo::isWritable()
#if defined (Q_OS_QNX) // On QNX /etc is usually on a read-only filesystem
QVERIFY(!QFileInfo("/etc/passwd").isWritable());
#elif defined (Q_OS_UNIX) && !defined(Q_OS_VXWORKS) // VxWorks does not have users/groups
- if (::getuid() == 0)
- QVERIFY(QFileInfo("/etc/passwd").isWritable());
- else
- QVERIFY(!QFileInfo("/etc/passwd").isWritable());
+ for (const char *attempt : { "/etc/passwd", "/etc/machine-id", "/proc/version" }) {
+ if (access(attempt, F_OK) == -1)
+ continue;
+ QCOMPARE(QFileInfo(attempt).isWritable(), ::access(attempt, W_OK) == 0);
+ }
#endif
}