diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index 19a4a342cbc1..211d91714419 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -232,6 +232,7 @@ endif() filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH x86_64 i386 powerpc64 arm) filter_available_targets(DFSAN_SUPPORTED_ARCH x86_64) +filter_available_targets(LSAN_SUPPORTED_ARCH x86_64) filter_available_targets(UBSAN_SUPPORTED_ARCH x86_64 i386) add_subdirectory(include) diff --git a/compiler-rt/lib/lsan/CMakeLists.txt b/compiler-rt/lib/lsan/CMakeLists.txt index c9c0e22f3b49..5d46fd045378 100644 --- a/compiler-rt/lib/lsan/CMakeLists.txt +++ b/compiler-rt/lib/lsan/CMakeLists.txt @@ -22,11 +22,7 @@ set(LSAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) filter_available_targets(LSAN_COMMON_SUPPORTED_ARCH x86_64 i386 powerpc64 arm) -# Architectures supported by the standalone LSan. -filter_available_targets(LSAN_SUPPORTED_ARCH - x86_64) - -set(LSAN_RUNTIME_LIBRARIES) +add_custom_target(lsan) if(APPLE) foreach(os ${SANITIZER_COMMON_SUPPORTED_DARWIN_OS}) @@ -50,8 +46,6 @@ elseif(NOT ANDROID) $ $ CFLAGS ${LSAN_CFLAGS}) - list(APPEND LSAN_RUNTIME_LIBRARIES clang_rt.lsan-${arch}) + add_dependencies(lsan clang_rt.lsan-${arch}) endforeach() endif() - -add_subdirectory(lit_tests) diff --git a/compiler-rt/test/CMakeLists.txt b/compiler-rt/test/CMakeLists.txt index 5b8c59a7f6e9..6c9b08f6d22d 100644 --- a/compiler-rt/test/CMakeLists.txt +++ b/compiler-rt/test/CMakeLists.txt @@ -12,6 +12,9 @@ if(COMPILER_RT_CAN_EXECUTE_TESTS) if(DFSAN_SUPPORTED_ARCH) add_subdirectory(dfsan) endif() + if(LSAN_SUPPORTED_ARCH) + add_subdirectory(lsan) + endif() if(UBSAN_SUPPORTED_ARCH) add_subdirectory(ubsan) endif() diff --git a/compiler-rt/lib/lsan/lit_tests/AsanConfig/lit.cfg b/compiler-rt/test/lsan/AsanConfig/lit.cfg similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/AsanConfig/lit.cfg rename to compiler-rt/test/lsan/AsanConfig/lit.cfg diff --git a/compiler-rt/lib/lsan/lit_tests/AsanConfig/lit.site.cfg.in b/compiler-rt/test/lsan/AsanConfig/lit.site.cfg.in similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/AsanConfig/lit.site.cfg.in rename to compiler-rt/test/lsan/AsanConfig/lit.site.cfg.in diff --git a/compiler-rt/lib/lsan/lit_tests/CMakeLists.txt b/compiler-rt/test/lsan/CMakeLists.txt similarity index 74% rename from compiler-rt/lib/lsan/lit_tests/CMakeLists.txt rename to compiler-rt/test/lsan/CMakeLists.txt index 9b26357fb2b3..6b1fb0695f09 100644 --- a/compiler-rt/lib/lsan/lit_tests/CMakeLists.txt +++ b/compiler-rt/test/lsan/CMakeLists.txt @@ -1,6 +1,3 @@ -set(LSAN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..) -set(LSAN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/..) - set(LSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) configure_lit_site_cfg( @@ -16,10 +13,8 @@ configure_lit_site_cfg( if(COMPILER_RT_CAN_EXECUTE_TESTS AND NOT APPLE AND NOT ANDROID) set(LSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS} - ${LSAN_RUNTIME_LIBRARIES}) - foreach(arch ${LSAN_SUPPORTED_ARCH}) - list(APPEND LSAN_TEST_DEPS clang_rt.asan-${arch}) - endforeach() + lsan + asan_runtime_libraries) add_lit_testsuite(check-lsan "Running the LeakSanitizer tests" ${CMAKE_CURRENT_BINARY_DIR}/LsanConfig ${CMAKE_CURRENT_BINARY_DIR}/AsanConfig diff --git a/compiler-rt/lib/lsan/lit_tests/LsanConfig/lit.cfg b/compiler-rt/test/lsan/LsanConfig/lit.cfg similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/LsanConfig/lit.cfg rename to compiler-rt/test/lsan/LsanConfig/lit.cfg diff --git a/compiler-rt/lib/lsan/lit_tests/LsanConfig/lit.site.cfg.in b/compiler-rt/test/lsan/LsanConfig/lit.site.cfg.in similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/LsanConfig/lit.site.cfg.in rename to compiler-rt/test/lsan/LsanConfig/lit.site.cfg.in diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/cleanup_in_tsd_destructor.cc b/compiler-rt/test/lsan/TestCases/cleanup_in_tsd_destructor.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/cleanup_in_tsd_destructor.cc rename to compiler-rt/test/lsan/TestCases/cleanup_in_tsd_destructor.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/disabler.cc b/compiler-rt/test/lsan/TestCases/disabler.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/disabler.cc rename to compiler-rt/test/lsan/TestCases/disabler.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/disabler_in_tsd_destructor.cc b/compiler-rt/test/lsan/TestCases/disabler_in_tsd_destructor.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/disabler_in_tsd_destructor.cc rename to compiler-rt/test/lsan/TestCases/disabler_in_tsd_destructor.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/do_leak_check_override.cc b/compiler-rt/test/lsan/TestCases/do_leak_check_override.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/do_leak_check_override.cc rename to compiler-rt/test/lsan/TestCases/do_leak_check_override.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/fork.cc b/compiler-rt/test/lsan/TestCases/fork.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/fork.cc rename to compiler-rt/test/lsan/TestCases/fork.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/fork_threaded.cc b/compiler-rt/test/lsan/TestCases/fork_threaded.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/fork_threaded.cc rename to compiler-rt/test/lsan/TestCases/fork_threaded.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/high_allocator_contention.cc b/compiler-rt/test/lsan/TestCases/high_allocator_contention.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/high_allocator_contention.cc rename to compiler-rt/test/lsan/TestCases/high_allocator_contention.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/ignore_object.cc b/compiler-rt/test/lsan/TestCases/ignore_object.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/ignore_object.cc rename to compiler-rt/test/lsan/TestCases/ignore_object.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/ignore_object_errors.cc b/compiler-rt/test/lsan/TestCases/ignore_object_errors.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/ignore_object_errors.cc rename to compiler-rt/test/lsan/TestCases/ignore_object_errors.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/large_allocation_leak.cc b/compiler-rt/test/lsan/TestCases/large_allocation_leak.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/large_allocation_leak.cc rename to compiler-rt/test/lsan/TestCases/large_allocation_leak.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/leak_check_at_exit.cc b/compiler-rt/test/lsan/TestCases/leak_check_at_exit.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/leak_check_at_exit.cc rename to compiler-rt/test/lsan/TestCases/leak_check_at_exit.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/link_turned_off.cc b/compiler-rt/test/lsan/TestCases/link_turned_off.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/link_turned_off.cc rename to compiler-rt/test/lsan/TestCases/link_turned_off.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/new_array_with_dtor_0.cc b/compiler-rt/test/lsan/TestCases/new_array_with_dtor_0.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/new_array_with_dtor_0.cc rename to compiler-rt/test/lsan/TestCases/new_array_with_dtor_0.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/pointer_to_self.cc b/compiler-rt/test/lsan/TestCases/pointer_to_self.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/pointer_to_self.cc rename to compiler-rt/test/lsan/TestCases/pointer_to_self.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/print_suppressions.cc b/compiler-rt/test/lsan/TestCases/print_suppressions.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/print_suppressions.cc rename to compiler-rt/test/lsan/TestCases/print_suppressions.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/register_root_region.cc b/compiler-rt/test/lsan/TestCases/register_root_region.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/register_root_region.cc rename to compiler-rt/test/lsan/TestCases/register_root_region.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/sanity_check_pure_c.c b/compiler-rt/test/lsan/TestCases/sanity_check_pure_c.c similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/sanity_check_pure_c.c rename to compiler-rt/test/lsan/TestCases/sanity_check_pure_c.c diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/stale_stack_leak.cc b/compiler-rt/test/lsan/TestCases/stale_stack_leak.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/stale_stack_leak.cc rename to compiler-rt/test/lsan/TestCases/stale_stack_leak.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/suppressions_default.cc b/compiler-rt/test/lsan/TestCases/suppressions_default.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/suppressions_default.cc rename to compiler-rt/test/lsan/TestCases/suppressions_default.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/suppressions_file.cc b/compiler-rt/test/lsan/TestCases/suppressions_file.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/suppressions_file.cc rename to compiler-rt/test/lsan/TestCases/suppressions_file.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/swapcontext.cc b/compiler-rt/test/lsan/TestCases/swapcontext.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/swapcontext.cc rename to compiler-rt/test/lsan/TestCases/swapcontext.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/use_after_return.cc b/compiler-rt/test/lsan/TestCases/use_after_return.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/use_after_return.cc rename to compiler-rt/test/lsan/TestCases/use_after_return.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/use_globals_initialized.cc b/compiler-rt/test/lsan/TestCases/use_globals_initialized.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/use_globals_initialized.cc rename to compiler-rt/test/lsan/TestCases/use_globals_initialized.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/use_globals_uninitialized.cc b/compiler-rt/test/lsan/TestCases/use_globals_uninitialized.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/use_globals_uninitialized.cc rename to compiler-rt/test/lsan/TestCases/use_globals_uninitialized.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/use_poisoned_asan.cc b/compiler-rt/test/lsan/TestCases/use_poisoned_asan.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/use_poisoned_asan.cc rename to compiler-rt/test/lsan/TestCases/use_poisoned_asan.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/use_registers.cc b/compiler-rt/test/lsan/TestCases/use_registers.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/use_registers.cc rename to compiler-rt/test/lsan/TestCases/use_registers.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/use_stacks.cc b/compiler-rt/test/lsan/TestCases/use_stacks.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/use_stacks.cc rename to compiler-rt/test/lsan/TestCases/use_stacks.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/use_stacks_threaded.cc b/compiler-rt/test/lsan/TestCases/use_stacks_threaded.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/use_stacks_threaded.cc rename to compiler-rt/test/lsan/TestCases/use_stacks_threaded.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/use_tls_dynamic.cc b/compiler-rt/test/lsan/TestCases/use_tls_dynamic.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/use_tls_dynamic.cc rename to compiler-rt/test/lsan/TestCases/use_tls_dynamic.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_dynamic.cc b/compiler-rt/test/lsan/TestCases/use_tls_pthread_specific_dynamic.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_dynamic.cc rename to compiler-rt/test/lsan/TestCases/use_tls_pthread_specific_dynamic.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_static.cc b/compiler-rt/test/lsan/TestCases/use_tls_pthread_specific_static.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/use_tls_pthread_specific_static.cc rename to compiler-rt/test/lsan/TestCases/use_tls_pthread_specific_static.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/use_tls_static.cc b/compiler-rt/test/lsan/TestCases/use_tls_static.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/use_tls_static.cc rename to compiler-rt/test/lsan/TestCases/use_tls_static.cc diff --git a/compiler-rt/lib/lsan/lit_tests/TestCases/use_unaligned.cc b/compiler-rt/test/lsan/TestCases/use_unaligned.cc similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/TestCases/use_unaligned.cc rename to compiler-rt/test/lsan/TestCases/use_unaligned.cc diff --git a/compiler-rt/lib/lsan/lit_tests/lit.common.cfg b/compiler-rt/test/lsan/lit.common.cfg similarity index 100% rename from compiler-rt/lib/lsan/lit_tests/lit.common.cfg rename to compiler-rt/test/lsan/lit.common.cfg