[compiler-rt] r253858 - [tsan] Modify the tls_race.cc and tls_race2.cc tests to pass on OS X

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 23 00:17:17 PST 2015


Author: kuba.brecka
Date: Mon Nov 23 02:17:17 2015
New Revision: 253858

URL: http://llvm.org/viewvc/llvm-project?rev=253858&view=rev
Log:
[tsan] Modify the tls_race.cc and tls_race2.cc tests to pass on OS X

On OS X, __thread variables are lazily heap-allocated (with malloc). Therefore, they're recognized as heap blocks (which is what they are) and not as TLS variables in TSan reports. Figuring out if a heap block is a TLS or not is difficult (in malloc interceptor we could analyze the caller and then mark the object), so let's instead modify the tests so that we expect the report to say "Location is heap block" instead of "Location is TLS".

Differential Revision: http://reviews.llvm.org/D14873


Modified:
    compiler-rt/trunk/test/tsan/tls_race.cc
    compiler-rt/trunk/test/tsan/tls_race2.cc

Modified: compiler-rt/trunk/test/tsan/tls_race.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/tls_race.cc?rev=253858&r1=253857&r2=253858&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/tls_race.cc (original)
+++ compiler-rt/trunk/test/tsan/tls_race.cc Mon Nov 23 02:17:17 2015
@@ -1,4 +1,4 @@
-// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
+// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
 #include "test.h"
 
 void *Thread(void *a) {
@@ -18,4 +18,6 @@ int main() {
 }
 
 // CHECK: WARNING: ThreadSanitizer: data race
-// CHECK:   Location is TLS of main thread.
+// CHECK-Linux:   Location is TLS of main thread.
+// CHECK-FreeBSD:   Location is TLS of main thread.
+// CHECK-Darwin:   Location is heap block of size 4

Modified: compiler-rt/trunk/test/tsan/tls_race2.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/tls_race2.cc?rev=253858&r1=253857&r2=253858&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/tls_race2.cc (original)
+++ compiler-rt/trunk/test/tsan/tls_race2.cc Mon Nov 23 02:17:17 2015
@@ -1,4 +1,4 @@
-// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
+// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
 #include "test.h"
 
 void *Thread2(void *a) {
@@ -25,5 +25,6 @@ int main() {
 }
 
 // CHECK: WARNING: ThreadSanitizer: data race
-// CHECK:   Location is TLS of thread T1.
-
+// CHECK-Linux:   Location is TLS of thread T1.
+// CHECK-FreeBSD:   Location is TLS of thread T1.
+// CHECK-Darwin:   Location is heap block of size 4




More information about the llvm-commits mailing list