qfile tests: Make sure files are writable before deleting them
On some platforms (like UWP) files that are copied during qfile auto tests are not writable by default. The cleanup will fail for these files if the permissions are not set accordingly. Change-Id: Id925dcadfc6b505c87f1f55d5ea05e286b60a5a5 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
429d5f0c5e
commit
e27bd98137
@ -405,6 +405,8 @@ void tst_QFile::cleanup()
|
||||
QDir remainingDir(absoluteFilePath);
|
||||
QVERIFY2(remainingDir.removeRecursively(), qPrintable(absoluteFilePath));
|
||||
} else {
|
||||
if (!(QFile::permissions(absoluteFilePath) & QFile::WriteUser))
|
||||
QVERIFY2(QFile::setPermissions(absoluteFilePath, QFile::WriteUser), qPrintable(absoluteFilePath));
|
||||
QVERIFY2(QFile::remove(absoluteFilePath), qPrintable(absoluteFilePath));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user