diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2016-09-06 19:49:25 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2016-09-06 19:49:25 +0300 |
commit | 2539c50f3234a6a1afb079e3872c1e72af5d1bd8 (patch) | |
tree | 387cef589251a987a3689a10676a099bd40cebec /test | |
parent | 32eaa26daea519a3c21923bf132e93facc7fa3b9 (diff) |
Fixed bad constexpr in fast_hash.
shared_fs_mutex fallback test now waits around until children are definitely active rather than using a timeout. Hopefully this will fix the CI failures.
Diffstat (limited to 'test')
m--------- | test/kerneltest | 0 | ||||
-rw-r--r-- | test/tests/shared_fs_mutex.cpp | 13 |
2 files changed, 11 insertions, 2 deletions
diff --git a/test/kerneltest b/test/kerneltest -Subproject bf07033539a341860d0bac3a205ce45931b6b6e +Subproject 7890fb08ac0b48f9f138e6dac0ed2532bb417e4 diff --git a/test/tests/shared_fs_mutex.cpp b/test/tests/shared_fs_mutex.cpp index 150f0841..87596fbf 100644 --- a/test/tests/shared_fs_mutex.cpp +++ b/test/tests/shared_fs_mutex.cpp @@ -463,7 +463,7 @@ static void TestMemoryMapFallback() auto shared_mem_file_map = afio::map_handle::map(shared_mem_file_section).get(); shared_memory *shmem = (shared_memory *) shared_mem_file_map.address(); auto begin = afio::stl11::chrono::steady_clock::now(); - while(afio::stl11::chrono::duration_cast<afio::stl11::chrono::seconds>(afio::stl11::chrono::steady_clock::now() - begin).count() < 5) + while(afio::stl11::chrono::duration_cast<afio::stl11::chrono::seconds>(afio::stl11::chrono::steady_clock::now() - begin).count() < 20) { shmem->current_shared = -(long) afio::stl11::thread::hardware_concurrency(); shmem->current_exclusive = -(long) afio::stl11::thread::hardware_concurrency() - 1; @@ -473,7 +473,16 @@ static void TestMemoryMapFallback() auto child_workers = kerneltest::launch_child_workers("TestSharedFSMutexCorrectness", afio::stl11::thread::hardware_concurrency()); child_workers.wait_until_ready(); child_workers.go(); - afio::stl11::this_thread::sleep_for(afio::stl11::chrono::milliseconds(50)); + // Wait until children get to lock + { + auto lk = afio::algorithm::shared_fs_mutex::memory_map<>::fs_mutex_map("lockfile").get(); + bool done; + do + { + auto _ = lk.try_lock(afio::algorithm::shared_fs_mutex::shared_fs_mutex::entity_type(0, false)); + done = _.has_error(); + } while(!done); + } // Zomp the lock file pretending to be a networked user { auto lf = afio::file_handle::file("lockfile", afio::file_handle::mode::write, afio::file_handle::creation::open_existing, afio::file_handle::caching::reads).get(); |