From 17b8b0625252be3d14609b248c6701fe0d10dbb8 Mon Sep 17 00:00:00 2001 From: Renato Golin Date: Thu, 14 Apr 2016 12:10:21 +0000 Subject: [PATCH] Make tsan tests more portable (take 2) Using stderr more uniformily, avoiding potential races when scanning stdout and stderr output. Patch by Maxim Kuvyrkov. llvm-svn: 266294 --- compiler-rt/test/tsan/Linux/user_malloc.cc | 2 +- compiler-rt/test/tsan/aligned_vs_unaligned_race.cc | 2 +- compiler-rt/test/tsan/benign_race.cc | 2 +- compiler-rt/test/tsan/blacklist.cc | 2 +- compiler-rt/test/tsan/blacklist2.cc | 2 +- compiler-rt/test/tsan/dl_iterate_phdr.cc | 2 +- compiler-rt/test/tsan/fd_close_norace.cc | 2 +- compiler-rt/test/tsan/fd_close_norace2.cc | 2 +- compiler-rt/test/tsan/fd_dup_norace.cc | 2 +- compiler-rt/test/tsan/fd_dup_norace2.cc | 2 +- compiler-rt/test/tsan/fd_dup_race.cc | 2 +- compiler-rt/test/tsan/fd_pipe_norace.cc | 2 +- compiler-rt/test/tsan/fd_socket_connect_norace.cc | 2 +- compiler-rt/test/tsan/fd_socket_norace.cc | 2 +- compiler-rt/test/tsan/fd_socketpair_norace.cc | 2 +- compiler-rt/test/tsan/ignore_race.cc | 2 +- compiler-rt/test/tsan/inlined_memcpy_race.cc | 2 +- compiler-rt/test/tsan/inlined_memcpy_race2.cc | 2 +- compiler-rt/test/tsan/interface_atomic_test.c | 2 +- compiler-rt/test/tsan/java_alloc.cc | 4 ++-- compiler-rt/test/tsan/java_heap_init.cc | 2 +- compiler-rt/test/tsan/java_lock_move.cc | 2 +- compiler-rt/test/tsan/java_lock_rec.cc | 8 ++++---- compiler-rt/test/tsan/java_lock_rec_race.cc | 4 ++-- compiler-rt/test/tsan/java_move_overlap.cc | 2 +- compiler-rt/test/tsan/java_move_overlap_race.cc | 2 +- compiler-rt/test/tsan/java_rwlock.cc | 2 +- compiler-rt/test/tsan/longjmp.cc | 4 ++-- compiler-rt/test/tsan/longjmp2.cc | 4 ++-- compiler-rt/test/tsan/longjmp3.cc | 2 +- compiler-rt/test/tsan/longjmp4.cc | 2 +- compiler-rt/test/tsan/malloc_overflow.cc | 10 +++++----- compiler-rt/test/tsan/race_on_speculative_load.cc | 2 +- compiler-rt/test/tsan/static_init1.cc | 2 +- compiler-rt/test/tsan/static_init2.cc | 2 +- compiler-rt/test/tsan/static_init4.cc | 2 +- compiler-rt/test/tsan/static_init5.cc | 2 +- compiler-rt/test/tsan/static_init6.cc | 2 +- compiler-rt/test/tsan/sunrpc.cc | 2 +- compiler-rt/test/tsan/suppressions_global.cc | 2 +- compiler-rt/test/tsan/suppressions_race.cc | 2 +- compiler-rt/test/tsan/suppressions_race2.cc | 2 +- compiler-rt/test/tsan/thread_detach.c | 2 +- compiler-rt/test/tsan/thread_detach2.c | 2 +- compiler-rt/test/tsan/thread_leak.c | 2 +- compiler-rt/test/tsan/thread_leak2.c | 2 +- compiler-rt/test/tsan/thread_leak4.c | 2 +- compiler-rt/test/tsan/tsan-vs-gvn.cc | 2 +- compiler-rt/test/tsan/unaligned_norace.cc | 2 +- compiler-rt/test/tsan/vfork.cc | 4 ++-- compiler-rt/test/tsan/virtual_inheritance_compile_bug.cc | 2 +- 51 files changed, 63 insertions(+), 63 deletions(-) diff --git a/compiler-rt/test/tsan/Linux/user_malloc.cc b/compiler-rt/test/tsan/Linux/user_malloc.cc index c671bfc..9c3ce68 100644 --- a/compiler-rt/test/tsan/Linux/user_malloc.cc +++ b/compiler-rt/test/tsan/Linux/user_malloc.cc @@ -8,7 +8,7 @@ extern "C" void __interceptor_free(void *p); extern "C" void *malloc(unsigned long size) { static int first = 0; if (__sync_lock_test_and_set(&first, 1) == 0) - printf("user malloc\n"); + fprintf(stderr, "user malloc\n"); return __interceptor_malloc(size); } diff --git a/compiler-rt/test/tsan/aligned_vs_unaligned_race.cc b/compiler-rt/test/tsan/aligned_vs_unaligned_race.cc index 5c1189f..61f73ba 100644 --- a/compiler-rt/test/tsan/aligned_vs_unaligned_race.cc +++ b/compiler-rt/test/tsan/aligned_vs_unaligned_race.cc @@ -28,7 +28,7 @@ int main() { pthread_create(&t[1], NULL, Thread2, NULL); pthread_join(t[0], NULL); pthread_join(t[1], NULL); - printf("Pass\n"); + fprintf(stderr, "Pass\n"); // CHECK: ThreadSanitizer: data race // CHECK: Pass return 0; diff --git a/compiler-rt/test/tsan/benign_race.cc b/compiler-rt/test/tsan/benign_race.cc index 2f72fe1..90722aa 100644 --- a/compiler-rt/test/tsan/benign_race.cc +++ b/compiler-rt/test/tsan/benign_race.cc @@ -33,7 +33,7 @@ int main() { Global = 43; WTFGlobal = 143; pthread_join(t, 0); - printf("OK\n"); + fprintf(stderr, "OK\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/blacklist.cc b/compiler-rt/test/tsan/blacklist.cc index d6ca383..c1bcca6 100644 --- a/compiler-rt/test/tsan/blacklist.cc +++ b/compiler-rt/test/tsan/blacklist.cc @@ -23,7 +23,7 @@ int main() { pthread_create(&t[1], NULL, Blacklisted_Thread2, NULL); pthread_join(t[0], NULL); pthread_join(t[1], NULL); - printf("PASS\n"); + fprintf(stderr, "PASS\n"); return 0; } diff --git a/compiler-rt/test/tsan/blacklist2.cc b/compiler-rt/test/tsan/blacklist2.cc index 629b588..bf6c4eb 100644 --- a/compiler-rt/test/tsan/blacklist2.cc +++ b/compiler-rt/test/tsan/blacklist2.cc @@ -44,6 +44,6 @@ int main() { pthread_create(&t[1], NULL, Blacklisted_Thread2, NULL); pthread_join(t[0], NULL); pthread_join(t[1], NULL); - printf("PASS\n"); + fprintf(stderr, "PASS\n"); return 0; } diff --git a/compiler-rt/test/tsan/dl_iterate_phdr.cc b/compiler-rt/test/tsan/dl_iterate_phdr.cc index b9ce615..3c9821b 100644 --- a/compiler-rt/test/tsan/dl_iterate_phdr.cc +++ b/compiler-rt/test/tsan/dl_iterate_phdr.cc @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) { dlclose(lib); } pthread_join(th, 0); - printf("DONE\n"); + fprintf(stderr, "DONE\n"); return 0; } diff --git a/compiler-rt/test/tsan/fd_close_norace.cc b/compiler-rt/test/tsan/fd_close_norace.cc index 1b52c20..7d9d491 100644 --- a/compiler-rt/test/tsan/fd_close_norace.cc +++ b/compiler-rt/test/tsan/fd_close_norace.cc @@ -25,7 +25,7 @@ int main() { pthread_create(&t[1], NULL, Thread2, NULL); pthread_join(t[0], NULL); pthread_join(t[1], NULL); - printf("OK\n"); + fprintf(stderr, "OK\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/fd_close_norace2.cc b/compiler-rt/test/tsan/fd_close_norace2.cc index bf94fd5..382ae5f 100644 --- a/compiler-rt/test/tsan/fd_close_norace2.cc +++ b/compiler-rt/test/tsan/fd_close_norace2.cc @@ -23,7 +23,7 @@ int main() { while (write(pipes[1], &t, 1) != 1) { } pthread_join(t, 0); - printf("OK\n"); + fprintf(stderr, "OK\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/fd_dup_norace.cc b/compiler-rt/test/tsan/fd_dup_norace.cc index 5045325..e599517 100644 --- a/compiler-rt/test/tsan/fd_dup_norace.cc +++ b/compiler-rt/test/tsan/fd_dup_norace.cc @@ -28,7 +28,7 @@ int main() { pthread_create(&t[1], NULL, Thread2, NULL); pthread_join(t[0], NULL); pthread_join(t[1], NULL); - printf("OK\n"); + fprintf(stderr, "OK\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/fd_dup_norace2.cc b/compiler-rt/test/tsan/fd_dup_norace2.cc index 662c686..31aaed9d 100644 --- a/compiler-rt/test/tsan/fd_dup_norace2.cc +++ b/compiler-rt/test/tsan/fd_dup_norace2.cc @@ -53,7 +53,7 @@ int main() { exit(printf("close failed\n")); if (close(fd2) == -1) exit(printf("close failed\n")); - printf("DONE\n"); + fprintf(stderr, "DONE\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/fd_dup_race.cc b/compiler-rt/test/tsan/fd_dup_race.cc index a1aee55..d665eeb 100644 --- a/compiler-rt/test/tsan/fd_dup_race.cc +++ b/compiler-rt/test/tsan/fd_dup_race.cc @@ -27,7 +27,7 @@ int main() { exit(printf("dup2 failed\n")); barrier_wait(&barrier); pthread_join(th, 0); - printf("DONE\n"); + fprintf(stderr, "DONE\n"); } // CHECK: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/fd_pipe_norace.cc b/compiler-rt/test/tsan/fd_pipe_norace.cc index b434703..01c4490 100644 --- a/compiler-rt/test/tsan/fd_pipe_norace.cc +++ b/compiler-rt/test/tsan/fd_pipe_norace.cc @@ -27,7 +27,7 @@ int main() { pthread_create(&t[1], NULL, Thread2, NULL); pthread_join(t[0], NULL); pthread_join(t[1], NULL); - printf("OK\n"); + fprintf(stderr, "OK\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/fd_socket_connect_norace.cc b/compiler-rt/test/tsan/fd_socket_connect_norace.cc index ab2a950..b9fb434 100644 --- a/compiler-rt/test/tsan/fd_socket_connect_norace.cc +++ b/compiler-rt/test/tsan/fd_socket_connect_norace.cc @@ -38,7 +38,7 @@ int main() { pthread_join(t, 0); close(c); close(s); - printf("OK\n"); + fprintf(stderr, "OK\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/fd_socket_norace.cc b/compiler-rt/test/tsan/fd_socket_norace.cc index 0f41c43..07b0cb3 100644 --- a/compiler-rt/test/tsan/fd_socket_norace.cc +++ b/compiler-rt/test/tsan/fd_socket_norace.cc @@ -45,7 +45,7 @@ int main() { close(c); close(s); pthread_join(t, 0); - printf("OK\n"); + fprintf(stderr, "OK\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/fd_socketpair_norace.cc b/compiler-rt/test/tsan/fd_socketpair_norace.cc index a455d44..bee030d 100644 --- a/compiler-rt/test/tsan/fd_socketpair_norace.cc +++ b/compiler-rt/test/tsan/fd_socketpair_norace.cc @@ -31,7 +31,7 @@ int main() { pthread_create(&t[1], NULL, Thread2, NULL); pthread_join(t[0], NULL); pthread_join(t[1], NULL); - printf("OK\n"); + fprintf(stderr, "OK\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/ignore_race.cc b/compiler-rt/test/tsan/ignore_race.cc index cc33b66..e410006 100644 --- a/compiler-rt/test/tsan/ignore_race.cc +++ b/compiler-rt/test/tsan/ignore_race.cc @@ -25,7 +25,7 @@ int main() { barrier_wait(&barrier); Global = 43; pthread_join(t, 0); - printf("OK\n"); + fprintf(stderr, "OK\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/inlined_memcpy_race.cc b/compiler-rt/test/tsan/inlined_memcpy_race.cc index 720f2bf..4d5de88 100644 --- a/compiler-rt/test/tsan/inlined_memcpy_race.cc +++ b/compiler-rt/test/tsan/inlined_memcpy_race.cc @@ -24,7 +24,7 @@ int main() { pthread_create(&t[1], NULL, MemSetThread, x); pthread_join(t[0], NULL); pthread_join(t[1], NULL); - printf("PASS\n"); + fprintf(stderr, "PASS\n"); return 0; } diff --git a/compiler-rt/test/tsan/inlined_memcpy_race2.cc b/compiler-rt/test/tsan/inlined_memcpy_race2.cc index 2c63dc6..bf33c30 100644 --- a/compiler-rt/test/tsan/inlined_memcpy_race2.cc +++ b/compiler-rt/test/tsan/inlined_memcpy_race2.cc @@ -25,7 +25,7 @@ int main() { pthread_join(t[0], NULL); pthread_join(t[1], NULL); - printf("PASS\n"); + fprintf(stderr, "PASS\n"); return 0; } diff --git a/compiler-rt/test/tsan/interface_atomic_test.c b/compiler-rt/test/tsan/interface_atomic_test.c index 18d860e..99f6074 100644 --- a/compiler-rt/test/tsan/interface_atomic_test.c +++ b/compiler-rt/test/tsan/interface_atomic_test.c @@ -9,7 +9,7 @@ int main() { int res = __tsan_atomic32_load(&a, __tsan_memory_order_acquire); if (res == 100) { // CHECK: PASS - printf("PASS\n"); + fprintf(stderr, "PASS\n"); return 0; } return 1; diff --git a/compiler-rt/test/tsan/java_alloc.cc b/compiler-rt/test/tsan/java_alloc.cc index 4a606f7..94919a4 100644 --- a/compiler-rt/test/tsan/java_alloc.cc +++ b/compiler-rt/test/tsan/java_alloc.cc @@ -26,10 +26,10 @@ int main() { stress(jheap); pthread_join(th, 0); if (__tsan_java_fini() != 0) { - printf("FAILED\n"); + fprintf(stderr, "FAILED\n"); return 1; } - printf("DONE\n"); + fprintf(stderr, "DONE\n"); return 0; } diff --git a/compiler-rt/test/tsan/java_heap_init.cc b/compiler-rt/test/tsan/java_heap_init.cc index bb7357c..47ec5db 100644 --- a/compiler-rt/test/tsan/java_heap_init.cc +++ b/compiler-rt/test/tsan/java_heap_init.cc @@ -20,7 +20,7 @@ int main() { return printf("second mmap failed with %d\n", errno); __tsan_java_init(jheap, kHeapSize); __tsan_java_move(jheap + 16, jheap, 16); - printf("DONE\n"); + fprintf(stderr, "DONE\n"); return __tsan_java_fini(); } diff --git a/compiler-rt/test/tsan/java_lock_move.cc b/compiler-rt/test/tsan/java_lock_move.cc index fe5491d..66599f8 100644 --- a/compiler-rt/test/tsan/java_lock_move.cc +++ b/compiler-rt/test/tsan/java_lock_move.cc @@ -35,7 +35,7 @@ int main() { barrier_wait(&barrier); pthread_join(th, 0); __tsan_java_free(varaddr2, kBlockSize); - printf("DONE\n"); + fprintf(stderr, "DONE\n"); return __tsan_java_fini(); } diff --git a/compiler-rt/test/tsan/java_lock_rec.cc b/compiler-rt/test/tsan/java_lock_rec.cc index f0bf401..aa8de97 100644 --- a/compiler-rt/test/tsan/java_lock_rec.cc +++ b/compiler-rt/test/tsan/java_lock_rec.cc @@ -10,14 +10,14 @@ void *Thread(void *p) { *(int*)varaddr = 42; int rec = __tsan_java_mutex_unlock_rec(lockaddr); if (rec != 2) { - printf("FAILED 0 rec=%d\n", rec); + fprintf(stderr, "FAILED 0 rec=%d\n", rec); exit(1); } barrier_wait(&barrier); barrier_wait(&barrier); __tsan_java_mutex_lock_rec(lockaddr, rec); if (*(int*)varaddr != 43) { - printf("FAILED 3 var=%d\n", *(int*)varaddr); + fprintf(stderr, "FAILED 3 var=%d\n", *(int*)varaddr); exit(1); } __tsan_java_mutex_unlock(lockaddr); @@ -40,7 +40,7 @@ int main() { barrier_wait(&barrier); __tsan_java_mutex_lock(lockaddr); if (*(int*)varaddr != 42) { - printf("FAILED 1 var=%d\n", *(int*)varaddr); + fprintf(stderr, "FAILED 1 var=%d\n", *(int*)varaddr); exit(1); } *(int*)varaddr = 43; @@ -48,7 +48,7 @@ int main() { barrier_wait(&barrier); pthread_join(th, 0); __tsan_java_free(jheap, kBlockSize); - printf("DONE\n"); + fprintf(stderr, "DONE\n"); return __tsan_java_fini(); } diff --git a/compiler-rt/test/tsan/java_lock_rec_race.cc b/compiler-rt/test/tsan/java_lock_rec_race.cc index 3da8ad0..b6c7ccb 100644 --- a/compiler-rt/test/tsan/java_lock_rec_race.cc +++ b/compiler-rt/test/tsan/java_lock_rec_race.cc @@ -10,7 +10,7 @@ void *Thread(void *p) { __tsan_java_mutex_lock(lockaddr); int rec = __tsan_java_mutex_unlock_rec(lockaddr); if (rec != 3) { - printf("FAILED 0 rec=%d\n", rec); + fprintf(stderr, "FAILED 0 rec=%d\n", rec); exit(1); } *(int*)varaddr = 42; @@ -42,7 +42,7 @@ int main() { barrier_wait(&barrier); pthread_join(th, 0); __tsan_java_free(jheap, kBlockSize); - printf("DONE\n"); + fprintf(stderr, "DONE\n"); return __tsan_java_fini(); } diff --git a/compiler-rt/test/tsan/java_move_overlap.cc b/compiler-rt/test/tsan/java_move_overlap.cc index 7ed98ef..bf8d1e1 100644 --- a/compiler-rt/test/tsan/java_move_overlap.cc +++ b/compiler-rt/test/tsan/java_move_overlap.cc @@ -66,7 +66,7 @@ int main(int argc, char **argv) { barrier_wait(&barrier); pthread_join(th, 0); __tsan_java_free(varaddr1_new, kBlockSize); - printf("DONE\n"); + fprintf(stderr, "DONE\n"); return __tsan_java_fini(); } diff --git a/compiler-rt/test/tsan/java_move_overlap_race.cc b/compiler-rt/test/tsan/java_move_overlap_race.cc index 874b90b..2887fd3 100644 --- a/compiler-rt/test/tsan/java_move_overlap_race.cc +++ b/compiler-rt/test/tsan/java_move_overlap_race.cc @@ -46,7 +46,7 @@ int main(int argc, char **argv) { barrier_wait(&barrier); pthread_join(th, 0); __tsan_java_free(varaddr1_new, kBlockSize); - printf("DONE\n"); + fprintf(stderr, "DONE\n"); return __tsan_java_fini(); } diff --git a/compiler-rt/test/tsan/java_rwlock.cc b/compiler-rt/test/tsan/java_rwlock.cc index a4cc92a..aa77273 100644 --- a/compiler-rt/test/tsan/java_rwlock.cc +++ b/compiler-rt/test/tsan/java_rwlock.cc @@ -29,7 +29,7 @@ int main() { barrier_wait(&barrier); pthread_join(th, 0); __tsan_java_free(jheap, kBlockSize); - printf("DONE\n"); + fprintf(stderr, "DONE\n"); return __tsan_java_fini(); } diff --git a/compiler-rt/test/tsan/longjmp.cc b/compiler-rt/test/tsan/longjmp.cc index d642067..61d285c 100644 --- a/compiler-rt/test/tsan/longjmp.cc +++ b/compiler-rt/test/tsan/longjmp.cc @@ -14,11 +14,11 @@ int foo(jmp_buf env) { int main() { jmp_buf env; if (setjmp(env) == 42) { - printf("JUMPED\n"); + fprintf(stderr, "JUMPED\n"); return 0; } foo(env); - printf("FAILED\n"); + fprintf(stderr, "FAILED\n"); return 0; } diff --git a/compiler-rt/test/tsan/longjmp2.cc b/compiler-rt/test/tsan/longjmp2.cc index eee423d..2b2775a 100644 --- a/compiler-rt/test/tsan/longjmp2.cc +++ b/compiler-rt/test/tsan/longjmp2.cc @@ -16,11 +16,11 @@ int main() { sigjmp_buf env; printf("env=%p\n", env); if (sigsetjmp(env, 1) == 42) { - printf("JUMPED\n"); + fprintf(stderr, "JUMPED\n"); return 0; } foo(env); - printf("FAILED\n"); + fprintf(stderr, "FAILED\n"); return 0; } diff --git a/compiler-rt/test/tsan/longjmp3.cc b/compiler-rt/test/tsan/longjmp3.cc index 79965c4..f4f9c2b 100644 --- a/compiler-rt/test/tsan/longjmp3.cc +++ b/compiler-rt/test/tsan/longjmp3.cc @@ -34,7 +34,7 @@ void mymain() { return; } foo(env); - printf("FAILED\n"); + fprintf(stderr, "FAILED\n"); } int main() { diff --git a/compiler-rt/test/tsan/longjmp4.cc b/compiler-rt/test/tsan/longjmp4.cc index c858399..2b15435 100644 --- a/compiler-rt/test/tsan/longjmp4.cc +++ b/compiler-rt/test/tsan/longjmp4.cc @@ -37,7 +37,7 @@ void mymain() { return; } foo(env); - printf("FAILED\n"); + fprintf(stderr, "FAILED\n"); } int main() { diff --git a/compiler-rt/test/tsan/malloc_overflow.cc b/compiler-rt/test/tsan/malloc_overflow.cc index b2f9b0f..3db4129 100644 --- a/compiler-rt/test/tsan/malloc_overflow.cc +++ b/compiler-rt/test/tsan/malloc_overflow.cc @@ -6,17 +6,17 @@ int main() { void *p = malloc((size_t)-1); if (p != 0) - printf("FAIL malloc(-1) = %p\n", p); + fprintf(stderr, "FAIL malloc(-1) = %p\n", p); p = malloc((size_t)-1 / 2); if (p != 0) - printf("FAIL malloc(-1/2) = %p\n", p); + fprintf(stderr, "FAIL malloc(-1/2) = %p\n", p); p = calloc((size_t)-1, (size_t)-1); if (p != 0) - printf("FAIL calloc(-1, -1) = %p\n", p); + fprintf(stderr, "FAIL calloc(-1, -1) = %p\n", p); p = calloc((size_t)-1 / 2, (size_t)-1 / 2); if (p != 0) - printf("FAIL calloc(-1/2, -1/2) = %p\n", p); - printf("OK\n"); + fprintf(stderr, "FAIL calloc(-1/2, -1/2) = %p\n", p); + fprintf(stderr, "OK\n"); } // CHECK-NOT: FAIL diff --git a/compiler-rt/test/tsan/race_on_speculative_load.cc b/compiler-rt/test/tsan/race_on_speculative_load.cc index dd40dae..89b1621 100644 --- a/compiler-rt/test/tsan/race_on_speculative_load.cc +++ b/compiler-rt/test/tsan/race_on_speculative_load.cc @@ -24,7 +24,7 @@ int main() { g = 1; barrier_wait(&barrier); pthread_join(t, 0); - printf("PASS\n"); + fprintf(stderr, "PASS\n"); // CHECK-NOT: ThreadSanitizer: data race // CHECK: PASS } diff --git a/compiler-rt/test/tsan/static_init1.cc b/compiler-rt/test/tsan/static_init1.cc index 3e5fb14..3e6e4f9 100644 --- a/compiler-rt/test/tsan/static_init1.cc +++ b/compiler-rt/test/tsan/static_init1.cc @@ -21,7 +21,7 @@ int main() { pthread_create(&t[1], 0, Thread, 0); pthread_join(t[0], 0); pthread_join(t[1], 0); - printf("PASS\n"); + fprintf(stderr, "PASS\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/static_init2.cc b/compiler-rt/test/tsan/static_init2.cc index 667aed1..ca2300a 100644 --- a/compiler-rt/test/tsan/static_init2.cc +++ b/compiler-rt/test/tsan/static_init2.cc @@ -27,7 +27,7 @@ int main() { pthread_create(&t[1], 0, Thread, 0); pthread_join(t[0], 0); pthread_join(t[1], 0); - printf("PASS\n"); + fprintf(stderr, "PASS\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/static_init4.cc b/compiler-rt/test/tsan/static_init4.cc index 85835a25..c8da783 100644 --- a/compiler-rt/test/tsan/static_init4.cc +++ b/compiler-rt/test/tsan/static_init4.cc @@ -31,7 +31,7 @@ int main() { pthread_create(&t[1], 0, Thread1, 0); pthread_join(t[0], 0); pthread_join(t[1], 0); - printf("PASS\n"); + fprintf(stderr, "PASS\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/static_init5.cc b/compiler-rt/test/tsan/static_init5.cc index 961e3a3..b334981 100644 --- a/compiler-rt/test/tsan/static_init5.cc +++ b/compiler-rt/test/tsan/static_init5.cc @@ -36,7 +36,7 @@ int main() { pthread_create(&t[1], 0, Thread1, 0); pthread_join(t[0], 0); pthread_join(t[1], 0); - printf("PASS\n"); + fprintf(stderr, "PASS\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/static_init6.cc b/compiler-rt/test/tsan/static_init6.cc index 0bfefe3..fd22e0a 100644 --- a/compiler-rt/test/tsan/static_init6.cc +++ b/compiler-rt/test/tsan/static_init6.cc @@ -36,7 +36,7 @@ int main() { pthread_create(&t[1], 0, Thread1, 0); pthread_join(t[0], 0); pthread_join(t[1], 0); - printf("PASS\n"); + fprintf(stderr, "PASS\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/sunrpc.cc b/compiler-rt/test/tsan/sunrpc.cc index 579816d..5cfb534 100644 --- a/compiler-rt/test/tsan/sunrpc.cc +++ b/compiler-rt/test/tsan/sunrpc.cc @@ -19,7 +19,7 @@ int main(int argc, char *argv[]) { pthread_create(&th[1], 0, thr, 0); pthread_join(th[0], 0); pthread_join(th[1], 0); - printf("DONE\n"); + fprintf(stderr, "DONE\n"); // CHECK: DONE return 0; } diff --git a/compiler-rt/test/tsan/suppressions_global.cc b/compiler-rt/test/tsan/suppressions_global.cc index 8928162..282d261 100644 --- a/compiler-rt/test/tsan/suppressions_global.cc +++ b/compiler-rt/test/tsan/suppressions_global.cc @@ -20,7 +20,7 @@ int main() { pthread_create(&t[1], NULL, Thread2, NULL); pthread_join(t[0], NULL); pthread_join(t[1], NULL); - printf("OK\n"); + fprintf(stderr, "OK\n"); return 0; } diff --git a/compiler-rt/test/tsan/suppressions_race.cc b/compiler-rt/test/tsan/suppressions_race.cc index 7a88434..d0aeeda 100644 --- a/compiler-rt/test/tsan/suppressions_race.cc +++ b/compiler-rt/test/tsan/suppressions_race.cc @@ -22,7 +22,7 @@ int main() { pthread_create(&t[1], NULL, Thread2, NULL); pthread_join(t[0], NULL); pthread_join(t[1], NULL); - printf("OK\n"); + fprintf(stderr, "OK\n"); return 0; } diff --git a/compiler-rt/test/tsan/suppressions_race2.cc b/compiler-rt/test/tsan/suppressions_race2.cc index b6566a8..6f8ca73 100644 --- a/compiler-rt/test/tsan/suppressions_race2.cc +++ b/compiler-rt/test/tsan/suppressions_race2.cc @@ -22,7 +22,7 @@ int main() { pthread_create(&t[1], NULL, Thread2, NULL); pthread_join(t[0], NULL); pthread_join(t[1], NULL); - printf("OK\n"); + fprintf(stderr, "OK\n"); return 0; } diff --git a/compiler-rt/test/tsan/thread_detach.c b/compiler-rt/test/tsan/thread_detach.c index 802d8de..2a95742 100644 --- a/compiler-rt/test/tsan/thread_detach.c +++ b/compiler-rt/test/tsan/thread_detach.c @@ -12,7 +12,7 @@ int main() { pthread_create(&t, 0, Thread, 0); barrier_wait(&barrier); pthread_detach(t); - printf("PASS\n"); + fprintf(stderr, "PASS\n"); return 0; } diff --git a/compiler-rt/test/tsan/thread_detach2.c b/compiler-rt/test/tsan/thread_detach2.c index 8133980..5ee94e9 100644 --- a/compiler-rt/test/tsan/thread_detach2.c +++ b/compiler-rt/test/tsan/thread_detach2.c @@ -20,7 +20,7 @@ int main() { pthread_create(&t, 0, Thread, 0); pthread_detach(t); barrier_wait(&barrier); - printf("PASS\n"); + fprintf(stderr, "PASS\n"); return 0; } diff --git a/compiler-rt/test/tsan/thread_leak.c b/compiler-rt/test/tsan/thread_leak.c index 9b850dd..9b42b16 100644 --- a/compiler-rt/test/tsan/thread_leak.c +++ b/compiler-rt/test/tsan/thread_leak.c @@ -10,7 +10,7 @@ int main() { pthread_t t; pthread_create(&t, 0, Thread, 0); pthread_join(t, 0); - printf("PASS\n"); + fprintf(stderr, "PASS\n"); return 0; } diff --git a/compiler-rt/test/tsan/thread_leak2.c b/compiler-rt/test/tsan/thread_leak2.c index fc2942b..c3cac7a 100644 --- a/compiler-rt/test/tsan/thread_leak2.c +++ b/compiler-rt/test/tsan/thread_leak2.c @@ -10,7 +10,7 @@ int main() { pthread_t t; pthread_create(&t, 0, Thread, 0); pthread_detach(t); - printf("PASS\n"); + fprintf(stderr, "PASS\n"); return 0; } diff --git a/compiler-rt/test/tsan/thread_leak4.c b/compiler-rt/test/tsan/thread_leak4.c index 1ebca58..1d0636f 100644 --- a/compiler-rt/test/tsan/thread_leak4.c +++ b/compiler-rt/test/tsan/thread_leak4.c @@ -9,7 +9,7 @@ void *Thread(void *x) { int main() { pthread_t t; pthread_create(&t, 0, Thread, 0); - printf("DONE\n"); + fprintf(stderr, "DONE\n"); return 0; } diff --git a/compiler-rt/test/tsan/tsan-vs-gvn.cc b/compiler-rt/test/tsan/tsan-vs-gvn.cc index 950f5d3..efd81ef 100644 --- a/compiler-rt/test/tsan/tsan-vs-gvn.cc +++ b/compiler-rt/test/tsan/tsan-vs-gvn.cc @@ -31,7 +31,7 @@ int main() { pthread_create(&t[1], NULL, Thread2, NULL); pthread_join(t[0], NULL); pthread_join(t[1], NULL); - printf("PASS\n"); + fprintf(stderr, "PASS\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/unaligned_norace.cc b/compiler-rt/test/tsan/unaligned_norace.cc index 94df1cf..7e360cf 100644 --- a/compiler-rt/test/tsan/unaligned_norace.cc +++ b/compiler-rt/test/tsan/unaligned_norace.cc @@ -77,7 +77,7 @@ int main() { pthread_create(&th, 0, Thread, 0); Test(true); pthread_join(th, 0); - printf("OK\n"); + fprintf(stderr, "OK\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: diff --git a/compiler-rt/test/tsan/vfork.cc b/compiler-rt/test/tsan/vfork.cc index 5ae1dd1..2d669b3 100644 --- a/compiler-rt/test/tsan/vfork.cc +++ b/compiler-rt/test/tsan/vfork.cc @@ -26,7 +26,7 @@ int main() { pipe(fds); int pid = vfork(); if (pid < 0) { - printf("FAIL to vfork\n"); + fprintf(stderr, "FAIL to vfork\n"); exit(1); } if (pid == 0) { // child @@ -43,7 +43,7 @@ int main() { pthread_create(&t[1], NULL, Thread2, NULL); pthread_join(t[0], NULL); pthread_join(t[1], NULL); - printf("DONE\n"); + fprintf(stderr, "DONE\n"); } // CHECK-NOT: WARNING: ThreadSanitizer: data race diff --git a/compiler-rt/test/tsan/virtual_inheritance_compile_bug.cc b/compiler-rt/test/tsan/virtual_inheritance_compile_bug.cc index 7da581d..3b1e08b 100644 --- a/compiler-rt/test/tsan/virtual_inheritance_compile_bug.cc +++ b/compiler-rt/test/tsan/virtual_inheritance_compile_bug.cc @@ -10,6 +10,6 @@ struct DDD: CCC, BBB { DDD(); }; // NOLINT DDD::DDD() { } int main() { DDD d; - printf("OK\n"); + fprintf(stderr, "OK\n"); } // CHECK: OK -- 2.7.4