summaryrefslogtreecommitdiff
path: root/test/tsan/deadlock_detector_stress_test.cc
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
commit0de21a0e0398c37a717411707014b2eb9f98e170 (patch)
tree83b06551bf08edd1311766ce789035c66e9fa91d /test/tsan/deadlock_detector_stress_test.cc
parent61dc076b63907f61ee59e6ed7c8dffdf27f1f10b (diff)
[tsan] one more test for deadlock detector
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@202476 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/tsan/deadlock_detector_stress_test.cc')
-rw-r--r--test/tsan/deadlock_detector_stress_test.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/test/tsan/deadlock_detector_stress_test.cc b/test/tsan/deadlock_detector_stress_test.cc
index 91a804e03..157fbd84a 100644
--- a/test/tsan/deadlock_detector_stress_test.cc
+++ b/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
}