tsan: merge 2 similar tests into 1
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192874 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/tsan/lit_tests/deep_stack0.cc b/lib/tsan/lit_tests/deep_stack0.cc
deleted file mode 100644
index 7c0a816..0000000
--- a/lib/tsan/lit_tests/deep_stack0.cc
+++ /dev/null
@@ -1,38 +0,0 @@
-// RUN: %clangxx_tsan -O1 %s -o %t && not %t 2>&1 | FileCheck %s
-#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
-
-volatile int X;
-volatile int N;
-void (*volatile F)();
-
-static void foo() {
- if (--N == 0)
- X = 42;
- else
- F();
-}
-
-void *Thread(void *p) {
- sleep(1);
- F();
- return 0;
-}
-
-int main() {
- N = 50000;
- F = foo;
- pthread_t t;
- pthread_attr_t a;
- pthread_attr_init(&a);
- pthread_attr_setstacksize(&a, N * 256 + (1 << 20));
- pthread_create(&t, &a, Thread, 0);
- X = 43;
- pthread_join(t, 0);
-}
-
-// CHECK: WARNING: ThreadSanitizer: data race
-// CHECK: #100 foo
-// We must output suffucuently large stack (at least 100 frames)
-
diff --git a/lib/tsan/lit_tests/deep_stack1.cc b/lib/tsan/lit_tests/deep_stack1.cc
index 929f1e6..3048aa8 100644
--- a/lib/tsan/lit_tests/deep_stack1.cc
+++ b/lib/tsan/lit_tests/deep_stack1.cc
@@ -1,4 +1,5 @@
-// RUN: %clangxx_tsan -O1 %s -o %t && not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_tsan -O1 %s -o %t -DORDER1 && not %t 2>&1 | FileCheck %s
+// RUN: %clangxx_tsan -O1 %s -o %t -DORDER2 && not %t 2>&1 | FileCheck %s
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>
@@ -15,6 +16,9 @@
}
void *Thread(void *p) {
+#ifdef ORDER1
+ sleep(1);
+#endif
F();
return 0;
}
@@ -27,7 +31,9 @@
pthread_attr_init(&a);
pthread_attr_setstacksize(&a, N * 256 + (1 << 20));
pthread_create(&t, &a, Thread, 0);
+#ifdef ORDER2
sleep(1);
+#endif
X = 43;
pthread_join(t, 0);
}
diff --git a/lib/tsan/lit_tests/default_options.cc b/lib/tsan/lit_tests/default_options.cc
index 652a7bf..62c6c02 100644
--- a/lib/tsan/lit_tests/default_options.cc
+++ b/lib/tsan/lit_tests/default_options.cc
@@ -1,4 +1,4 @@
-// RUN: %clang_tsan -O1 %s -o %t && not %t 2>&1 | FileCheck %s
+// RUN: %clang_tsan -O1 %s -o %t && %t 2>&1 | FileCheck %s
#include <pthread.h>
#include <stdio.h>