diff options
Diffstat (limited to 'compiler-rt/test')
4 files changed, 39 insertions, 9 deletions
diff --git a/compiler-rt/test/asan/CMakeLists.txt b/compiler-rt/test/asan/CMakeLists.txt index aff54db1e77..03da4af6c1c 100644 --- a/compiler-rt/test/asan/CMakeLists.txt +++ b/compiler-rt/test/asan/CMakeLists.txt @@ -13,6 +13,17 @@ macro(get_bits_for_arch arch bits) endif() endmacro() +set(ASAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS}) +if(NOT COMPILER_RT_STANDALONE_BUILD) + list(APPEND ASAN_TEST_DEPS asan) + if(WIN32 AND COMPILER_RT_HAS_LLD_SOURCES) + list(APPEND ASAN_TEST_DEPS + lld + ) + endif() +endif() +set(ASAN_DYNAMIC_TEST_DEPS ${ASAN_TEST_DEPS}) + foreach(arch ${ASAN_SUPPORTED_ARCH}) if(ANDROID) set(ASAN_TEST_TARGET_ARCH ${arch}-android) @@ -55,12 +66,6 @@ foreach(arch ${ASAN_SUPPORTED_ARCH}) endif() endforeach() -set(ASAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS}) -if(NOT COMPILER_RT_STANDALONE_BUILD) - list(APPEND ASAN_TEST_DEPS asan) -endif() -set(ASAN_DYNAMIC_TEST_DEPS ${ASAN_TEST_DEPS}) - # Add unit tests. if(COMPILER_RT_INCLUDE_TESTS) set(ASAN_TEST_DYNAMIC False) diff --git a/compiler-rt/test/asan/TestCases/Windows/fuse-lld.cc b/compiler-rt/test/asan/TestCases/Windows/fuse-lld.cc new file mode 100644 index 00000000000..b4b3d3907ff --- /dev/null +++ b/compiler-rt/test/asan/TestCases/Windows/fuse-lld.cc @@ -0,0 +1,23 @@ +// If we have LLD, see that things more or less work. +// +// REQUIRES: lld +// +// FIXME: Use -fuse-ld=lld after the old COFF linker is removed. +// FIXME: Test will fail until we add flags for requesting dwarf or cv. +// RUNX: %clangxx_asan -O2 %s -o %t.exe -fuse-ld=lld -Wl,-debug +// RUN: %clangxx_asan -c -O2 %s -o %t.o -gdwarf +// RUN: lld-link2 %t.o -out:%t.exe -debug -defaultlib:libcmt %asan_lib %asan_cxx_lib +// RUN: not %run %t.exe 2>&1 | FileCheck %s + +#include <stdlib.h> + +int main() { + char *x = (char*)malloc(10 * sizeof(char)); + free(x); + return x[5]; + // CHECK: heap-use-after-free + // CHECK: free + // CHECK: main{{.*}}fuse-lld.cc:[[@LINE-4]]:3 + // CHECK: malloc + // CHECK: main{{.*}}fuse-lld.cc:[[@LINE-7]]:20 +} diff --git a/compiler-rt/test/asan/TestCases/Windows/null_deref.cc b/compiler-rt/test/asan/TestCases/Windows/null_deref.cc index 202000f59db..9515602ce89 100644 --- a/compiler-rt/test/asan/TestCases/Windows/null_deref.cc +++ b/compiler-rt/test/asan/TestCases/Windows/null_deref.cc @@ -10,6 +10,6 @@ static void NullDeref(int *ptr) { } int main() { NullDeref((int*)0); - // CHECK: {{ #1 0x.* in main.*null_deref.cc:}}[[@LINE-1]] + // CHECK: {{ #1 0x.* in main.*null_deref.cc:}}[[@LINE-1]]:3 // CHECK: AddressSanitizer can not provide additional info. } diff --git a/compiler-rt/test/asan/TestCases/Windows/report_after_syminitialize.cc b/compiler-rt/test/asan/TestCases/Windows/report_after_syminitialize.cc index faf5e35db5f..3062318e0db 100644 --- a/compiler-rt/test/asan/TestCases/Windows/report_after_syminitialize.cc +++ b/compiler-rt/test/asan/TestCases/Windows/report_after_syminitialize.cc @@ -1,4 +1,5 @@ -// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -O0 %s -o %t +// RUN: env ASAN_OPTIONS=external_symbolizer_path=asdf not %run %t 2>&1 | FileCheck %s #include <windows.h> #include <dbghelp.h> @@ -13,7 +14,8 @@ int main() { *(volatile int*)0 = 42; // CHECK: ERROR: AddressSanitizer: access-violation on unknown address + // CHECK-NEXT: {{WARNING: Failed to use and restart external symbolizer}} // CHECK-NEXT: {{WARNING: .*DbgHelp}} - // CHECK: {{#0 0x.* in main.*report_after_syminitialize.cc:}}[[@LINE-3]] + // CHECK: {{#0 0x.* in main.*report_after_syminitialize.cc:}}[[@LINE-4]] // CHECK: AddressSanitizer can not provide additional info. } |

