ASan: Disable alloc/dealloc-mismatch checker on Mac for now (it produces weird false positives on googletest)
llvm-svn: 172394
This commit is contained in:
parent
c1a1517a37
commit
aaa50f06d4
|
|
@ -144,7 +144,9 @@ void InitializeFlags(Flags *f, const char *env) {
|
||||||
f->fast_unwind_on_fatal = true;
|
f->fast_unwind_on_fatal = true;
|
||||||
f->fast_unwind_on_malloc = true;
|
f->fast_unwind_on_malloc = true;
|
||||||
f->poison_heap = true;
|
f->poison_heap = true;
|
||||||
f->alloc_dealloc_mismatch = true;
|
// Turn off alloc/dealloc mismatch checker on Mac for now.
|
||||||
|
// TODO(glider): Fix known issues and enable this back.
|
||||||
|
f->alloc_dealloc_mismatch = (ASAN_MAC == 0);
|
||||||
f->use_stack_depot = true; // Only affects allocator2.
|
f->use_stack_depot = true; // Only affects allocator2.
|
||||||
|
|
||||||
// Override from user-specified string.
|
// Override from user-specified string.
|
||||||
|
|
|
||||||
|
|
@ -2060,13 +2060,14 @@ TEST(AddressSanitizer, AttributeNoAddressSafetyTest) {
|
||||||
Ident(NoAddressSafety)();
|
Ident(NoAddressSafety)();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO(glider): Enable this test on Mac when alloc/dealloc mismatch is
|
||||||
|
// fixed there.
|
||||||
|
#ifndef __APPLE__
|
||||||
static string MismatchStr(const string &str) {
|
static string MismatchStr(const string &str) {
|
||||||
return string("AddressSanitizer: alloc-dealloc-mismatch \\(") + str;
|
return string("AddressSanitizer: alloc-dealloc-mismatch \\(") + str;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This test is disabled until we enable alloc_dealloc_mismatch by default.
|
TEST(AddressSanitizer, AllocDeallocMismatch) {
|
||||||
// The feature is also tested by lit tests.
|
|
||||||
TEST(AddressSanitizer, DISABLED_AllocDeallocMismatch) {
|
|
||||||
EXPECT_DEATH(free(Ident(new int)),
|
EXPECT_DEATH(free(Ident(new int)),
|
||||||
MismatchStr("operator new vs free"));
|
MismatchStr("operator new vs free"));
|
||||||
EXPECT_DEATH(free(Ident(new int[2])),
|
EXPECT_DEATH(free(Ident(new int[2])),
|
||||||
|
|
@ -2080,6 +2081,7 @@ TEST(AddressSanitizer, DISABLED_AllocDeallocMismatch) {
|
||||||
EXPECT_DEATH(delete [] (Ident((int*)malloc(2 * sizeof(int)))),
|
EXPECT_DEATH(delete [] (Ident((int*)malloc(2 * sizeof(int)))),
|
||||||
MismatchStr("malloc vs operator delete \\[\\]"));
|
MismatchStr("malloc vs operator delete \\[\\]"));
|
||||||
}
|
}
|
||||||
|
#endif // __APPLE__
|
||||||
|
|
||||||
// ------------------ demo tests; run each one-by-one -------------
|
// ------------------ demo tests; run each one-by-one -------------
|
||||||
// e.g. --gtest_filter=*DemoOOBLeftHigh --gtest_also_run_disabled_tests
|
// e.g. --gtest_filter=*DemoOOBLeftHigh --gtest_also_run_disabled_tests
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue