From 6a1667bc4e6d1074f547434d714cd47ed8ebfc41 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 19 Jul 2016 10:13:26 +0200 Subject: Improve robustness of qml cache expiry checking Instead of relying on two time stamps in the file system (source file and cache file), make the determination on whether the source file is newer than the cache solely depend on the time stamp of only the source file. This means that when cache files are stored in archives for example their modification date does not need to be preserved upon extraction. Change-Id: I0b4362663868c6fb9bd7e106028161b2d67274d4 Reviewed-by: Lars Knoll --- tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/auto/qml/qmldiskcache') diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp index b4697a4a3b..f85f66378a 100644 --- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp +++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp @@ -31,6 +31,7 @@ #include #include #include +#include class tst_qmldiskcache: public QObject { @@ -63,6 +64,10 @@ struct TestCompiler } mappedFile.close(); + // Qt API limits the precision of QFileInfo::modificationTime() to seconds, so to ensure that + // the newly written file has a modification date newer than an existing cache file, we must + // wait. + QThread::sleep(1); { QFile f(testFilePath); if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate)) { -- cgit v1.2.3