[compiler-rt] r192874 - tsan: merge 2 similar tests into 1

Dmitry Vyukov dvyukov at google.com
Thu Oct 17 01:27:24 PDT 2013


Author: dvyukov
Date: Thu Oct 17 03:27:24 2013
New Revision: 192874

URL: http://llvm.org/viewvc/llvm-project?rev=192874&view=rev
Log:
tsan: merge 2 similar tests into 1


Removed:
    compiler-rt/trunk/lib/tsan/lit_tests/deep_stack0.cc
Modified:
    compiler-rt/trunk/lib/tsan/lit_tests/deep_stack1.cc
    compiler-rt/trunk/lib/tsan/lit_tests/default_options.cc

Removed: compiler-rt/trunk/lib/tsan/lit_tests/deep_stack0.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/deep_stack0.cc?rev=192873&view=auto
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/deep_stack0.cc (original)
+++ compiler-rt/trunk/lib/tsan/lit_tests/deep_stack0.cc (removed)
@@ -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)
-

Modified: compiler-rt/trunk/lib/tsan/lit_tests/deep_stack1.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/deep_stack1.cc?rev=192874&r1=192873&r2=192874&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/deep_stack1.cc (original)
+++ compiler-rt/trunk/lib/tsan/lit_tests/deep_stack1.cc Thu Oct 17 03:27:24 2013
@@ -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 @@ static void foo() {
 }
 
 void *Thread(void *p) {
+#ifdef ORDER1
+  sleep(1);
+#endif
   F();
   return 0;
 }
@@ -27,7 +31,9 @@ int main() {
   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);
 }

Modified: compiler-rt/trunk/lib/tsan/lit_tests/default_options.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/default_options.cc?rev=192874&r1=192873&r2=192874&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/default_options.cc (original)
+++ compiler-rt/trunk/lib/tsan/lit_tests/default_options.cc Thu Oct 17 03:27:24 2013
@@ -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>
 





More information about the llvm-commits mailing list