[compiler-rt] r309318 - Revert "[sanitizers] Sanitizer tests CMake clean up"
George Karpenkov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 27 13:44:33 PDT 2017
Author: george.karpenkov
Date: Thu Jul 27 13:44:33 2017
New Revision: 309318
URL: http://llvm.org/viewvc/llvm-project?rev=309318&view=rev
Log:
Revert "[sanitizers] Sanitizer tests CMake clean up"
This reverts commit 0ab44db2aa1cd3710355ad79b04f954ce68c0b3a.
Fails on some bots, reverting until I can fix it.
Modified:
compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
compiler-rt/trunk/lib/asan/tests/CMakeLists.txt
compiler-rt/trunk/lib/interception/tests/CMakeLists.txt
compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
Modified: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake?rev=309318&r1=309317&r2=309318&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake Thu Jul 27 13:44:33 2017
@@ -301,7 +301,10 @@ macro(add_compiler_rt_test test_suite te
if(TEST_SUBDIR)
set(output_bin "${output_bin}/${TEST_SUBDIR}")
endif()
- set(output_bin "${output_bin}/${CMAKE_CFG_INTDIR}/${test_name}")
+ if(CMAKE_CONFIGURATION_TYPES)
+ set(output_bin "${output_bin}/${CMAKE_CFG_INTDIR}")
+ endif()
+ set(output_bin "${output_bin}/${test_name}")
if(MSVC)
set(output_bin "${output_bin}.exe")
endif()
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=309318&r1=309317&r2=309318&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/asan/tests/CMakeLists.txt Thu Jul 27 13:44:33 2017
@@ -129,7 +129,11 @@ append_list_if(ANDROID atomic ASAN_UNITT
# options in ${ARGN}, and add it to the object list.
macro(asan_compile obj_list source arch kind)
get_filename_component(basename ${source} NAME)
- set(output_obj "${CMAKE_CFG_INTDIR}/${obj_list}.${basename}.${arch}${kind}.o")
+ if(CMAKE_CONFIGURATION_TYPES)
+ set(output_obj "${CMAKE_CFG_INTDIR}/${obj_list}.${basename}.${arch}${kind}.o")
+ else()
+ set(output_obj "${obj_list}.${basename}.${arch}${kind}.o")
+ endif()
get_target_flags_for_arch(${arch} TARGET_CFLAGS)
set(COMPILE_DEPS ${ASAN_UNITTEST_HEADERS} ${ASAN_BLACKLIST_FILE})
if(NOT COMPILER_RT_STANDALONE_BUILD)
@@ -152,7 +156,17 @@ macro(add_asan_test test_suite test_name
endif()
if(TEST_WITH_TEST_RUNTIME)
list(APPEND TEST_DEPS ${ASAN_TEST_RUNTIME})
- list(APPEND TEST_OBJECTS $<TARGET_FILE:${ASAN_TEST_RUNTIME}>)
+ if(CMAKE_CONFIGURATION_TYPES)
+ set(configuration_path "${CMAKE_CFG_INTDIR}/")
+ else()
+ set(configuration_path "")
+ endif()
+ if(NOT MSVC)
+ set(asan_test_runtime_path ${configuration_path}lib${ASAN_TEST_RUNTIME}.a)
+ else()
+ set(asan_test_runtime_path ${configuration_path}${ASAN_TEST_RUNTIME}.lib)
+ endif()
+ list(APPEND TEST_OBJECTS ${asan_test_runtime_path})
endif()
add_compiler_rt_test(${test_suite} ${test_name}
SUBDIR ${TEST_SUBDIR}
@@ -231,7 +245,13 @@ macro(add_asan_tests_for_arch_and_kind a
endif()
# Create the 'default' folder where ASAN tests are produced.
- file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/default/${CMAKE_CFG_INTDIR}")
+ if(CMAKE_CONFIGURATION_TYPES)
+ foreach(build_mode ${CMAKE_CONFIGURATION_TYPES})
+ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/default/${build_mode}")
+ endforeach()
+ else()
+ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/default")
+ endif()
add_asan_test(AsanUnitTests "Asan-${arch}${kind}-Test"
${arch} ${kind} SUBDIR "default"
@@ -239,7 +259,13 @@ macro(add_asan_tests_for_arch_and_kind a
LINK_FLAGS ${ASAN_UNITTEST_INSTRUMENTED_LINK_FLAGS})
if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME)
# Create the 'dynamic' folder where ASAN tests are produced.
- file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dynamic/${CMAKE_CFG_INTDIR}")
+ if(CMAKE_CONFIGURATION_TYPES)
+ foreach(build_mode ${CMAKE_CONFIGURATION_TYPES})
+ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dynamic/${build_mode}")
+ endforeach()
+ else()
+ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dynamic")
+ endif()
add_asan_test(AsanDynamicUnitTests "Asan-${arch}${kind}-Dynamic-Test"
${arch} ${kind} SUBDIR "dynamic"
Modified: compiler-rt/trunk/lib/interception/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/interception/tests/CMakeLists.txt?rev=309318&r1=309317&r2=309318&view=diff
==============================================================================
--- compiler-rt/trunk/lib/interception/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/interception/tests/CMakeLists.txt Thu Jul 27 13:44:33 2017
@@ -74,7 +74,16 @@ function(get_interception_lib_for_arch a
set(tgt_name "RTInterception.test.${arch}")
endif()
set(${lib} "${tgt_name}" PARENT_SCOPE)
- set(${lib_name} $<TARGET_FILE:${tgt_name}> PARENT_SCOPE)
+ if(CMAKE_CONFIGURATION_TYPES)
+ set(configuration_path "${CMAKE_CFG_INTDIR}/")
+ else()
+ set(configuration_path "")
+ endif()
+ if(NOT MSVC)
+ set(${lib_name} "${configuration_path}lib${tgt_name}.a" PARENT_SCOPE)
+ else()
+ set(${lib_name} "${configuration_path}${tgt_name}.lib" PARENT_SCOPE)
+ endif()
endfunction()
# Interception unit tests testsuite.
@@ -94,7 +103,11 @@ macro(add_interception_tests_for_arch ar
set(INTERCEPTION_TEST_OBJECTS)
foreach(source ${INTERCEPTION_TEST_SOURCES})
get_filename_component(basename ${source} NAME)
- set(output_obj "${CMAKE_CFG_INTDIR}/${basename}.${arch}.o")
+ if(CMAKE_CONFIGURATION_TYPES)
+ set(output_obj "${CMAKE_CFG_INTDIR}/${basename}.${arch}.o")
+ else()
+ set(output_obj "${basename}.${arch}.o")
+ endif()
clang_compile(${output_obj} ${source}
CFLAGS ${INTERCEPTION_TEST_CFLAGS_COMMON} ${TARGET_FLAGS}
DEPS ${INTERCEPTION_TEST_COMPILE_DEPS})
Modified: compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt?rev=309318&r1=309317&r2=309318&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt Thu Jul 27 13:44:33 2017
@@ -127,7 +127,16 @@ function(get_sanitizer_common_lib_for_ar
set(tgt_name "RTSanitizerCommon.test.${arch}")
endif()
set(${lib} "${tgt_name}" PARENT_SCOPE)
- set(${lib_name} $<TARGET_FILE:${tgt_name}> PARENT_SCOPE)
+ if(CMAKE_CONFIGURATION_TYPES)
+ set(configuration_path "${CMAKE_CFG_INTDIR}/")
+ else()
+ set(configuration_path "")
+ endif()
+ if(NOT MSVC)
+ set(${lib_name} "${configuration_path}lib${tgt_name}.a" PARENT_SCOPE)
+ else()
+ set(${lib_name} "${configuration_path}${tgt_name}.lib" PARENT_SCOPE)
+ endif()
endfunction()
# Sanitizer_common unit tests testsuite.
@@ -155,7 +164,11 @@ macro(add_sanitizer_tests_for_arch arch)
set(SANITIZER_TEST_OBJECTS)
foreach(source ${SANITIZER_TEST_SOURCES})
get_filename_component(basename ${source} NAME)
- set(output_obj "${CMAKE_CFG_INTDIR}/${basename}.${arch}.o")
+ if(CMAKE_CONFIGURATION_TYPES)
+ set(output_obj "${CMAKE_CFG_INTDIR}/${basename}.${arch}.o")
+ else()
+ set(output_obj "${basename}.${arch}.o")
+ endif()
clang_compile(${output_obj} ${source}
CFLAGS ${SANITIZER_TEST_CFLAGS_COMMON} ${TARGET_FLAGS}
DEPS ${SANITIZER_TEST_COMPILE_DEPS})
More information about the llvm-commits
mailing list