diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2015-01-21 13:50:02 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2015-01-21 13:50:02 +0000 |
commit | 12de706f2fd387981e5925a1e42207934613660f (patch) | |
tree | 283f74c94ee89994c1ed8bf052ae7da7d2f8dec7 /test/tsan/signal_sync.cc | |
parent | 18422b49071ba5ea813d1b065458d6b81c6ef115 (diff) |
tsan: remove sleeps from tests
Even sleep(1) lead to episodical flakes on some machines.
Use an invisible by tsan barrier to enforce required execution order instead.
This makes the tests deterministic and faster.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226659 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/tsan/signal_sync.cc')
-rw-r--r-- | test/tsan/signal_sync.cc | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/test/tsan/signal_sync.cc b/test/tsan/signal_sync.cc index 15387b754..6ff19d3bd 100644 --- a/test/tsan/signal_sync.cc +++ b/test/tsan/signal_sync.cc @@ -1,11 +1,8 @@ // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s -#include <pthread.h> -#include <stdio.h> -#include <stdlib.h> +#include "test.h" #include <signal.h> #include <sys/types.h> #include <sys/time.h> -#include <unistd.h> #include <errno.h> volatile int X; @@ -18,7 +15,7 @@ static void handler(int sig) { static void* thr(void *p) { for (int i = 0; i != 1000; i++) - usleep(1000); + usleep(1000); // process signals return 0; } |