[asan] GCD tests on Mac: prevent optimization and enable. Patch by glider@google.com

llvm-svn: 145953
This commit is contained in:
Kostya Serebryany 2011-12-06 19:10:48 +00:00
parent a4e87944a8
commit 8b815e1a08
2 changed files with 13 additions and 13 deletions

View File

@ -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;
});

View File

@ -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");