[compiler-rt] r224470 - [ASan] Always build shared ASan runtime on Linux.
Timur Iskhodzhanov
timurrrr at google.com
Wed Feb 4 07:42:55 PST 2015
Thanks for a quick fix!
On Tue Feb 03 2015 at 9:42:43 PM Alexey Samsonov <vonosmas at gmail.com> wrote:
> On Tue, Feb 3, 2015 at 2:50 AM, Timur Iskhodzhanov <timurrrr at google.com>
> wrote:
>
>> See comments inline.
>>
>> On Thu Dec 18 2014 at 9:20:34 PM Alexey Samsonov <vonosmas at gmail.com>
>> wrote:
>>
>>> Author: samsonov
>>> Date: Wed Dec 17 17:14:01 2014
>>> New Revision: 224470
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=224470&view=rev
>>> Log:
>>> [ASan] Always build shared ASan runtime on Linux.
>>>
>>> This commit changes the strategy for building shared ASan runtime
>>> and the way we test it:
>>> - COMPILER_RT_BUILD_SHARED_ASAN CMake option is removed. We now
>>> always build shared ASan runtime (it is the default on Android,
>>> Windows and Mac, and not the default on Linux and FreeBSD).
>>> - Platforms, which use static runtime by default now have
>>> "check-asan-dynamic" testsuite. This testsuite contains instrumented
>>> unit tests, and ASan lit tests, and runs them with shared ASan
>>> runtime. This testsuite is *not* a part of "check-asan" and
>>> *not* a part of "check-all", as adding 1000 more test cases, which
>>> duplicate existing ones is costly. However, you're welcome to
>>> add this command to your buildbot.
>>>
>>
>> Why was it done this way?
>>
>
> Because building/running ASan test-suite takes a long time (more than all
> the rest LLVM/Clang testsuites combined, especially in the debug build),
> and I thought it makes sense to only test this configuration on the
> buildbot.
>
>
>> This change has silently disabled testing of half of the tests on Windows
>> and I only found out about this now, by pure coincidence.
>>
>
> Sorry, apparently I didn't realize that you actively use both runtimes on
> Windows :/
> r228001 should help - now "check-all" command should run ASan tests with
> both static and dynamic runtime.
>
>
>>
>> [see below]
>>
>>
>>> Modified:
>>> compiler-rt/trunk/CMakeLists.txt
>>> compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
>>> compiler-rt/trunk/cmake/config-ix.cmake
>>> compiler-rt/trunk/lib/asan/CMakeLists.txt
>>> compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
>>> compiler-rt/trunk/test/asan/CMakeLists.txt
>>> compiler-rt/trunk/test/asan/Unit/lit.site.cfg.in
>>>
>>> Modified: compiler-rt/trunk/CMakeLists.txt
>>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/
>>> CMakeLists.txt?rev=224470&r1=224469&r2=224470&view=diff
>>> ============================================================
>>> ==================
>>> --- compiler-rt/trunk/CMakeLists.txt (original)
>>> +++ compiler-rt/trunk/CMakeLists.txt Wed Dec 17 17:14:01 2014
>>> @@ -199,14 +199,6 @@ option(COMPILER_RT_DEBUG "Build runtimes
>>> # COMPILER_RT_DEBUG_PYBOOL is used by lit.common.configured.in.
>>> pythonize_bool(COMPILER_RT_DEBUG)
>>>
>>> -# We have to support both static and dynamic/shared runtime on Windows.
>>>
>>
>> As it was explained in this comment, on Windows we *have* to support both
>> static and dynamic runtimes. We want to *always* test both static and
>> dynamic runtimes. Please reconsider how the static/dynamic cmake logic
>> works to account for that.
>>
>>
>>> -# Android only works with dynamic runtime.
>>> -if(WIN32 OR ANDROID)
>>> -option(COMPILER_RT_BUILD_SHARED_ASAN "Build shared version of
>>> AddressSanitizer runtime" ON)
>>> -else()
>>> -option(COMPILER_RT_BUILD_SHARED_ASAN "Build shared version of
>>> AddressSanitizer runtime" OFF)
>>> -endif()
>>> -
>>> #================================
>>> # Setup Compiler Flags
>>> #================================
>>>
>>> Modified: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
>>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/
>>> cmake/Modules/AddCompilerRT.cmake?rev=224470&r1=224469&r2=
>>> 224470&view=diff
>>> ============================================================
>>> ==================
>>> --- compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake (original)
>>> +++ compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake Wed Dec 17
>>> 17:14:01 2014
>>> @@ -156,12 +156,17 @@ endif()
>>> # using specified link flags. Make executable a part of provided
>>> # test_suite.
>>> # add_compiler_rt_test(<test_suite> <test_name>
>>> +# SUBDIR <subdirectory for binary>
>>> # OBJECTS <object files>
>>> # DEPS <deps (e.g. runtime libs)>
>>> # LINK_FLAGS <link flags>)
>>> macro(add_compiler_rt_test test_suite test_name)
>>> - parse_arguments(TEST "OBJECTS;DEPS;LINK_FLAGS" "" ${ARGN})
>>> - set(output_bin "${CMAKE_CURRENT_BINARY_DIR}/${test_name}")
>>> + parse_arguments(TEST "SUBDIR;OBJECTS;DEPS;LINK_FLAGS" "" ${ARGN})
>>> + if(TEST_SUBDIR)
>>> + set(output_bin "${CMAKE_CURRENT_BINARY_DIR}/$
>>> {TEST_SUBDIR}/${test_name}")
>>> + else()
>>> + set(output_bin "${CMAKE_CURRENT_BINARY_DIR}/${test_name}")
>>> + endif()
>>> # Use host compiler in a standalone build, and just-built Clang
>>> otherwise.
>>> if(NOT COMPILER_RT_STANDALONE_BUILD)
>>> list(APPEND TEST_DEPS clang)
>>>
>>> Modified: compiler-rt/trunk/cmake/config-ix.cmake
>>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/
>>> cmake/config-ix.cmake?rev=224470&r1=224469&r2=224470&view=diff
>>> ============================================================
>>> ==================
>>> --- compiler-rt/trunk/cmake/config-ix.cmake (original)
>>> +++ compiler-rt/trunk/cmake/config-ix.cmake Wed Dec 17 17:14:01 2014
>>> @@ -205,6 +205,12 @@ else()
>>> set(COMPILER_RT_HAS_ASAN FALSE)
>>> endif()
>>>
>>> +if (OS_NAME MATCHES "Linux|FreeBSD")
>>> + set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME TRUE)
>>> +else()
>>> + set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME FALSE)
>>> +endif()
>>> +
>>> # TODO: Add builtins support.
>>>
>>> if (COMPILER_RT_HAS_SANITIZER_COMMON AND DFSAN_SUPPORTED_ARCH AND
>>>
>>> Modified: compiler-rt/trunk/lib/asan/CMakeLists.txt
>>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/
>>> asan/CMakeLists.txt?rev=224470&r1=224469&r2=224470&view=diff
>>> ============================================================
>>> ==================
>>> --- compiler-rt/trunk/lib/asan/CMakeLists.txt (original)
>>> +++ compiler-rt/trunk/lib/asan/CMakeLists.txt Wed Dec 17 17:14:01 2014
>>> @@ -79,12 +79,10 @@ else()
>>> add_compiler_rt_object_library(RTAsan_preinit ${arch}
>>> SOURCES ${ASAN_PREINIT_SOURCES} CFLAGS ${ASAN_CFLAGS}
>>> DEFS ${ASAN_COMMON_DEFINITIONS})
>>> - if (COMPILER_RT_BUILD_SHARED_ASAN)
>>> - add_compiler_rt_object_library(RTAsan_dynamic ${arch}
>>> - SOURCES ${ASAN_SOURCES} ${ASAN_CXX_SOURCES}
>>> - CFLAGS ${ASAN_DYNAMIC_CFLAGS}
>>> - DEFS ${ASAN_DYNAMIC_DEFINITIONS})
>>> - endif()
>>> + add_compiler_rt_object_library(RTAsan_dynamic ${arch}
>>> + SOURCES ${ASAN_SOURCES} ${ASAN_CXX_SOURCES}
>>> + CFLAGS ${ASAN_DYNAMIC_CFLAGS}
>>> + DEFS ${ASAN_DYNAMIC_DEFINITIONS})
>>> endforeach()
>>> endif()
>>>
>>> @@ -129,28 +127,25 @@ else()
>>> DEFS ${ASAN_COMMON_DEFINITIONS})
>>> add_dependencies(asan clang_rt.asan_cxx-${arch})
>>>
>>> - if (COMPILER_RT_BUILD_SHARED_ASAN)
>>> - add_compiler_rt_runtime(clang_rt.asan-preinit-${arch} ${arch}
>>> STATIC
>>> - SOURCES $<TARGET_OBJECTS:RTAsan_preinit.${arch}>
>>> - CFLAGS ${ASAN_CFLAGS}
>>> - DEFS ${ASAN_COMMON_DEFINITIONS})
>>> - add_dependencies(asan clang_rt.asan-preinit-${arch})
>>> -
>>> - if (WIN32)
>>> - set(SHARED_ASAN_NAME clang_rt.asan_dynamic-${arch}$
>>> {COMPILER_RT_OS_SUFFIX})
>>> - else()
>>> - set(SHARED_ASAN_NAME clang_rt.asan-${arch}${
>>> COMPILER_RT_OS_SUFFIX})
>>> - endif()
>>> -
>>> - add_compiler_rt_runtime(clang_rt.asan-dynamic-${arch} ${arch}
>>> SHARED
>>> - OUTPUT_NAME ${SHARED_ASAN_NAME}
>>> - SOURCES $<TARGET_OBJECTS:RTAsan_dynamic.${arch}>
>>> - ${ASAN_COMMON_RUNTIME_OBJECTS}
>>> - CFLAGS ${ASAN_DYNAMIC_CFLAGS}
>>> - DEFS ${ASAN_DYNAMIC_DEFINITIONS})
>>> - target_link_libraries(clang_rt.asan-dynamic-${arch}
>>> ${ASAN_DYNAMIC_LIBS})
>>> - add_dependencies(asan clang_rt.asan-dynamic-${arch})
>>> + add_compiler_rt_runtime(clang_rt.asan-preinit-${arch} ${arch}
>>> STATIC
>>> + SOURCES $<TARGET_OBJECTS:RTAsan_preinit.${arch}>
>>> + CFLAGS ${ASAN_CFLAGS}
>>> + DEFS ${ASAN_COMMON_DEFINITIONS})
>>> + add_dependencies(asan clang_rt.asan-preinit-${arch})
>>> +
>>> + if (WIN32)
>>> + set(SHARED_ASAN_NAME clang_rt.asan_dynamic-${arch}$
>>> {COMPILER_RT_OS_SUFFIX})
>>> + else()
>>> + set(SHARED_ASAN_NAME clang_rt.asan-${arch}${
>>> COMPILER_RT_OS_SUFFIX})
>>> endif()
>>> + add_compiler_rt_runtime(clang_rt.asan-dynamic-${arch} ${arch}
>>> SHARED
>>> + OUTPUT_NAME ${SHARED_ASAN_NAME}
>>> + SOURCES $<TARGET_OBJECTS:RTAsan_dynamic.${arch}>
>>> + ${ASAN_COMMON_RUNTIME_OBJECTS}
>>> + CFLAGS ${ASAN_DYNAMIC_CFLAGS}
>>> + DEFS ${ASAN_DYNAMIC_DEFINITIONS})
>>> + target_link_libraries(clang_rt.asan-dynamic-${arch}
>>> ${ASAN_DYNAMIC_LIBS})
>>> + add_dependencies(asan clang_rt.asan-dynamic-${arch})
>>>
>>> if (UNIX AND NOT ${arch} STREQUAL "i386" AND NOT ${arch} STREQUAL
>>> "i686")
>>> add_sanitizer_rt_symbols(clang_rt.asan_cxx-${arch})
>>>
>>> Modified: compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
>>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/
>>> asan/tests/CMakeLists.txt?rev=224470&r1=224469&r2=224470&view=diff
>>> ============================================================
>>> ==================
>>> --- compiler-rt/trunk/lib/asan/tests/CMakeLists.txt (original)
>>> +++ compiler-rt/trunk/lib/asan/tests/CMakeLists.txt Wed Dec 17 17:14:01
>>> 2014
>>> @@ -117,7 +117,7 @@ endmacro()
>>> # Link ASan unit test for a given architecture from a set
>>> # of objects in with given linker flags.
>>> macro(add_asan_test test_suite test_name arch kind)
>>> - parse_arguments(TEST "OBJECTS;LINKFLAGS" "WITH_TEST_RUNTIME" ${ARGN})
>>> + parse_arguments(TEST "OBJECTS;LINKFLAGS;SUBDIR" "WITH_TEST_RUNTIME"
>>> ${ARGN})
>>> get_target_flags_for_arch(${arch} TARGET_LINK_FLAGS)
>>> set(TEST_DEPS ${TEST_OBJECTS})
>>> if(NOT COMPILER_RT_STANDALONE_BUILD)
>>> @@ -132,6 +132,7 @@ macro(add_asan_test test_suite test_name
>>> endif()
>>> endif()
>>> add_compiler_rt_test(${test_suite} ${test_name}
>>> + SUBDIR ${TEST_SUBDIR}
>>> OBJECTS ${TEST_OBJECTS}
>>> DEPS ${TEST_DEPS}
>>> LINK_FLAGS ${TEST_LINKFLAGS}
>>> @@ -141,6 +142,11 @@ endmacro()
>>> # Main AddressSanitizer unit tests.
>>> add_custom_target(AsanUnitTests)
>>> set_target_properties(AsanUnitTests PROPERTIES FOLDER "ASan unit
>>> tests")
>>> +# AddressSanitizer unit tests with dynamic runtime (on platforms where
>>> it's
>>> +# not the default).
>>> +add_custom_target(AsanDynamicUnitTests)
>>> +set_target_properties(AsanDynamicUnitTests
>>> + PROPERTIES FOLDER "ASan unit tests with dynamic runtime")
>>> # ASan benchmarks (not actively used now).
>>> add_custom_target(AsanBenchmarks)
>>> set_target_properties(AsanBenchmarks PROPERTIES FOLDER "Asan
>>> benchmarks")
>>> @@ -182,11 +188,15 @@ macro(add_asan_tests_for_arch_and_kind a
>>> asan_compile(ASAN_INST_TEST_OBJECTS asan_mac_test_helpers.mm
>>> ${arch} ${kind}
>>> ${ASAN_UNITTEST_INSTRUMENTED_CFLAGS} -ObjC ${ARGN})
>>> endif()
>>> - add_asan_test(AsanUnitTests "Asan-${arch}${kind}-Test" ${arch} ${kind}
>>> + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/default")
>>> + add_asan_test(AsanUnitTests "Asan-${arch}${kind}-Test"
>>> + ${arch} ${kind} SUBDIR "default"
>>> OBJECTS ${ASAN_INST_TEST_OBJECTS}
>>> LINKFLAGS ${ASAN_UNITTEST_INSTRUMENTED_LINKFLAGS})
>>> - if(COMPILER_RT_BUILD_SHARED_ASAN)
>>> - add_asan_test(AsanUnitTests "Asan-${arch}${kind}-Dynamic-Test"
>>> ${arch} ${kind}
>>> + if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME)
>>> + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dynamic")
>>> + add_asan_test(AsanDynamicUnitTests "Asan-${arch}${kind}-Dynamic-
>>> Test"
>>> + ${arch} ${kind} SUBDIR "dynamic"
>>> OBJECTS ${ASAN_INST_TEST_OBJECTS}
>>> LINKFLAGS ${ASAN_DYNAMIC_UNITTEST_
>>> INSTRUMENTED_LINKFLAGS})
>>> endif()
>>> @@ -220,7 +230,8 @@ macro(add_asan_tests_for_arch_and_kind a
>>> asan_compile(ASAN_NOINST_TEST_OBJECTS ${src} ${arch} ${kind}
>>> ${ASAN_UNITTEST_COMMON_CFLAGS} ${ARGN})
>>> endforeach()
>>> - add_asan_test(AsanUnitTests "Asan-${arch}${kind}-Noinst-Test"
>>> ${arch} ${kind}
>>> + add_asan_test(AsanUnitTests "Asan-${arch}${kind}-Noinst-Test"
>>> + ${arch} ${kind} SUBDIR "default"
>>> OBJECTS ${ASAN_NOINST_TEST_OBJECTS}
>>> LINKFLAGS ${ASAN_UNITTEST_NOINST_LINKFLAGS}
>>> WITH_TEST_RUNTIME)
>>> @@ -231,14 +242,10 @@ macro(add_asan_tests_for_arch_and_kind a
>>> asan_compile(ASAN_BENCHMARKS_OBJECTS ${src} ${arch} ${kind}
>>> ${ASAN_UNITTEST_INSTRUMENTED_CFLAGS} ${ARGN})
>>> endforeach()
>>> - add_asan_test(AsanBenchmarks "Asan-${arch}${kind}-Benchmark" ${arch}
>>> ${kind}
>>> + add_asan_test(AsanBenchmarks "Asan-${arch}${kind}-Benchmark"
>>> + ${arch} ${kind} SUBDIR "default"
>>> OBJECTS ${ASAN_BENCHMARKS_OBJECTS}
>>> LINKFLAGS ${ASAN_UNITTEST_INSTRUMENTED_LINKFLAGS})
>>> - if(COMPILER_RT_BUILD_SHARED_ASAN)
>>> - add_asan_test(AsanBenchmarks "Asan-${arch}${kind}-Dynamic-Benchmark"
>>> ${arch} ${kind}
>>> - OBJECTS ${ASAN_BENCHMARKS_OBJECTS}
>>> - LINKFLAGS ${ASAN_DYNAMIC_UNITTEST_
>>> INSTRUMENTED_LINKFLAGS})
>>> - endif()
>>> endmacro()
>>>
>>> if(COMPILER_RT_CAN_EXECUTE_TESTS AND NOT ANDROID)
>>>
>>> Modified: compiler-rt/trunk/test/asan/CMakeLists.txt
>>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/
>>> test/asan/CMakeLists.txt?rev=224470&r1=224469&r2=224470&view=diff
>>> ============================================================
>>> ==================
>>> --- compiler-rt/trunk/test/asan/CMakeLists.txt (original)
>>> +++ compiler-rt/trunk/test/asan/CMakeLists.txt Wed Dec 17 17:14:01 2014
>>> @@ -1,6 +1,7 @@
>>> set(ASAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
>>>
>>> set(ASAN_TESTSUITES)
>>> +set(ASAN_DYNAMIC_TESTSUITES)
>>>
>>> macro(get_bits_for_arch arch bits)
>>> if (${arch} STREQUAL "arm" OR
>>> @@ -78,13 +79,14 @@ else() # Not Android
>>> ${CMAKE_CURRENT_BINARY_DIR}/64bitConfig/lit.site.cfg
>>> )
>>> list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/
>>> 64bitConfig)
>>> - if(COMPILER_RT_BUILD_SHARED_ASAN)
>>> + if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME)
>>> set(ASAN_TEST_CONFIG_SUFFIX "64-Dynamic")
>>> set(ASAN_TEST_DYNAMIC True)
>>> configure_lit_site_cfg(
>>> ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
>>> ${CMAKE_CURRENT_BINARY_DIR}/64bitConfig-dynamic/lit.site.cfg)
>>> - list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/
>>> 64bitConfig-dynamic)
>>> + list(APPEND ASAN_DYNAMIC_TESTSUITES
>>> + ${CMAKE_CURRENT_BINARY_DIR}/64bitConfig-dynamic)
>>> endif()
>>> endif()
>>>
>>> @@ -99,13 +101,14 @@ else() # Not Android
>>> ${CMAKE_CURRENT_BINARY_DIR}/32bitConfig/lit.site.cfg
>>> )
>>> list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/
>>> 32bitConfig)
>>> - if(COMPILER_RT_BUILD_SHARED_ASAN)
>>> + if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME)
>>> set(ASAN_TEST_CONFIG_SUFFIX "32-Dynamic")
>>> set(ASAN_TEST_DYNAMIC True)
>>> configure_lit_site_cfg(
>>> ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
>>> ${CMAKE_CURRENT_BINARY_DIR}/32bitConfig-dynamic/lit.site.cfg)
>>> - list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/
>>> 32bitConfig-dynamic)
>>> + list(APPEND ASAN_DYNAMIC_TESTSUITES
>>> + ${CMAKE_CURRENT_BINARY_DIR}/32bitConfig-dynamic)
>>> endif()
>>> endif()
>>>
>>> @@ -119,23 +122,18 @@ else() # Not Android
>>> ${CMAKE_CURRENT_BINARY_DIR}/32bitConfig/lit.site.cfg
>>> )
>>> list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/
>>> 32bitConfig)
>>> - if(COMPILER_RT_BUILD_SHARED_ASAN)
>>> + if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME)
>>> set(ASAN_TEST_CONFIG_SUFFIX "32-Dynamic")
>>> set(ASAN_TEST_DYNAMIC True)
>>> configure_lit_site_cfg(
>>> ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
>>> ${CMAKE_CURRENT_BINARY_DIR}/32bitConfig-dynamic/lit.site.cfg)
>>> - list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/
>>> 32bitConfig-dynamic)
>>> + list(APPEND ASAN_DYNAMIC_TESTSUITES
>>> + ${CMAKE_CURRENT_BINARY_DIR}/32bitConfig-dynamic)
>>> endif()
>>> endif()
>>> endif() # Not Android
>>>
>>> -if(COMPILER_RT_INCLUDE_TESTS)
>>> - configure_lit_site_cfg(
>>> - ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
>>> - ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg)
>>> -endif()
>>> -
>>> set(ASAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
>>> if(COMPILER_RT_STANDALONE_BUILD)
>>> add_executable(FileCheck IMPORTED GLOBAL)
>>> @@ -144,13 +142,44 @@ if(COMPILER_RT_STANDALONE_BUILD)
>>> else()
>>> list(APPEND ASAN_TEST_DEPS asan)
>>> endif()
>>> +set(ASAN_DYNAMIC_TEST_DEPS ${ASAN_TEST_DEPS})
>>>
>>> -# FIXME: support unit test in the android test runner
>>> -if(COMPILER_RT_INCLUDE_TESTS AND NOT ANDROID)
>>> - list(APPEND ASAN_TEST_DEPS AsanUnitTests)
>>> - list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit)
>>> +# Add unit tests.
>>> +if(COMPILER_RT_INCLUDE_TESTS)
>>> + set(ASAN_TEST_DYNAMIC False)
>>> + configure_lit_site_cfg(
>>> + ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
>>> + ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg)
>>> + if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME)
>>> + set(ASAN_TEST_DYNAMIC True)
>>> + configure_lit_site_cfg(
>>> + ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
>>> + ${CMAKE_CURRENT_BINARY_DIR}/Unit/dynamic/lit.site.cfg)
>>> + endif()
>>> + # FIXME: support unit test in the android test runner
>>> + if (NOT ANDROID)
>>> + list(APPEND ASAN_TEST_DEPS AsanUnitTests)
>>> + list(APPEND ASAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/Unit)
>>> + if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME)
>>> + list(APPEND ASAN_DYNAMIC_TEST_DEPS AsanDynamicUnitTests)
>>> + list(APPEND ASAN_DYNAMIC_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/
>>> Unit/dynamic)
>>> + endif()
>>> + endif()
>>> endif()
>>> +
>>> add_lit_testsuite(check-asan "Running the AddressSanitizer tests"
>>> ${ASAN_TESTSUITES}
>>> DEPENDS ${ASAN_TEST_DEPS})
>>> set_target_properties(check-asan PROPERTIES FOLDER "ASan tests")
>>> +
>>> +if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME)
>>> + # Add check-dynamic-asan target (not included in check-all)
>>> + set(EXCLUDE_FROM_ALL TRUE)
>>> + add_lit_testsuite(check-asan-dynamic
>>> + "Running the AddressSanitizer tests with dynamic
>>> runtime"
>>> + ${ASAN_DYNAMIC_TESTSUITES}
>>> + DEPENDS ${ASAN_DYNAMIC_TEST_DEPS})
>>> + set_target_properties(check-asan-dynamic
>>> + PROPERTIES FOLDER "ASan dynamic tests")
>>> + set(EXCLUDE_FROM_ALL FALSE)
>>> +endif()
>>>
>>> Modified: compiler-rt/trunk/test/asan/Unit/lit.site.cfg.in
>>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/
>>> test/asan/Unit/lit.site.cfg.in?rev=224470&r1=224469&r2=224470&view=diff
>>> ============================================================
>>> ==================
>>> --- compiler-rt/trunk/test/asan/Unit/lit.site.cfg.in (original)
>>> +++ compiler-rt/trunk/test/asan/Unit/lit.site.cfg.in Wed Dec 17
>>> 17:14:01 2014
>>> @@ -17,7 +17,13 @@ config.name = 'AddressSanitizer-Unit'
>>> # Setup test source and exec root. For unit tests, we define
>>> # it as build directory with ASan unit tests.
>>> # FIXME: De-hardcode this path.
>>> -config.test_exec_root = "@COMPILER_RT_BINARY_DIR@/lib/asan/tests"
>>> +if @ASAN_TEST_DYNAMIC@:
>>> + test_dir = "dynamic"
>>> +else:
>>> + test_dir = "default"
>>> +config.test_exec_root = os.path.join("@COMPILER_RT_BINARY_DIR@",
>>> + "lib", "asan", "tests", test_dir)
>>> +
>>> config.test_source_root = config.test_exec_root
>>>
>>> # Set LD_LIBRARY_PATH to pick dynamic runtime up properly.
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>
>>
>
>
> --
> Alexey Samsonov
> vonosmas at gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150204/bf80466a/attachment.html>
More information about the llvm-commits
mailing list