summaryrefslogtreecommitdiff
path: root/test/tsan
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2015-11-23 08:17:17 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2015-11-23 08:17:17 +0000
commitb162e1fb8425771d493f5fc71eb62759e51780c8 (patch)
treeac4320c8c8730f2d2b57bfeea9acb897499f01e5 /test/tsan
parent5c9c986761b8096f60e653759e076d155f5d9c0a (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@253858 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/tsan')
-rw-r--r--test/tsan/tls_race.cc6
-rw-r--r--test/tsan/tls_race2.cc7
2 files changed, 8 insertions, 5 deletions
diff --git a/test/tsan/tls_race.cc b/test/tsan/tls_race.cc
index 5e8172276..b43a514cc 100644
--- a/test/tsan/tls_race.cc
+++ b/test/tsan/tls_race.cc
@@ -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
diff --git a/test/tsan/tls_race2.cc b/test/tsan/tls_race2.cc
index d0f7b03e0..b04ff6788 100644
--- a/test/tsan/tls_race2.cc
+++ b/test/tsan/tls_race2.cc
@@ -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