[llvm-commits] [compiler-rt] r145953 - in /compiler-rt/trunk/lib/asan/tests: asan_mac_test.mm asan_test.cc

Kostya Serebryany kcc at google.com
Tue Dec 6 11:10:48 PST 2011


Author: kcc
Date: Tue Dec  6 13:10:48 2011
New Revision: 145953

URL: http://llvm.org/viewvc/llvm-project?rev=145953&view=rev
Log:
[asan] GCD tests on Mac: prevent optimization and enable. Patch by glider at google.com

Modified:
    compiler-rt/trunk/lib/asan/tests/asan_mac_test.mm
    compiler-rt/trunk/lib/asan/tests/asan_test.cc

Modified: compiler-rt/trunk/lib/asan/tests/asan_mac_test.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_mac_test.mm?rev=145953&r1=145952&r2=145953&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_mac_test.mm (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_mac_test.mm Tue Dec  6 13:10:48 2011
@@ -59,13 +59,13 @@
 @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 @@
       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 @@
       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 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;
   });

Modified: compiler-rt/trunk/lib/asan/tests/asan_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_test.cc?rev=145953&r1=145952&r2=145953&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_test.cc Tue Dec  6 13:10:48 2011
@@ -1771,50 +1771,50 @@
   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");





More information about the llvm-commits mailing list