From 6425cfbc4fbdb509fb131bde3475a10eab4a5af5 Mon Sep 17 00:00:00 2001 From: arvidn Date: Mon, 3 Jul 2017 21:00:33 -0400 Subject: [PATCH] tests should not fail by failing to clean up. Make clean up more reliable on windows --- test/main.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/main.cpp b/test/main.cpp index e85563562..53f2df390 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -254,7 +254,16 @@ struct unit_directory_guard return; } remove_all(dir, ec); - if (ec) TEST_ERROR("Failed to remove unit test directory: " + ec.message()); +#ifdef TORRENT_WINDOWS + if (ec.value() == ERROR_SHARING_VIOLATION) + { + // on windows, files are removed in the background, and we may need + // to wait a little bit + std::this_thread::sleep_for(milliseconds(400)); + remove_all(dir, ec); + } +#endif + if (ec) std::cerr << "Failed to remove unit test directory: " << ec.message() << "\n"; } };