Index: test/tsan/strerror_r.cc =================================================================== --- test/tsan/strerror_r.cc +++ test/tsan/strerror_r.cc @@ -2,25 +2,27 @@ // RUN: %clangxx_tsan -O1 -DTEST_ERROR=-1 %s -o %t && not %run %t 2>&1 | FileCheck --check-prefixes=CHECK,CHECK-USER %s // UNSUPPORTED: darwin -#include +#include "test.h" + #include #include -#include #include char buffer[1000]; void *Thread(void *p) { + barrier_wait(&barrier); strerror_r(TEST_ERROR, buffer, sizeof(buffer)); return buffer; } int main() { - pthread_t th[2]; - pthread_create(&th[0], 0, Thread, 0); - pthread_create(&th[1], 0, Thread, 0); - pthread_join(th[0], 0); - pthread_join(th[1], 0); + barrier_init(&barrier, 2); + pthread_t th; + pthread_create(&th, 0, Thread, 0); + strerror_r(TEST_ERROR, buffer, sizeof(buffer)); + barrier_wait(&barrier); + pthread_join(th, 0); fprintf(stderr, "DONE\n"); } Index: test/tsan/tls_race2.cc =================================================================== --- test/tsan/tls_race2.cc +++ test/tsan/tls_race2.cc @@ -22,6 +22,8 @@ pthread_t t; pthread_create(&t, 0, Thread, 0); pthread_join(t, 0); + fprintf(stderr, "DONE\n"); + return 0; } // CHECK: WARNING: ThreadSanitizer: data race @@ -29,3 +31,4 @@ // CHECK-FreeBSD: Location is TLS of thread T1. // CHECK-NetBSD: Location is TLS of thread T1. // CHECK-Darwin: Location is heap block of size 4 +// CHECK: DONE