Index: test/sanitizer_common/CMakeLists.txt =================================================================== --- test/sanitizer_common/CMakeLists.txt +++ test/sanitizer_common/CMakeLists.txt @@ -3,17 +3,21 @@ set(SANITIZER_COMMON_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS}) set(SANITIZER_COMMON_TESTSUITES) +# FIXME(dliew): We should switch to COMPILER_RT_SANITIZERS_TO_BUILD instead of +# the hard coded `SUPPORTED_TOOLS_INIT` list once we know that the other +# sanitizers work. +set(SUPPORTED_TOOLS_INIT asan lsan msan tsan ubsan) set(SUPPORTED_TOOLS) -if(CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD|SunOS") - list(APPEND SUPPORTED_TOOLS asan) -endif() -if(CMAKE_SYSTEM_NAME MATCHES "NetBSD" OR (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT ANDROID)) - list(APPEND SUPPORTED_TOOLS tsan) - list(APPEND SUPPORTED_TOOLS msan) - list(APPEND SUPPORTED_TOOLS ubsan) -endif() -if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT ANDROID) - list(APPEND SUPPORTED_TOOLS lsan) +# FIXME: These tests should be made to work on all platforms +# we build for, but until we know that they tests actually +# work don't generate configs for them. +if (NOT (ANDROID OR WINDOWS)) + foreach(SANITIZER_TOOL ${SUPPORTED_TOOLS_INIT}) + string(TOUPPER ${SANITIZER_TOOL} SANITIZER_TOOL_UPPER) + if (COMPILER_RT_HAS_${SANITIZER_TOOL_UPPER}) + list(APPEND SUPPORTED_TOOLS ${SANITIZER_TOOL}) + endif() + endforeach() endif() # Create a separate config for each tool we support. @@ -27,6 +31,8 @@ darwin_filter_host_archs(${tool_toupper}_SUPPORTED_ARCH TEST_ARCH) endif() + # TODO(dliew): We should iterate over the different + # Apple platforms, not just macOS. foreach(arch ${TEST_ARCH}) set(SANITIZER_COMMON_LIT_TEST_MODE ${tool}) set(SANITIZER_COMMON_TEST_TARGET_ARCH ${arch}) Index: test/sanitizer_common/TestCases/Darwin/abort_on_error.cc =================================================================== --- test/sanitizer_common/TestCases/Darwin/abort_on_error.cc +++ test/sanitizer_common/TestCases/Darwin/abort_on_error.cc @@ -1,7 +1,7 @@ // Check that sanitizers on OS X crash the process by default (i.e. // abort_on_error=1). See also Linux/abort_on_error.cc. -// RUN: %clangxx %s -o %t +// RUN: %clangxx -DUSING_%tool_name %s -o %t // Intentionally don't inherit the default options. // RUN: env %tool_options='' not --crash %run %t 2>&1 @@ -9,11 +9,19 @@ // When we use lit's default options, we shouldn't crash. // RUN: not %run %t 2>&1 +// Leak detection isn't treated as an error so `abort_on_error=1` doesn't work. +// UNSUPPORTED: lsan + int global; int main() { +#if defined(USING_ubsan) + int value = 5; + int computation = value / 0; // Division by zero. +#else volatile int *a = new int[100]; delete[] a; - global = a[0]; // use-after-free: triggers ASan report. + global = a[0]; // use-after-free: triggers ASan/TSan report. +#endif return 0; } Index: test/sanitizer_common/TestCases/Darwin/print-stack-trace.cc =================================================================== --- test/sanitizer_common/TestCases/Darwin/print-stack-trace.cc +++ test/sanitizer_common/TestCases/Darwin/print-stack-trace.cc @@ -1,6 +1,9 @@ // RUN: %clangxx -O0 %s -o %t && %env_tool_opts=stack_trace_format=DEFAULT %run %t 2>&1 | FileCheck %s // RUN: %env_tool_opts=stack_trace_format='"frame:%n lineno:%l"' %run %t 2>&1 | FileCheck %s --check-prefix=CUSTOM +// FIXME(dliew): Make this test work with other sanitizers +// XFAIL: darwin && (lsan || tsan || ubsan) + #include static inline void FooBarBaz() { Index: test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cc =================================================================== --- test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cc +++ test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cc @@ -10,6 +10,9 @@ // XFAIL: netbsd && !asan +// FIXME(dliew): Make this test work with other sanitizers +// XFAIL: darwin && (lsan || tsan || ubsan) + volatile int *null = 0; namespace Xyz { Index: test/sanitizer_common/TestCases/Posix/sanitizer_set_death_callback_test.cc =================================================================== --- test/sanitizer_common/TestCases/Posix/sanitizer_set_death_callback_test.cc +++ test/sanitizer_common/TestCases/Posix/sanitizer_set_death_callback_test.cc @@ -3,6 +3,8 @@ // REQUIRES: stable-runtime // XFAIL: ubsan +// FIXME(dliew): Make this test work on Darwin with LSan +// XFAIL: darwin && lsan #include #include Index: test/sanitizer_common/TestCases/symbolize_stack.cc =================================================================== --- test/sanitizer_common/TestCases/symbolize_stack.cc +++ test/sanitizer_common/TestCases/symbolize_stack.cc @@ -2,6 +2,9 @@ // Test that symbolizer does not crash on frame with large function name. +// FIXME(dliew): Make this test work with the other sanitizers. +// UNSUPPORTED: darwin && (lsan || tsan || ubsan) + #include #include