summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2014-02-28 09:17:16 +0000
committerKostya Serebryany <kcc@google.com>2014-02-28 09:17:16 +0000
commitb86b56c0db2578262fc068c225a22093af853807 (patch)
treef538b043dee9d21cf5ce2733e46e1c9485b3c88b
parent741602461d2079c682916bce6701c39acb08bbd3 (diff)
downloadbcm5719-llvm-b86b56c0db2578262fc068c225a22093af853807.tar.gz
bcm5719-llvm-b86b56c0db2578262fc068c225a22093af853807.zip
[tsan] one more test for deadlock detector
llvm-svn: 202476
-rw-r--r--compiler-rt/test/tsan/deadlock_detector_stress_test.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/compiler-rt/test/tsan/deadlock_detector_stress_test.cc b/compiler-rt/test/tsan/deadlock_detector_stress_test.cc
index 91a804e0318..157fbd84a8e 100644
--- a/compiler-rt/test/tsan/deadlock_detector_stress_test.cc
+++ b/compiler-rt/test/tsan/deadlock_detector_stress_test.cc
@@ -389,6 +389,17 @@ class LockTest {
}
}
+ void Test14() {
+ if (test_number > 0 && test_number != 14) return;
+ fprintf(stderr, "Starting Test14: create lots of locks in 4 threads\n");
+ Init(10);
+ // CHECK-RD: Starting Test14
+ RunThreads(&LockTest::CreateAndDestroyLocksLoop,
+ &LockTest::CreateAndDestroyLocksLoop,
+ &LockTest::CreateAndDestroyLocksLoop,
+ &LockTest::CreateAndDestroyLocksLoop);
+ }
+
private:
void Lock2(size_t l1, size_t l2) { L(l1); L(l2); U(l2); U(l1); }
void Lock_0_1() { Lock2(0, 1); }
@@ -406,9 +417,17 @@ class LockTest {
void Lock1_Loop_2() { Lock1_Loop(20, iter_count); }
void CreateAndDestroyManyLocks() {
- LockType create_many_locks_but_never_acquire[kDeadlockGraphSize];
- (void)create_many_locks_but_never_acquire;
+ LockType *create_many_locks_but_never_acquire =
+ new LockType[kDeadlockGraphSize];
(void)create_many_locks_but_never_acquire;
+ delete [] create_many_locks_but_never_acquire;
+ }
+
+ void CreateAndDestroyLocksLoop() {
+ for (size_t it = 0; it <= iter_count; it++) {
+ LockType some_locks[10];
+ (void)some_locks;
+ }
}
void CreateLockUnlockAndDestroyManyLocks() {
@@ -466,6 +485,7 @@ int main(int argc, char **argv) {
LockTest().Test11();
LockTest().Test12();
LockTest().Test13();
+ LockTest().Test14();
fprintf(stderr, "ALL-DONE\n");
// CHECK: ALL-DONE
}
OpenPOWER on IntegriCloud