From b4c64ad90b81d2a779786b7edb4c5c6dd28cc57d Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Wed, 30 Dec 2015 11:54:09 +0000 Subject: Vendor import of libc++ trunk r256633: https://llvm.org/svn/llvm-project/libcxx/trunk@256633 --- .../thread.sharedtimedmutex.class/try_lock_shared.pass.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp') diff --git a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp index 9c2d8c9c8e5c..3d5604d886cb 100644 --- a/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp +++ b/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp @@ -22,6 +22,8 @@ #include #include +#include "test_macros.h" + std::shared_timed_mutex m; typedef std::chrono::system_clock Clock; @@ -30,6 +32,13 @@ typedef Clock::duration duration; typedef std::chrono::milliseconds ms; typedef std::chrono::nanoseconds ns; + +#if !defined(TEST_HAS_SANITIZERS) +ms Tolerance = ms(200); +#else +ms Tolerance = ms(200 * 5); +#endif + void f() { time_point t0 = Clock::now(); @@ -41,7 +50,7 @@ void f() time_point t1 = Clock::now(); m.unlock_shared(); ns d = t1 - t0 - ms(250); - assert(d < ms(200)); // within 200ms + assert(d < Tolerance); // within tolerance } int main() -- cgit v1.3