summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2017-11-08 12:10:29 +0100
committerOliver Wolff <oliver.wolff@qt.io>2017-11-09 07:33:35 +0000
commite27bd981373cc3d22e54d8cbe030e5c329f9beda (patch)
tree25cdfa370e4dd76126a04a6078e44f3ba0bc8e1b /tests/auto/corelib/io
parent429d5f0c5edf776004a8a28c3a93f97e41f2ef85 (diff)
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>
Diffstat (limited to 'tests/auto/corelib/io')
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index 5f3ebeadd7..8db89b9f05 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -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));
}
}