From 8b815e1a087ffb6bc5bcf2c185838c1c243f610a Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Tue, 6 Dec 2011 19:10:48 +0000 Subject: [PATCH] [asan] GCD tests on Mac: prevent optimization and enable. Patch by glider@google.com llvm-svn: 145953 --- compiler-rt/lib/asan/tests/asan_mac_test.mm | 10 +++++----- compiler-rt/lib/asan/tests/asan_test.cc | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/compiler-rt/lib/asan/tests/asan_mac_test.mm b/compiler-rt/lib/asan/tests/asan_mac_test.mm index 0ad54846662f..b5dbbde4f315 100644 --- a/compiler-rt/lib/asan/tests/asan_mac_test.mm +++ b/compiler-rt/lib/asan/tests/asan_mac_test.mm @@ -59,13 +59,13 @@ char kStartupStr[] = @end void worker_do_alloc(int size) { - char *mem = malloc(size); + char * volatile mem = malloc(size); mem[0] = 0; // Ok free(mem); } void worker_do_crash(int size) { - char *mem = malloc(size); + char * volatile mem = malloc(size); mem[size] = 0; // BOOM free(mem); } @@ -160,7 +160,7 @@ void TestGCDSourceEvent() { dispatch_time(DISPATCH_TIME_NOW, 1LL * NSEC_PER_SEC); dispatch_source_set_timer(timer, milestone, DISPATCH_TIME_FOREVER, 0); - char *mem = malloc(10); + char * volatile mem = malloc(10); dispatch_source_set_event_handler(timer, ^{ mem[10] = 1; }); @@ -177,7 +177,7 @@ void TestGCDSourceCancel() { dispatch_time(DISPATCH_TIME_NOW, 1LL * NSEC_PER_SEC); dispatch_source_set_timer(timer, milestone, DISPATCH_TIME_FOREVER, 0); - char *mem = malloc(10); + char * volatile mem = malloc(10); // Both dispatch_source_set_cancel_handler() and // dispatch_source_set_event_handler() use dispatch_barrier_async_f(). // It's tricky to test dispatch_source_set_cancel_handler() separately, @@ -195,7 +195,7 @@ void TestGCDSourceCancel() { void TestGCDGroupAsync() { dispatch_queue_t queue = dispatch_get_global_queue(0, 0); dispatch_group_t group = dispatch_group_create(); - char *mem = malloc(10); + char * volatile mem = malloc(10); dispatch_group_async(group, queue, ^{ mem[10] = 1; }); diff --git a/compiler-rt/lib/asan/tests/asan_test.cc b/compiler-rt/lib/asan/tests/asan_test.cc index 5d0ff7ccac93..8d2292200ae9 100644 --- a/compiler-rt/lib/asan/tests/asan_test.cc +++ b/compiler-rt/lib/asan/tests/asan_test.cc @@ -1771,50 +1771,50 @@ TEST(AddressSanitizerMac, DISABLED_CFAllocatorMallocZoneDoubleFree) { EXPECT_DEATH(CFAllocatorMallocZoneDoubleFree(), "attempting double-free"); } -TEST(AddressSanitizerMac, DISABLED_GCDDispatchAsync) { +TEST(AddressSanitizerMac, GCDDispatchAsync) { // Make sure the whole ASan report is printed, i.e. that we don't die // on a CHECK. EXPECT_DEATH(TestGCDDispatchAsync(), "Shadow byte and word"); } -TEST(AddressSanitizerMac, DISABLED_GCDDispatchSync) { +TEST(AddressSanitizerMac, GCDDispatchSync) { // Make sure the whole ASan report is printed, i.e. that we don't die // on a CHECK. EXPECT_DEATH(TestGCDDispatchSync(), "Shadow byte and word"); } -TEST(AddressSanitizerMac, DISABLED_GCDReuseWqthreadsAsync) { +TEST(AddressSanitizerMac, GCDReuseWqthreadsAsync) { // Make sure the whole ASan report is printed, i.e. that we don't die // on a CHECK. EXPECT_DEATH(TestGCDReuseWqthreadsAsync(), "Shadow byte and word"); } -TEST(AddressSanitizerMac, DISABLED_GCDReuseWqthreadsSync) { +TEST(AddressSanitizerMac, GCDReuseWqthreadsSync) { // Make sure the whole ASan report is printed, i.e. that we don't die // on a CHECK. EXPECT_DEATH(TestGCDReuseWqthreadsSync(), "Shadow byte and word"); } -TEST(AddressSanitizerMac, DISABLED_GCDDispatchAfter) { +TEST(AddressSanitizerMac, GCDDispatchAfter) { // Make sure the whole ASan report is printed, i.e. that we don't die // on a CHECK. EXPECT_DEATH(TestGCDDispatchAfter(), "Shadow byte and word"); } -TEST(AddressSanitizerMac, DISABLED_GCDSourceEvent) { +TEST(AddressSanitizerMac, GCDSourceEvent) { // Make sure the whole ASan report is printed, i.e. that we don't die // on a CHECK. EXPECT_DEATH(TestGCDSourceEvent(), "Shadow byte and word"); } -TEST(AddressSanitizerMac, DISABLED_GCDSourceCancel) { +TEST(AddressSanitizerMac, GCDSourceCancel) { // Make sure the whole ASan report is printed, i.e. that we don't die // on a CHECK. EXPECT_DEATH(TestGCDSourceCancel(), "Shadow byte and word"); } -TEST(AddressSanitizerMac, DISABLED_GCDGroupAsync) { +TEST(AddressSanitizerMac, GCDGroupAsync) { // Make sure the whole ASan report is printed, i.e. that we don't die // on a CHECK. EXPECT_DEATH(TestGCDGroupAsync(), "Shadow byte and word");