[compiler-rt] r200972 - tsan: improve the test

Dmitry Vyukov dvyukov at google.com
Fri Feb 7 03:48:06 PST 2014


Author: dvyukov
Date: Fri Feb  7 05:48:06 2014
New Revision: 200972

URL: http://llvm.org/viewvc/llvm-project?rev=200972&view=rev
Log:
tsan: improve the test
remove TSAN_OPTIONS from the test, so that it runs in the presubmit script
add a CHECK, so that it can run with FileCheck as well


Modified:
    compiler-rt/trunk/lib/tsan/lit_tests/getline_nohang.cc

Modified: compiler-rt/trunk/lib/tsan/lit_tests/getline_nohang.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/getline_nohang.cc?rev=200972&r1=200971&r2=200972&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/getline_nohang.cc (original)
+++ compiler-rt/trunk/lib/tsan/lit_tests/getline_nohang.cc Fri Feb  7 05:48:06 2014
@@ -1,4 +1,4 @@
-// RUN: %clangxx_tsan -O1 %s -o %t && TSAN_OPTIONS=report_thread_leaks=0 %t
+// RUN: %clangxx_tsan -O1 %s -o %t && %t
 
 // Make sure TSan doesn't deadlock on a file stream lock at program shutdown.
 // See https://code.google.com/p/thread-sanitizer/issues/detail?id=47
@@ -22,7 +22,14 @@ void *thread(void *unused) {
 
 int main() {
   pthread_t t;
-  pthread_create(&t, NULL, thread, NULL);
+  pthread_attr_t a;
+  pthread_attr_init(&a);
+  pthread_attr_setdetachstate(&a, PTHREAD_CREATE_DETACHED);
+  pthread_create(&t, &a, thread, NULL);
+  pthread_attr_destroy(&a);
+  fprintf(stderr, "DONE\n");
   return 0;
   // ThreadSanitizer used to hang here because of a deadlock on a file stream.
 }
+
+// CHECK: DONE





More information about the llvm-commits mailing list