From 7fad4df8df29a1aaf6fbc37d8e5b7c36c56094e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Matysiak?= Date: Tue, 14 May 2024 18:10:33 +0200 Subject: [PATCH] Fix tst_QFileSysteMWatcher::basicTest on VxWorks POSIX2008 demands that `stat` contains an `st_mtim` field of type `timespec`. That field holds modification time with a nanosecond resolution. VxWorks reports _POSIX_VERSION as 200112. The `stat` struct does not contain `st_mtim`, but rather an `st_mtime` which holds a `time_t` which contains seconds. Because of that, when the test creates and modifies a file within one second, the polling watcher does not detect any changes. Fix the problem by postponing the watcher by 1s. Pick-to: 6.7 Task-number: QTBUG-115777 Change-Id: Idfc1d7b2e111967a42c93c0adaffaa7d28ee20a7 Reviewed-by: Thiago Macieira --- .../io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index a5b0087f9c3..184eef3f155 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -26,14 +26,18 @@ using namespace std::chrono_literals; #if defined(Q_OS_QNX) -// Longer polling times on QNX, otherwise the tests fail on the CI +constexpr bool isQNX = true; +#else +constexpr bool isQNX = false; +#endif + +#if defined(Q_OS_QNX) || defined(Q_OS_VXWORKS) +// Longer polling times on QNX and VxWorks, otherwise the tests fail on the CI constexpr auto nativeEngineTimeout = 1s; constexpr auto pollingEngineTimeout = 1s; -constexpr bool isQNX = true; #else constexpr auto nativeEngineTimeout = 0ms; constexpr auto pollingEngineTimeout = 20ms; -constexpr bool isQNX = false; #endif /* All tests need to run in temporary directories not used