Skip tst_unreadableelement where a file cannot be made unreadable

anUnreadableSymbolIsNotACollision() takes every permission away from a
symbol file to check that an unreadable symbol is reported as such, not
as a collision. QFile::setPermissions() cannot do that on Windows, where
Qt only knows the read-only flag, so it returns false and the test
failed there. It now skips, as it already does when run as root, which
reads the file anyway.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Beat Hangartner
2026-10-06 16:26:42 +02:00
parent 0708338bce
commit 210a26b29e
+5 -1
View File
@@ -89,7 +89,11 @@ private slots:
.contains(QStringLiteral("RESULT placed")));
QVERIFY(QFile::exists(embedded));
QVERIFY(QFile::setPermissions(m_symbol, QFileDevice::Permissions()));
// Qt cannot take read permission away on Windows: it only knows the
// read-only flag there, so this returns false. The check needs a
// file the user cannot read, which this system cannot give it.
if (!QFile::setPermissions(m_symbol, QFileDevice::Permissions()))
QSKIP("this system cannot make the file unreadable (Windows?)");
QFile probe(m_symbol);
if (probe.open(QIODevice::ReadOnly))
QSKIP("permissions do not stop this user reading the file (root?)");