[libcxx] r248993 - Attempt to prevent flaky thread.mutex tests by once again increasing timing tolerances
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 1 01:34:38 PDT 2015
Author: ericwf
Date: Thu Oct 1 03:34:37 2015
New Revision: 248993
URL: http://llvm.org/viewvc/llvm-project?rev=248993&view=rev
Log:
Attempt to prevent flaky thread.mutex tests by once again increasing timing tolerances
Modified:
libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp
libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp
libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp
libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp
libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp
libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp
libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp
libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp
libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp
libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp
libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp
libcxx/trunk/test/support/test_macros.h
Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp?rev=248993&r1=248992&r2=248993&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp Thu Oct 1 03:34:37 2015
@@ -35,10 +35,10 @@ ms WaitTime = ms(250);
// Thread sanitizer causes more overhead and will sometimes cause this test
// to fail. To prevent this we give Thread sanitizer more time to complete the
// test.
-#if !TEST_HAS_FEATURE(thread_sanitizer)
+#if !defined(TEST_HAS_SANITIZERS)
ms Tolerance = ms(50);
#else
-ms Tolerance = ms(100);
+ms Tolerance = ms(50 * 5);
#endif
std::shared_timed_mutex m;
Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp?rev=248993&r1=248992&r2=248993&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp Thu Oct 1 03:34:37 2015
@@ -38,10 +38,10 @@ ms WaitTime = ms(250);
// Thread sanitizer causes more overhead and will sometimes cause this test
// to fail. To prevent this we give Thread sanitizer more time to complete the
// test.
-#if !TEST_HAS_FEATURE(thread_sanitizer)
+#if !defined(TEST_HAS_SANITIZERS)
ms Tolerance = ms(50);
#else
-ms Tolerance = ms(100);
+ms Tolerance = ms(50 * 5);
#endif
Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp?rev=248993&r1=248992&r2=248993&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp Thu Oct 1 03:34:37 2015
@@ -38,13 +38,12 @@ ms WaitTime = ms(250);
// Thread sanitizer causes more overhead and will sometimes cause this test
// to fail. To prevent this we give Thread sanitizer more time to complete the
// test.
-#if !TEST_HAS_FEATURE(thread_sanitizer)
+#if !defined(TEST_HAS_SANITIZERS)
ms Tolerance = ms(50);
#else
-ms Tolerance = ms(100);
+ms Tolerance = ms(50 * 5);
#endif
-
void f1()
{
time_point t0 = Clock::now();
Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp?rev=248993&r1=248992&r2=248993&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp Thu Oct 1 03:34:37 2015
@@ -37,10 +37,10 @@ ms WaitTime = ms(250);
// Thread sanitizer causes more overhead and will sometimes cause this test
// to fail. To prevent this we give Thread sanitizer more time to complete the
// test.
-#if !TEST_HAS_FEATURE(thread_sanitizer)
+#if !defined(TEST_HAS_SANITIZERS)
ms Tolerance = ms(25);
#else
-ms Tolerance = ms(75);
+ms Tolerance = ms(25 * 5);
#endif
Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp?rev=248993&r1=248992&r2=248993&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp Thu Oct 1 03:34:37 2015
@@ -36,10 +36,10 @@ ms WaitTime = ms(250);
// Thread sanitizer causes more overhead and will sometimes cause this test
// to fail. To prevent this we give Thread sanitizer more time to complete the
// test.
-#if !TEST_HAS_FEATURE(thread_sanitizer)
+#if !defined(TEST_HAS_SANITIZERS)
ms Tolerance = ms(50);
#else
-ms Tolerance = ms(100);
+ms Tolerance = ms(50 * 5);
#endif
void f()
Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp?rev=248993&r1=248992&r2=248993&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp Thu Oct 1 03:34:37 2015
@@ -37,10 +37,10 @@ ms WaitTime = ms(250);
// Thread sanitizer causes more overhead and will sometimes cause this test
// to fail. To prevent this we give Thread sanitizer more time to complete the
// test.
-#if !TEST_HAS_FEATURE(thread_sanitizer)
+#if !defined(TEST_HAS_SANITIZERS)
ms Tolerance = ms(50);
#else
-ms Tolerance = ms(100);
+ms Tolerance = ms(50 * 5);
#endif
void f()
Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp?rev=248993&r1=248992&r2=248993&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp Thu Oct 1 03:34:37 2015
@@ -38,10 +38,10 @@ ms WaitTime = ms(250);
// Thread sanitizer causes more overhead and will sometimes cause this test
// to fail. To prevent this we give Thread sanitizer more time to complete the
// test.
-#if !TEST_HAS_FEATURE(thread_sanitizer)
+#if !defined(TEST_HAS_SANITIZERS)
ms Tolerance = ms(50);
#else
-ms Tolerance = ms(100);
+ms Tolerance = ms(50 * 5);
#endif
Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp?rev=248993&r1=248992&r2=248993&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp Thu Oct 1 03:34:37 2015
@@ -38,13 +38,12 @@ ms WaitTime = ms(250);
// Thread sanitizer causes more overhead and will sometimes cause this test
// to fail. To prevent this we give Thread sanitizer more time to complete the
// test.
-#if !TEST_HAS_FEATURE(thread_sanitizer)
+#if !defined(TEST_HAS_SANITIZERS)
ms Tolerance = ms(50);
#else
-ms Tolerance = ms(100);
+ms Tolerance = ms(50 * 5);
#endif
-
void f1()
{
time_point t0 = Clock::now();
Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp?rev=248993&r1=248992&r2=248993&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp Thu Oct 1 03:34:37 2015
@@ -22,6 +22,8 @@
#include <cstdlib>
#include <cassert>
+#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()
Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp?rev=248993&r1=248992&r2=248993&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp Thu Oct 1 03:34:37 2015
@@ -38,13 +38,12 @@ ms WaitTime = ms(250);
// Thread sanitizer causes more overhead and will sometimes cause this test
// to fail. To prevent this we give Thread sanitizer more time to complete the
// test.
-#if !TEST_HAS_FEATURE(thread_sanitizer)
+#if !defined(TEST_HAS_SANITIZERS)
ms Tolerance = ms(50);
#else
-ms Tolerance = ms(100);
+ms Tolerance = ms(50 * 5);
#endif
-
void f1()
{
time_point t0 = Clock::now();
Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp?rev=248993&r1=248992&r2=248993&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp Thu Oct 1 03:34:37 2015
@@ -38,13 +38,12 @@ ms WaitTime = ms(250);
// Thread sanitizer causes more overhead and will sometimes cause this test
// to fail. To prevent this we give Thread sanitizer more time to complete the
// test.
-#if !TEST_HAS_FEATURE(thread_sanitizer)
+#if !defined(TEST_HAS_SANITIZERS)
ms Tolerance = ms(50);
#else
-ms Tolerance = ms(100);
+ms Tolerance = ms(50 * 5);
#endif
-
void f1()
{
time_point t0 = Clock::now();
Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp?rev=248993&r1=248992&r2=248993&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp Thu Oct 1 03:34:37 2015
@@ -38,13 +38,12 @@ ms WaitTime = ms(250);
// Thread sanitizer causes more overhead and will sometimes cause this test
// to fail. To prevent this we give Thread sanitizer more time to complete the
// test.
-#if !TEST_HAS_FEATURE(thread_sanitizer)
+#if !defined(TEST_HAS_SANITIZERS)
ms Tolerance = ms(50);
#else
-ms Tolerance = ms(100);
+ms Tolerance = ms(50 * 5);
#endif
-
void f1()
{
time_point t0 = Clock::now();
Modified: libcxx/trunk/test/support/test_macros.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_macros.h?rev=248993&r1=248992&r2=248993&view=diff
==============================================================================
--- libcxx/trunk/test/support/test_macros.h (original)
+++ libcxx/trunk/test/support/test_macros.h Thu Oct 1 03:34:37 2015
@@ -96,4 +96,9 @@ template <unsigned> struct static_assert
#define TEST_HAS_NO_EXCEPTIONS
#endif
+#if TEST_HAS_FEATURE(address_sanitizer) || TEST_HAS_FEATURE(memory_sanitizer) || \
+ TEST_HAS_FEATURE(thread_sanitizer)
+#define TEST_HAS_SANITIZERS
+#endif
+
#endif // SUPPORT_TEST_MACROS_HPP
More information about the cfe-commits
mailing list