Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Commit 3d7f9b6

Browse files
author
George Karpenkov
committed
Revert "[sanitizers] Sanitizer tests CMake clean up"
This reverts commit 0ab44db2aa1cd3710355ad79b04f954ce68c0b3a. Fails on some bots, reverting until I can fix it. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309318 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent fa4969a commit 3d7f9b6

File tree

4 files changed

+64
-9
lines changed

4 files changed

+64
-9
lines changed

cmake/Modules/AddCompilerRT.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,10 @@ macro(add_compiler_rt_test test_suite test_name)
301301
if(TEST_SUBDIR)
302302
set(output_bin "${output_bin}/${TEST_SUBDIR}")
303303
endif()
304-
set(output_bin "${output_bin}/${CMAKE_CFG_INTDIR}/${test_name}")
304+
if(CMAKE_CONFIGURATION_TYPES)
305+
set(output_bin "${output_bin}/${CMAKE_CFG_INTDIR}")
306+
endif()
307+
set(output_bin "${output_bin}/${test_name}")
305308
if(MSVC)
306309
set(output_bin "${output_bin}.exe")
307310
endif()

lib/asan/tests/CMakeLists.txt

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ append_list_if(ANDROID atomic ASAN_UNITTEST_NOINST_LIBS)
129129
# options in ${ARGN}, and add it to the object list.
130130
macro(asan_compile obj_list source arch kind)
131131
get_filename_component(basename ${source} NAME)
132-
set(output_obj "${CMAKE_CFG_INTDIR}/${obj_list}.${basename}.${arch}${kind}.o")
132+
if(CMAKE_CONFIGURATION_TYPES)
133+
set(output_obj "${CMAKE_CFG_INTDIR}/${obj_list}.${basename}.${arch}${kind}.o")
134+
else()
135+
set(output_obj "${obj_list}.${basename}.${arch}${kind}.o")
136+
endif()
133137
get_target_flags_for_arch(${arch} TARGET_CFLAGS)
134138
set(COMPILE_DEPS ${ASAN_UNITTEST_HEADERS} ${ASAN_BLACKLIST_FILE})
135139
if(NOT COMPILER_RT_STANDALONE_BUILD)
@@ -152,7 +156,17 @@ macro(add_asan_test test_suite test_name arch kind)
152156
endif()
153157
if(TEST_WITH_TEST_RUNTIME)
154158
list(APPEND TEST_DEPS ${ASAN_TEST_RUNTIME})
155-
list(APPEND TEST_OBJECTS $<TARGET_FILE:${ASAN_TEST_RUNTIME}>)
159+
if(CMAKE_CONFIGURATION_TYPES)
160+
set(configuration_path "${CMAKE_CFG_INTDIR}/")
161+
else()
162+
set(configuration_path "")
163+
endif()
164+
if(NOT MSVC)
165+
set(asan_test_runtime_path ${configuration_path}lib${ASAN_TEST_RUNTIME}.a)
166+
else()
167+
set(asan_test_runtime_path ${configuration_path}${ASAN_TEST_RUNTIME}.lib)
168+
endif()
169+
list(APPEND TEST_OBJECTS ${asan_test_runtime_path})
156170
endif()
157171
add_compiler_rt_test(${test_suite} ${test_name}
158172
SUBDIR ${TEST_SUBDIR}
@@ -231,15 +245,27 @@ macro(add_asan_tests_for_arch_and_kind arch kind)
231245
endif()
232246

233247
# Create the 'default' folder where ASAN tests are produced.
234-
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/default/${CMAKE_CFG_INTDIR}")
248+
if(CMAKE_CONFIGURATION_TYPES)
249+
foreach(build_mode ${CMAKE_CONFIGURATION_TYPES})
250+
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/default/${build_mode}")
251+
endforeach()
252+
else()
253+
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/default")
254+
endif()
235255

236256
add_asan_test(AsanUnitTests "Asan-${arch}${kind}-Test"
237257
${arch} ${kind} SUBDIR "default"
238258
OBJECTS ${ASAN_INST_TEST_OBJECTS}
239259
LINK_FLAGS ${ASAN_UNITTEST_INSTRUMENTED_LINK_FLAGS})
240260
if(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME)
241261
# Create the 'dynamic' folder where ASAN tests are produced.
242-
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dynamic/${CMAKE_CFG_INTDIR}")
262+
if(CMAKE_CONFIGURATION_TYPES)
263+
foreach(build_mode ${CMAKE_CONFIGURATION_TYPES})
264+
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dynamic/${build_mode}")
265+
endforeach()
266+
else()
267+
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/dynamic")
268+
endif()
243269

244270
add_asan_test(AsanDynamicUnitTests "Asan-${arch}${kind}-Dynamic-Test"
245271
${arch} ${kind} SUBDIR "dynamic"

lib/interception/tests/CMakeLists.txt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,16 @@ function(get_interception_lib_for_arch arch lib lib_name)
7474
set(tgt_name "RTInterception.test.${arch}")
7575
endif()
7676
set(${lib} "${tgt_name}" PARENT_SCOPE)
77-
set(${lib_name} $<TARGET_FILE:${tgt_name}> PARENT_SCOPE)
77+
if(CMAKE_CONFIGURATION_TYPES)
78+
set(configuration_path "${CMAKE_CFG_INTDIR}/")
79+
else()
80+
set(configuration_path "")
81+
endif()
82+
if(NOT MSVC)
83+
set(${lib_name} "${configuration_path}lib${tgt_name}.a" PARENT_SCOPE)
84+
else()
85+
set(${lib_name} "${configuration_path}${tgt_name}.lib" PARENT_SCOPE)
86+
endif()
7887
endfunction()
7988

8089
# Interception unit tests testsuite.
@@ -94,7 +103,11 @@ macro(add_interception_tests_for_arch arch)
94103
set(INTERCEPTION_TEST_OBJECTS)
95104
foreach(source ${INTERCEPTION_TEST_SOURCES})
96105
get_filename_component(basename ${source} NAME)
97-
set(output_obj "${CMAKE_CFG_INTDIR}/${basename}.${arch}.o")
106+
if(CMAKE_CONFIGURATION_TYPES)
107+
set(output_obj "${CMAKE_CFG_INTDIR}/${basename}.${arch}.o")
108+
else()
109+
set(output_obj "${basename}.${arch}.o")
110+
endif()
98111
clang_compile(${output_obj} ${source}
99112
CFLAGS ${INTERCEPTION_TEST_CFLAGS_COMMON} ${TARGET_FLAGS}
100113
DEPS ${INTERCEPTION_TEST_COMPILE_DEPS})

lib/sanitizer_common/tests/CMakeLists.txt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,16 @@ function(get_sanitizer_common_lib_for_arch arch lib lib_name)
127127
set(tgt_name "RTSanitizerCommon.test.${arch}")
128128
endif()
129129
set(${lib} "${tgt_name}" PARENT_SCOPE)
130-
set(${lib_name} $<TARGET_FILE:${tgt_name}> PARENT_SCOPE)
130+
if(CMAKE_CONFIGURATION_TYPES)
131+
set(configuration_path "${CMAKE_CFG_INTDIR}/")
132+
else()
133+
set(configuration_path "")
134+
endif()
135+
if(NOT MSVC)
136+
set(${lib_name} "${configuration_path}lib${tgt_name}.a" PARENT_SCOPE)
137+
else()
138+
set(${lib_name} "${configuration_path}${tgt_name}.lib" PARENT_SCOPE)
139+
endif()
131140
endfunction()
132141

133142
# Sanitizer_common unit tests testsuite.
@@ -155,7 +164,11 @@ macro(add_sanitizer_tests_for_arch arch)
155164
set(SANITIZER_TEST_OBJECTS)
156165
foreach(source ${SANITIZER_TEST_SOURCES})
157166
get_filename_component(basename ${source} NAME)
158-
set(output_obj "${CMAKE_CFG_INTDIR}/${basename}.${arch}.o")
167+
if(CMAKE_CONFIGURATION_TYPES)
168+
set(output_obj "${CMAKE_CFG_INTDIR}/${basename}.${arch}.o")
169+
else()
170+
set(output_obj "${basename}.${arch}.o")
171+
endif()
159172
clang_compile(${output_obj} ${source}
160173
CFLAGS ${SANITIZER_TEST_CFLAGS_COMMON} ${TARGET_FLAGS}
161174
DEPS ${SANITIZER_TEST_COMPILE_DEPS})

0 commit comments

Comments
 (0)