Index: test/lsan/TestCases/cleanup_in_tsd_destructor.c =================================================================== --- test/lsan/TestCases/cleanup_in_tsd_destructor.c +++ test/lsan/TestCases/cleanup_in_tsd_destructor.c @@ -14,6 +14,7 @@ #include #include "sanitizer/lsan_interface.h" +#include "../../tsan/test.h" pthread_key_t key; __thread void *p; @@ -25,7 +26,7 @@ void *thread_func(void *arg) { p = malloc(1337); - fprintf(stderr, "Test alloc: %p.\n", p); + print_address("Test alloc: ", 1, p); int res = pthread_setspecific(key, (void*)1); assert(res == 0); return 0; @@ -41,5 +42,5 @@ assert(res == 0); return 0; } -// CHECK: Test alloc: [[ADDR:.*]]. +// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] // CHECK: [[ADDR]] (1337 bytes) Index: test/lsan/TestCases/large_allocation_leak.cc =================================================================== --- test/lsan/TestCases/large_allocation_leak.cc +++ test/lsan/TestCases/large_allocation_leak.cc @@ -5,14 +5,15 @@ #include #include +#include "../../tsan/test.h" int main() { // maxsize in primary allocator is always less than this (1 << 25). void *large_alloc = malloc(33554432); - fprintf(stderr, "Test alloc: %p.\n", large_alloc); + print_address("Test alloc: ", 1, large_alloc); return 0; } -// CHECK: Test alloc: [[ADDR:.*]]. +// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] // CHECK: LeakSanitizer: detected memory leaks // CHECK: [[ADDR]] (33554432 bytes) // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: Index: test/lsan/TestCases/pointer_to_self.cc =================================================================== --- test/lsan/TestCases/pointer_to_self.cc +++ test/lsan/TestCases/pointer_to_self.cc @@ -6,13 +6,14 @@ #include #include +#include "../../tsan/test.h" int main() { void *p = malloc(1337); *reinterpret_cast(p) = p; - fprintf(stderr, "Test alloc: %p.\n", p); + print_address("Test alloc: ", 1, p); } -// CHECK: Test alloc: [[ADDR:.*]]. +// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] // CHECK: LeakSanitizer: detected memory leaks // CHECK: [[ADDR]] (1337 bytes) // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: Index: test/lsan/TestCases/stale_stack_leak.cc =================================================================== --- test/lsan/TestCases/stale_stack_leak.cc +++ test/lsan/TestCases/stale_stack_leak.cc @@ -6,6 +6,7 @@ #include #include +#include "../../tsan/test.h" void **pp; @@ -18,7 +19,7 @@ void *locals[2048]; locals[0] = p; pp = &locals[0]; - fprintf(stderr, "Test alloc: %p.\n", locals[0]); + print_address("Test alloc: ", 1, locals[0]); return 0; } @@ -33,11 +34,11 @@ __attribute__((destructor)) __attribute__((no_sanitize_address)) void ConfirmPointerHasSurvived() { - fprintf(stderr, "Value after LSan: %p.\n", *pp); + print_address("Value after LSan: ", 1, *pp); } -// CHECK: Test alloc: [[ADDR:.*]]. -// CHECK-sanity: Test alloc: [[ADDR:.*]]. +// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] +// CHECK-sanity: Test alloc: [[ADDR:0x[0-9,a-f]+]] // CHECK: LeakSanitizer: detected memory leaks // CHECK: [[ADDR]] (1337 bytes) // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: -// CHECK-sanity: Value after LSan: [[ADDR]]. +// CHECK-sanity: Value after LSan: [[ADDR]] Index: test/lsan/TestCases/use_after_return.cc =================================================================== --- test/lsan/TestCases/use_after_return.cc +++ test/lsan/TestCases/use_after_return.cc @@ -8,16 +8,17 @@ #include #include +#include "../../tsan/test.h" int main() { void *stack_var = malloc(1337); - fprintf(stderr, "Test alloc: %p.\n", stack_var); + print_address("Test alloc: ", 1, stack_var); // Take pointer to variable, to ensure it's not optimized into a register. - fprintf(stderr, "Stack var at: %p.\n", &stack_var); + print_address("Stack var at: ", 1, &stack_var); // Do not return from main to prevent the pointer from going out of scope. exit(0); } -// CHECK: Test alloc: [[ADDR:.*]]. +// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] // CHECK: LeakSanitizer: detected memory leaks // CHECK: [[ADDR]] (1337 bytes) // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: Index: test/lsan/TestCases/use_globals_initialized.cc =================================================================== --- test/lsan/TestCases/use_globals_initialized.cc +++ test/lsan/TestCases/use_globals_initialized.cc @@ -7,15 +7,16 @@ #include #include +#include "../../tsan/test.h" void *data_var = (void *)1; int main() { data_var = malloc(1337); - fprintf(stderr, "Test alloc: %p.\n", data_var); + print_address("Test alloc: ", 1, data_var); return 0; } -// CHECK: Test alloc: [[ADDR:.*]]. +// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] // CHECK: LeakSanitizer: detected memory leaks // CHECK: [[ADDR]] (1337 bytes) // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: Index: test/lsan/TestCases/use_globals_uninitialized.cc =================================================================== --- test/lsan/TestCases/use_globals_uninitialized.cc +++ test/lsan/TestCases/use_globals_uninitialized.cc @@ -7,15 +7,16 @@ #include #include +#include "../../tsan/test.h" void *bss_var; int main() { bss_var = malloc(1337); - fprintf(stderr, "Test alloc: %p.\n", bss_var); + print_address("Test alloc: ", 1, bss_var); return 0; } -// CHECK: Test alloc: [[ADDR:.*]]. +// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] // CHECK: LeakSanitizer: detected memory leaks // CHECK: [[ADDR]] (1337 bytes) // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: Index: test/lsan/TestCases/use_poisoned_asan.cc =================================================================== --- test/lsan/TestCases/use_poisoned_asan.cc +++ test/lsan/TestCases/use_poisoned_asan.cc @@ -9,17 +9,18 @@ #include #include #include +#include "../../tsan/test.h" void **p; int main() { p = new void *; *p = malloc(1337); - fprintf(stderr, "Test alloc: %p.\n", *p); + print_address("Test alloc: ", 1, *p); __asan_poison_memory_region(p, sizeof(*p)); return 0; } -// CHECK: Test alloc: [[ADDR:.*]]. +// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] // CHECK: LeakSanitizer: detected memory leaks // CHECK: [[ADDR]] (1337 bytes) // CHECK: SUMMARY: AddressSanitizer: Index: test/lsan/TestCases/use_registers.cc =================================================================== --- test/lsan/TestCases/use_registers.cc +++ test/lsan/TestCases/use_registers.cc @@ -10,6 +10,7 @@ #include #include #include +#include "../../tsan/test.h" extern "C" void *registers_thread_func(void *arg) { @@ -35,7 +36,7 @@ #else #error "Test is not supported on this architecture." #endif - fprintf(stderr, "Test alloc: %p.\n", p); + print_address("Test alloc: ", 1, p); fflush(stderr); __sync_fetch_and_xor(sync, 1); while (true) @@ -51,7 +52,7 @@ sched_yield(); return 0; } -// CHECK: Test alloc: [[ADDR:.*]]. +// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] // CHECK: LeakSanitizer: detected memory leaks // CHECK: [[ADDR]] (1337 bytes) // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: Index: test/lsan/TestCases/use_stacks.cc =================================================================== --- test/lsan/TestCases/use_stacks.cc +++ test/lsan/TestCases/use_stacks.cc @@ -7,14 +7,15 @@ #include #include +#include "../../tsan/test.h" int main() { void *stack_var = malloc(1337); - fprintf(stderr, "Test alloc: %p.\n", stack_var); + print_address("Test alloc: ", 1, stack_var); // Do not return from main to prevent the pointer from going out of scope. exit(0); } -// CHECK: Test alloc: [[ADDR:.*]]. +// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] // CHECK: LeakSanitizer: detected memory leaks // CHECK: [[ADDR]] (1337 bytes) // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: Index: test/lsan/TestCases/use_stacks_threaded.cc =================================================================== --- test/lsan/TestCases/use_stacks_threaded.cc +++ test/lsan/TestCases/use_stacks_threaded.cc @@ -10,12 +10,13 @@ #include #include #include +#include "../../tsan/test.h" extern "C" void *stacks_thread_func(void *arg) { int *sync = reinterpret_cast(arg); void *p = malloc(1337); - fprintf(stderr, "Test alloc: %p.\n", p); + print_address("Test alloc: ", 1, p); fflush(stderr); __sync_fetch_and_xor(sync, 1); while (true) @@ -31,7 +32,7 @@ sched_yield(); return 0; } -// CHECK: Test alloc: [[ADDR:.*]]. +// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] // CHECK: LeakSanitizer: detected memory leaks // CHECK: [[ADDR]] (1337 bytes) // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: Index: test/lsan/TestCases/use_tls_dynamic.cc =================================================================== --- test/lsan/TestCases/use_tls_dynamic.cc +++ test/lsan/TestCases/use_tls_dynamic.cc @@ -12,6 +12,7 @@ #include #include #include +#include "../../tsan/test.h" int main(int argc, char *argv[]) { std::string path = std::string(argv[0]) + "-so.so"; @@ -26,10 +27,10 @@ // If we don't know about dynamic TLS, we will return a false leak above. void **p_in_tls = StoreToTLS(p); assert(*p_in_tls == p); - fprintf(stderr, "Test alloc: %p.\n", p); + print_address("Test alloc: ", 1, p); return 0; } -// CHECK: Test alloc: [[ADDR:.*]]. +// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] // CHECK: LeakSanitizer: detected memory leaks // CHECK: [[ADDR]] (1337 bytes) // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: Index: test/lsan/TestCases/use_tls_pthread_specific_dynamic.cc =================================================================== --- test/lsan/TestCases/use_tls_pthread_specific_dynamic.cc +++ test/lsan/TestCases/use_tls_pthread_specific_dynamic.cc @@ -9,6 +9,7 @@ #include #include #include +#include "../../tsan/test.h" // From glibc: this many keys are stored in the thread descriptor directly. const unsigned PTHREAD_KEY_2NDLEVEL_SIZE = 32; @@ -28,10 +29,10 @@ void *p = malloc(1337); res = pthread_setspecific(key, p); assert(res == 0); - fprintf(stderr, "Test alloc: %p.\n", p); + print_address("Test alloc: ", 1, p); return 0; } -// CHECK: Test alloc: [[ADDR:.*]]. +// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] // CHECK: LeakSanitizer: detected memory leaks // CHECK: [[ADDR]] (1337 bytes) // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: Index: test/lsan/TestCases/use_tls_pthread_specific_static.cc =================================================================== --- test/lsan/TestCases/use_tls_pthread_specific_static.cc +++ test/lsan/TestCases/use_tls_pthread_specific_static.cc @@ -9,6 +9,7 @@ #include #include #include +#include "../../tsan/test.h" // From glibc: this many keys are stored in the thread descriptor directly. const unsigned PTHREAD_KEY_2NDLEVEL_SIZE = 32; @@ -22,10 +23,10 @@ void *p = malloc(1337); res = pthread_setspecific(key, p); assert(res == 0); - fprintf(stderr, "Test alloc: %p.\n", p); + print_address("Test alloc: ", 1, p); return 0; } -// CHECK: Test alloc: [[ADDR:.*]]. +// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] // CHECK: LeakSanitizer: detected memory leaks // CHECK: [[ADDR]] (1337 bytes) // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: Index: test/lsan/TestCases/use_tls_static.cc =================================================================== --- test/lsan/TestCases/use_tls_static.cc +++ test/lsan/TestCases/use_tls_static.cc @@ -7,15 +7,16 @@ #include #include +#include "../../tsan/test.h" __thread void *tls_var; int main() { tls_var = malloc(1337); - fprintf(stderr, "Test alloc: %p.\n", tls_var); + print_address("Test alloc: ", 1, tls_var); return 0; } -// CHECK: Test alloc: [[ADDR:.*]]. +// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] // CHECK: LeakSanitizer: detected memory leaks // CHECK: [[ADDR]] (1337 bytes) // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: Index: test/lsan/TestCases/use_unaligned.cc =================================================================== --- test/lsan/TestCases/use_unaligned.cc +++ test/lsan/TestCases/use_unaligned.cc @@ -7,17 +7,18 @@ #include #include #include +#include "../../tsan/test.h" void *arr[2]; int main() { void *p = malloc(1337); - fprintf(stderr, "Test alloc: %p.\n", p); + print_address("Test alloc: ", 1, p); char *char_arr = (char *)arr; memcpy(char_arr + 1, &p, sizeof(p)); return 0; } -// CHECK: Test alloc: [[ADDR:.*]]. +// CHECK: Test alloc: [[ADDR:0x[0-9,a-f]+]] // CHECK: LeakSanitizer: detected memory leaks // CHECK: [[ADDR]] (1337 bytes) // CHECK: SUMMARY: {{(Leak|Address)}}Sanitizer: