diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2014-02-27 09:05:07 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2014-02-27 09:05:07 +0000 |
commit | 1e1214a17deb3828468eb616175970ccefac401f (patch) | |
tree | 04e3ae892772a23570955df1441bc34be0a95666 /test | |
parent | efd8e75e00a786fd586e1e7b1139d9e1ef194ec0 (diff) |
tsan: add another deadlock detector benchmark
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@202366 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/tsan/deadlock_detector_stress_test.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/tsan/deadlock_detector_stress_test.cc b/test/tsan/deadlock_detector_stress_test.cc index 053fe690e..975f06663 100644 --- a/test/tsan/deadlock_detector_stress_test.cc +++ b/test/tsan/deadlock_detector_stress_test.cc @@ -313,6 +313,34 @@ class LockTest { } } + void Test11() { + if (test_number > 0 && test_number != 11) return; + fprintf(stderr, "Starting Test11: 4 threads lock/unlock 4 private mutexes, all under another private mutex\n"); + // CHECK: Starting Test10 + Init(500); + // CHECK-NOT: WARNING: ThreadSanitizer: + RunThreads(&LockTest::Test11_Thread1, &LockTest::Test11_Thread2, + &LockTest::Test11_Thread3, &LockTest::Test11_Thread4); + } + void Test11_Thread1() { Test10_Thread(0); } + void Test11_Thread2() { Test10_Thread(10); } + void Test11_Thread3() { Test10_Thread(20); } + void Test11_Thread4() { Test10_Thread(30); } + void Test11_Thread(size_t m) { + for (int i = 0; i < iter_count; i++) { + L(m); + L(m + 100); + U(m + 100); + L(m + 200); + U(m + 200); + L(m + 300); + U(m + 300); + L(m + 400); + U(m + 500); + U(m); + } + } + private: void Lock2(size_t l1, size_t l2) { L(l1); L(l2); U(l2); U(l1); } void Lock_0_1() { Lock2(0, 1); } @@ -387,6 +415,7 @@ int main(int argc, char **argv) { LockTest().Test8(); LockTest().Test9(); LockTest().Test10(); + LockTest().Test11(); fprintf(stderr, "ALL-DONE\n"); // CHECK: ALL-DONE } |