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.
This commit is contained in:
1 parent
f7d35efaa7
commit
1eb1604e5b
1 file changed
+5
@@ -177,6 +177,11 @@ Void::Testing::Test directory_watcher_signals_rescan_on_overflow_and_limit()
|
|||||||
auto w_res =
|
auto w_res =
|
||||||
Void::FileSystem::DirectoryWatcher::create(tmp.path(), tight);
|
Void::FileSystem::DirectoryWatcher::create(tmp.path(), tight);
|
||||||
Void::Testing::require(w_res.has_value());
|
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::Testing::require(
|
||||||
Void::FileSystem::ensure_directory(tmp / "extra_dir").has_value());
|
Void::FileSystem::ensure_directory(tmp / "extra_dir").has_value());
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|||||||
Reference in new issue
Block a user