summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2014-02-27 12:05:17 +0000
committerDmitry Vyukov <dvyukov@google.com>2014-02-27 12:05:17 +0000
commit17ca4d06c7b65055ded7590a4eb901f796979b64 (patch)
tree61c765d4b6112fafca0ffb09ebd40830979d2109
parent6482bfedf2850f0e73a871fc0bd5e3f35c46cefb (diff)
downloadbcm5719-llvm-17ca4d06c7b65055ded7590a4eb901f796979b64.tar.gz
bcm5719-llvm-17ca4d06c7b65055ded7590a4eb901f796979b64.zip
tsan: 2 more deadlock detector benchmarks
llvm-svn: 202379
-rw-r--r--compiler-rt/test/tsan/deadlock_detector_stress_test.cc50
1 files changed, 50 insertions, 0 deletions
diff --git a/compiler-rt/test/tsan/deadlock_detector_stress_test.cc b/compiler-rt/test/tsan/deadlock_detector_stress_test.cc
index 864d2283340..91a804e0318 100644
--- a/compiler-rt/test/tsan/deadlock_detector_stress_test.cc
+++ b/compiler-rt/test/tsan/deadlock_detector_stress_test.cc
@@ -341,6 +341,54 @@ class LockTest {
}
}
+ void Test12() {
+ if (test_number > 0 && test_number != 12) return;
+ if (!LockType::supports_read_lock()) return;
+ fprintf(stderr, "Starting Test12: 4 threads read lock/unlock 4 shared mutexes, one under another\n");
+ // CHECK-RD: Starting Test12
+ Init(500);
+ // CHECK-RD-NOT: WARNING: ThreadSanitizer:
+ RunThreads(&LockTest::Test12_Thread, &LockTest::Test12_Thread,
+ &LockTest::Test12_Thread, &LockTest::Test12_Thread);
+ }
+ void Test12_Thread() {
+ for (int i = 0; i < iter_count; i++) {
+ RL(000);
+ RL(100);
+ RL(200);
+ RL(300);
+ RU(300);
+ RU(200);
+ RU(100);
+ RU(000);
+ }
+ }
+
+ void Test13() {
+ if (test_number > 0 && test_number != 13) return;
+ if (!LockType::supports_read_lock()) return;
+ fprintf(stderr, "Starting Test13: 4 threads read lock/unlock 4 shared mutexes, all under another shared mutex\n");
+ // CHECK-RD: Starting Test13
+ Init(500);
+ // CHECK-RD-NOT: WARNING: ThreadSanitizer:
+ RunThreads(&LockTest::Test13_Thread, &LockTest::Test13_Thread,
+ &LockTest::Test13_Thread, &LockTest::Test13_Thread);
+ }
+ void Test13_Thread() {
+ for (int i = 0; i < iter_count; i++) {
+ RL(0);
+ RL(100);
+ RU(100);
+ RL(200);
+ RU(200);
+ RL(300);
+ RU(300);
+ RL(400);
+ RU(400);
+ RU(0);
+ }
+ }
+
private:
void Lock2(size_t l1, size_t l2) { L(l1); L(l2); U(l2); U(l1); }
void Lock_0_1() { Lock2(0, 1); }
@@ -416,6 +464,8 @@ int main(int argc, char **argv) {
LockTest().Test9();
LockTest().Test10();
LockTest().Test11();
+ LockTest().Test12();
+ LockTest().Test13();
fprintf(stderr, "ALL-DONE\n");
// CHECK: ALL-DONE
}
OpenPOWER on IntegriCloud