Attempt to prevent flaky thread.mutex tests by once again increasing timing tolerances
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@248993 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9698ac5a68
commit
d95ca09be4
@ -35,10 +35,10 @@ ms WaitTime = ms(250);
|
|||||||
// Thread sanitizer causes more overhead and will sometimes cause this test
|
// 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
|
// to fail. To prevent this we give Thread sanitizer more time to complete the
|
||||||
// test.
|
// test.
|
||||||
#if !TEST_HAS_FEATURE(thread_sanitizer)
|
#if !defined(TEST_HAS_SANITIZERS)
|
||||||
ms Tolerance = ms(50);
|
ms Tolerance = ms(50);
|
||||||
#else
|
#else
|
||||||
ms Tolerance = ms(100);
|
ms Tolerance = ms(50 * 5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::shared_timed_mutex m;
|
std::shared_timed_mutex m;
|
||||||
|
@ -38,10 +38,10 @@ ms WaitTime = ms(250);
|
|||||||
// Thread sanitizer causes more overhead and will sometimes cause this test
|
// 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
|
// to fail. To prevent this we give Thread sanitizer more time to complete the
|
||||||
// test.
|
// test.
|
||||||
#if !TEST_HAS_FEATURE(thread_sanitizer)
|
#if !defined(TEST_HAS_SANITIZERS)
|
||||||
ms Tolerance = ms(50);
|
ms Tolerance = ms(50);
|
||||||
#else
|
#else
|
||||||
ms Tolerance = ms(100);
|
ms Tolerance = ms(50 * 5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,13 +38,12 @@ ms WaitTime = ms(250);
|
|||||||
// Thread sanitizer causes more overhead and will sometimes cause this test
|
// 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
|
// to fail. To prevent this we give Thread sanitizer more time to complete the
|
||||||
// test.
|
// test.
|
||||||
#if !TEST_HAS_FEATURE(thread_sanitizer)
|
#if !defined(TEST_HAS_SANITIZERS)
|
||||||
ms Tolerance = ms(50);
|
ms Tolerance = ms(50);
|
||||||
#else
|
#else
|
||||||
ms Tolerance = ms(100);
|
ms Tolerance = ms(50 * 5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void f1()
|
void f1()
|
||||||
{
|
{
|
||||||
time_point t0 = Clock::now();
|
time_point t0 = Clock::now();
|
||||||
|
@ -37,10 +37,10 @@ ms WaitTime = ms(250);
|
|||||||
// Thread sanitizer causes more overhead and will sometimes cause this test
|
// 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
|
// to fail. To prevent this we give Thread sanitizer more time to complete the
|
||||||
// test.
|
// test.
|
||||||
#if !TEST_HAS_FEATURE(thread_sanitizer)
|
#if !defined(TEST_HAS_SANITIZERS)
|
||||||
ms Tolerance = ms(25);
|
ms Tolerance = ms(25);
|
||||||
#else
|
#else
|
||||||
ms Tolerance = ms(75);
|
ms Tolerance = ms(25 * 5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,10 +36,10 @@ ms WaitTime = ms(250);
|
|||||||
// Thread sanitizer causes more overhead and will sometimes cause this test
|
// 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
|
// to fail. To prevent this we give Thread sanitizer more time to complete the
|
||||||
// test.
|
// test.
|
||||||
#if !TEST_HAS_FEATURE(thread_sanitizer)
|
#if !defined(TEST_HAS_SANITIZERS)
|
||||||
ms Tolerance = ms(50);
|
ms Tolerance = ms(50);
|
||||||
#else
|
#else
|
||||||
ms Tolerance = ms(100);
|
ms Tolerance = ms(50 * 5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void f()
|
void f()
|
||||||
|
@ -37,10 +37,10 @@ ms WaitTime = ms(250);
|
|||||||
// Thread sanitizer causes more overhead and will sometimes cause this test
|
// 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
|
// to fail. To prevent this we give Thread sanitizer more time to complete the
|
||||||
// test.
|
// test.
|
||||||
#if !TEST_HAS_FEATURE(thread_sanitizer)
|
#if !defined(TEST_HAS_SANITIZERS)
|
||||||
ms Tolerance = ms(50);
|
ms Tolerance = ms(50);
|
||||||
#else
|
#else
|
||||||
ms Tolerance = ms(100);
|
ms Tolerance = ms(50 * 5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void f()
|
void f()
|
||||||
|
@ -38,10 +38,10 @@ ms WaitTime = ms(250);
|
|||||||
// Thread sanitizer causes more overhead and will sometimes cause this test
|
// 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
|
// to fail. To prevent this we give Thread sanitizer more time to complete the
|
||||||
// test.
|
// test.
|
||||||
#if !TEST_HAS_FEATURE(thread_sanitizer)
|
#if !defined(TEST_HAS_SANITIZERS)
|
||||||
ms Tolerance = ms(50);
|
ms Tolerance = ms(50);
|
||||||
#else
|
#else
|
||||||
ms Tolerance = ms(100);
|
ms Tolerance = ms(50 * 5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,13 +38,12 @@ ms WaitTime = ms(250);
|
|||||||
// Thread sanitizer causes more overhead and will sometimes cause this test
|
// 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
|
// to fail. To prevent this we give Thread sanitizer more time to complete the
|
||||||
// test.
|
// test.
|
||||||
#if !TEST_HAS_FEATURE(thread_sanitizer)
|
#if !defined(TEST_HAS_SANITIZERS)
|
||||||
ms Tolerance = ms(50);
|
ms Tolerance = ms(50);
|
||||||
#else
|
#else
|
||||||
ms Tolerance = ms(100);
|
ms Tolerance = ms(50 * 5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void f1()
|
void f1()
|
||||||
{
|
{
|
||||||
time_point t0 = Clock::now();
|
time_point t0 = Clock::now();
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "test_macros.h"
|
||||||
|
|
||||||
std::shared_timed_mutex m;
|
std::shared_timed_mutex m;
|
||||||
|
|
||||||
typedef std::chrono::system_clock Clock;
|
typedef std::chrono::system_clock Clock;
|
||||||
@ -30,6 +32,13 @@ typedef Clock::duration duration;
|
|||||||
typedef std::chrono::milliseconds ms;
|
typedef std::chrono::milliseconds ms;
|
||||||
typedef std::chrono::nanoseconds ns;
|
typedef std::chrono::nanoseconds ns;
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(TEST_HAS_SANITIZERS)
|
||||||
|
ms Tolerance = ms(200);
|
||||||
|
#else
|
||||||
|
ms Tolerance = ms(200 * 5);
|
||||||
|
#endif
|
||||||
|
|
||||||
void f()
|
void f()
|
||||||
{
|
{
|
||||||
time_point t0 = Clock::now();
|
time_point t0 = Clock::now();
|
||||||
@ -41,7 +50,7 @@ void f()
|
|||||||
time_point t1 = Clock::now();
|
time_point t1 = Clock::now();
|
||||||
m.unlock_shared();
|
m.unlock_shared();
|
||||||
ns d = t1 - t0 - ms(250);
|
ns d = t1 - t0 - ms(250);
|
||||||
assert(d < ms(200)); // within 200ms
|
assert(d < Tolerance); // within tolerance
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
@ -38,13 +38,12 @@ ms WaitTime = ms(250);
|
|||||||
// Thread sanitizer causes more overhead and will sometimes cause this test
|
// 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
|
// to fail. To prevent this we give Thread sanitizer more time to complete the
|
||||||
// test.
|
// test.
|
||||||
#if !TEST_HAS_FEATURE(thread_sanitizer)
|
#if !defined(TEST_HAS_SANITIZERS)
|
||||||
ms Tolerance = ms(50);
|
ms Tolerance = ms(50);
|
||||||
#else
|
#else
|
||||||
ms Tolerance = ms(100);
|
ms Tolerance = ms(50 * 5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void f1()
|
void f1()
|
||||||
{
|
{
|
||||||
time_point t0 = Clock::now();
|
time_point t0 = Clock::now();
|
||||||
|
@ -38,13 +38,12 @@ ms WaitTime = ms(250);
|
|||||||
// Thread sanitizer causes more overhead and will sometimes cause this test
|
// 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
|
// to fail. To prevent this we give Thread sanitizer more time to complete the
|
||||||
// test.
|
// test.
|
||||||
#if !TEST_HAS_FEATURE(thread_sanitizer)
|
#if !defined(TEST_HAS_SANITIZERS)
|
||||||
ms Tolerance = ms(50);
|
ms Tolerance = ms(50);
|
||||||
#else
|
#else
|
||||||
ms Tolerance = ms(100);
|
ms Tolerance = ms(50 * 5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void f1()
|
void f1()
|
||||||
{
|
{
|
||||||
time_point t0 = Clock::now();
|
time_point t0 = Clock::now();
|
||||||
|
@ -38,13 +38,12 @@ ms WaitTime = ms(250);
|
|||||||
// Thread sanitizer causes more overhead and will sometimes cause this test
|
// 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
|
// to fail. To prevent this we give Thread sanitizer more time to complete the
|
||||||
// test.
|
// test.
|
||||||
#if !TEST_HAS_FEATURE(thread_sanitizer)
|
#if !defined(TEST_HAS_SANITIZERS)
|
||||||
ms Tolerance = ms(50);
|
ms Tolerance = ms(50);
|
||||||
#else
|
#else
|
||||||
ms Tolerance = ms(100);
|
ms Tolerance = ms(50 * 5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void f1()
|
void f1()
|
||||||
{
|
{
|
||||||
time_point t0 = Clock::now();
|
time_point t0 = Clock::now();
|
||||||
|
@ -96,4 +96,9 @@ template <unsigned> struct static_assert_check {};
|
|||||||
#define TEST_HAS_NO_EXCEPTIONS
|
#define TEST_HAS_NO_EXCEPTIONS
|
||||||
#endif
|
#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
|
#endif // SUPPORT_TEST_MACROS_HPP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user