diff options
author | bart <bart@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2009-05-31 11:53:39 +0000 |
---|---|---|
committer | bart <bart@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2009-05-31 11:53:39 +0000 |
commit | 263476b9921f9ba48adec8fc2395fdac063b1eaa (patch) | |
tree | 0c454a984f706bb35a6865f9ea915af2537bc6ea | |
parent | 824109519c9098219c0a98593b09da1573c0903b (diff) | |
download | valgrind-263476b9921f9ba48adec8fc2395fdac063b1eaa.tar.gz |
Customized for DRD.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10177 a5019735-40e9-0310-863c-91ae7b9d1cf9
-rw-r--r-- | drd/tests/tsan_thread_wrappers_pthread.h | 5 | ||||
-rw-r--r-- | drd/tests/tsan_unittest.cpp | 12 |
2 files changed, 10 insertions, 7 deletions
diff --git a/drd/tests/tsan_thread_wrappers_pthread.h b/drd/tests/tsan_thread_wrappers_pthread.h index 235daea5c..a827d90cb 100644 --- a/drd/tests/tsan_thread_wrappers_pthread.h +++ b/drd/tests/tsan_thread_wrappers_pthread.h @@ -61,7 +61,10 @@ using namespace std; #include <sys/time.h> #include <time.h> -#include "dynamic_annotations.h" +#include "../../drd/drd.h" +#define ANNOTATE_NO_OP(arg) do { } while(0) +#define ANNOTATE_EXPECT_RACE(addr, descr) DRDCL_(ignore_range)(addr, 4) +static inline bool RunningOnValgrind() { return RUNNING_ON_VALGRIND; } #include <assert.h> #ifdef NDEBUG diff --git a/drd/tests/tsan_unittest.cpp b/drd/tests/tsan_unittest.cpp index 49335b79f..4e81589e7 100644 --- a/drd/tests/tsan_unittest.cpp +++ b/drd/tests/tsan_unittest.cpp @@ -46,7 +46,7 @@ // This test must not include any other file specific to threading library, // everything should be inside THREAD_WRAPPERS. #ifndef THREAD_WRAPPERS -# define THREAD_WRAPPERS "thread_wrappers_pthread.h" +# define THREAD_WRAPPERS "tsan_thread_wrappers_pthread.h" #endif #include THREAD_WRAPPERS @@ -208,7 +208,7 @@ static bool ArgIsTrue(bool *arg) { return *arg == true; }; ANNOTATE_EXPECT_RACE_FOR_MACHINE(mem, descr, "MSM_THREAD_SANITIZER") inline bool Tsan_PureHappensBefore() { - return getenv("TSAN_PURE_HAPPENS_BEFORE") != NULL; + return true; } inline bool Tsan_FastMode() { @@ -1515,7 +1515,7 @@ void Writer() { for (int j = i; j < N; j++) { GLOB[j] = j; } - ANNOTATE_CONDVAR_SIGNAL(reinterpret_cast<void*>(BOUNDARY+1)); + ANNOTATE_HAPPENS_BEFORE(reinterpret_cast<void*>(BOUNDARY+1)); BOUNDARY++; usleep(1000); } @@ -1526,7 +1526,7 @@ void Reader() { do { n = BOUNDARY; if (n == 0) continue; - ANNOTATE_CONDVAR_WAIT(reinterpret_cast<void*>(n)); + ANNOTATE_HAPPENS_AFTER_REPEATEDLY(reinterpret_cast<void*>(n)); for (int i = 0; i < n; i++) { CHECK(GLOB[i] == i); } @@ -1568,7 +1568,7 @@ void Writer1() { for (int j = i; j < N; j++) { GLOB[j] = j; } - ANNOTATE_CONDVAR_SIGNAL(reinterpret_cast<void*>(BOUNDARY+1)); + ANNOTATE_HAPPENS_BEFORE(reinterpret_cast<void*>(BOUNDARY+1)); BOUNDARY++; usleep(1000); } @@ -1579,7 +1579,7 @@ void Writer2() { do { n = BOUNDARY; if (n == 0) continue; - ANNOTATE_CONDVAR_WAIT(reinterpret_cast<void*>(n)); + ANNOTATE_HAPPENS_AFTER_REPEATEDLY(reinterpret_cast<void*>(n)); for (int i = 0; i < n; i++) { if(GLOB[i] == i) { GLOB[i]++; |