Skip to content

Commit 2a66abb

Browse files
committed
[runtimes] Use a response file for runtimes test suites
We don't know which test suites are going to be included by runtimes builds so we cannot include those before running the sub-build, but that's not possible during the LLVM build configuration. We instead use a response file that's populated by the runtimes build as a level of indirection. This addresses the issue described in: https://discourse.llvm.org/t/cmake-regeneration-is-broken/62788 Differential Revision: https://reviews.llvm.org/D132438
1 parent a4ace22 commit 2a66abb

File tree

3 files changed

+10
-26
lines changed

3 files changed

+10
-26
lines changed

llvm/runtimes/CMakeLists.txt

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,7 @@ function(runtime_default_target)
209209
endforeach()
210210

211211
if(LLVM_INCLUDE_TESTS)
212-
include(${LLVM_BINARY_DIR}/runtimes/Tests.cmake OPTIONAL RESULT_VARIABLE have_tests)
213-
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
214-
if(have_tests)
215-
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_TESTSUITES ${SUB_LIT_TESTSUITES})
216-
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_PARAMS ${SUB_LIT_PARAMS})
217-
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_EXTRA_ARGS ${SUB_LIT_EXTRA_ARGS})
218-
endif()
212+
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_TESTSUITES "@${LLVM_BINARY_DIR}/runtimes/runtimes-bins/lit.tests")
219213
list(APPEND test_targets runtimes-test-depends check-runtimes)
220214
endif()
221215

@@ -291,13 +285,7 @@ function(runtime_register_target name target)
291285
endforeach()
292286

293287
if(LLVM_INCLUDE_TESTS)
294-
include(${LLVM_BINARY_DIR}/runtimes/${name}/Tests.cmake OPTIONAL RESULT_VARIABLE have_tests)
295-
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/${name}/Tests.cmake)
296-
if(have_tests)
297-
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_TESTSUITES ${SUB_LIT_TESTSUITES})
298-
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_PARAMS ${SUB_LIT_PARAMS})
299-
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_EXTRA_ARGS ${SUB_LIT_EXTRA_ARGS})
300-
endif()
288+
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_TESTSUITES "@${LLVM_BINARY_DIR}/runtimes/runtimes-${name}-bins/lit.tests")
301289
set(runtimes-test-depends-${name} runtimes-test-depends)
302290
set(check-runtimes-${name} check-runtimes)
303291
list(APPEND ${name}_test_targets runtimes-test-depends-${name} check-runtimes-${name})
@@ -490,5 +478,7 @@ if(runtimes)
490478
foreach(target ${test_targets} ${SUB_CHECK_TARGETS})
491479
add_dependencies(${target} ${RUNTIMES_TEST_DEPENDS})
492480
endforeach()
481+
482+
set_property(GLOBAL APPEND PROPERTY LLVM_ALL_ADDITIONAL_TEST_TARGETS runtimes ${RUNTIMES_TEST_DEPENDS})
493483
endif()
494484
endif()

runtimes/CMakeLists.txt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,12 @@ if(LLVM_INCLUDE_TESTS)
244244
${CMAKE_CURRENT_BINARY_DIR}/llvm-lit)
245245
endif()
246246

247-
if(LLVM_RUNTIMES_TARGET)
248-
configure_file(
249-
${CMAKE_CURRENT_SOURCE_DIR}/Tests.cmake.in
250-
${LLVM_BINARY_DIR}/runtimes/${LLVM_RUNTIMES_TARGET}/Tests.cmake)
251-
else()
252-
configure_file(
253-
${CMAKE_CURRENT_SOURCE_DIR}/Tests.cmake.in
254-
${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
255-
endif()
247+
get_property(LLVM_RUNTIMES_LIT_TESTSUITES GLOBAL PROPERTY LLVM_RUNTIMES_LIT_TESTSUITES)
248+
string(REPLACE ";" "\n" LLVM_RUNTIMES_LIT_TESTSUITES "${LLVM_RUNTIMES_LIT_TESTSUITES}")
249+
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lit.tests ${LLVM_RUNTIMES_LIT_TESTSUITES})
250+
else()
251+
# Create empty files so the parent build can use these unconditionally.
252+
file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/lit.tests)
256253
endif()
257254

258255
get_property(SUB_COMPONENTS GLOBAL PROPERTY SUB_COMPONENTS)

runtimes/Tests.cmake.in

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)