From 1eb1604e5b7c49776a552e55eff11ee60d21df1a Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Sun, 6 Dec 2026 03:17:48 +0300 Subject: [PATCH] Windows: let the DirectoryWatcher thread arm before testing changes The ReadDirectoryChangesW backend arms its first read on the watcher thread, so a change made immediately after create() could be lost. Settle briefly on Windows before creating the directory the test expects to observe. Wine 11 stress run: DirectoryWatcher suite 10/10 runs green. --- tests/standalone/System/DirectoryWatcher.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/standalone/System/DirectoryWatcher.cpp b/tests/standalone/System/DirectoryWatcher.cpp index bd9d06d..fa07b27 100644 --- a/tests/standalone/System/DirectoryWatcher.cpp +++ b/tests/standalone/System/DirectoryWatcher.cpp @@ -177,6 +177,11 @@ Void::Testing::Test directory_watcher_signals_rescan_on_overflow_and_limit() auto w_res = Void::FileSystem::DirectoryWatcher::create(tmp.path(), tight); Void::Testing::require(w_res.has_value()); +#ifdef _WIN32 + // The Windows backend arms its first read on the watcher thread; let + // it start before making a change that must be observed. + std::this_thread::sleep_for(std::chrono::milliseconds{50}); +#endif Void::Testing::require( Void::FileSystem::ensure_directory(tmp / "extra_dir").has_value()); #ifdef _WIN32