[libcxx-commits] [PATCH] D132438: [runtimes] Use a response file for runtimes test suites

Petr Hosek via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 22 23:35:00 PDT 2022


phosek created this revision.
phosek added reviewers: smeenai, ldionne.
Herald added a subscriber: mgorny.
Herald added a project: All.
phosek requested review of this revision.
Herald added projects: libc++, libc++abi, LLVM.
Herald added subscribers: llvm-commits, libcxx-commits.
Herald added a reviewer: libc++.
Herald added a reviewer: libc++abi.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132438

Files:
  llvm/runtimes/CMakeLists.txt
  runtimes/CMakeLists.txt
  runtimes/Tests.cmake.in


Index: runtimes/Tests.cmake.in
===================================================================
--- runtimes/Tests.cmake.in
+++ /dev/null
@@ -1,3 +0,0 @@
-set(SUB_LIT_TESTSUITES @LLVM_RUNTIMES_LIT_TESTSUITES@)
-set(SUB_LIT_PARAMS @LLVM_RUNTIMES_LIT_PARAMS@)
-set(SUB_LIT_EXTRA_ARGS @LLVM_RUNTIMES_LIT_EXTRA_ARGS@)
Index: runtimes/CMakeLists.txt
===================================================================
--- runtimes/CMakeLists.txt
+++ runtimes/CMakeLists.txt
@@ -244,14 +244,12 @@
                      ${CMAKE_CURRENT_BINARY_DIR}/llvm-lit)
   endif()
 
+  get_property(LLVM_RUNTIMES_LIT_TESTSUITES GLOBAL PROPERTY LLVM_RUNTIMES_LIT_TESTSUITES)
+  string(REPLACE ";" "\n" LLVM_RUNTIMES_LIT_TESTSUITES "${LLVM_RUNTIMES_LIT_TESTSUITES}")
   if(LLVM_RUNTIMES_TARGET)
-    configure_file(
-      ${CMAKE_CURRENT_SOURCE_DIR}/Tests.cmake.in
-      ${LLVM_BINARY_DIR}/runtimes/${LLVM_RUNTIMES_TARGET}/Tests.cmake)
+    file(WRITE ${LLVM_BINARY_DIR}/runtimes/${LLVM_RUNTIMES_TARGET}/Tests.rsp ${LLVM_RUNTIMES_LIT_TESTSUITES})
   else()
-    configure_file(
-      ${CMAKE_CURRENT_SOURCE_DIR}/Tests.cmake.in
-      ${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
+    file(WRITE ${LLVM_BINARY_DIR}/runtimes/Tests.rsp ${LLVM_RUNTIMES_LIT_TESTSUITES})
   endif()
 endif()
 
Index: llvm/runtimes/CMakeLists.txt
===================================================================
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -219,13 +219,7 @@
   endforeach()
 
   if(LLVM_INCLUDE_TESTS)
-    include(${LLVM_BINARY_DIR}/runtimes/Tests.cmake OPTIONAL RESULT_VARIABLE have_tests)
-    set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
-    if(have_tests)
-      set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_TESTSUITES ${SUB_LIT_TESTSUITES})
-      set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_PARAMS ${SUB_LIT_PARAMS})
-      set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_EXTRA_ARGS ${SUB_LIT_EXTRA_ARGS})
-    endif()
+    set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_TESTSUITES "@${LLVM_BINARY_DIR}/runtimes/Tests.rsp")
     list(APPEND test_targets runtimes-test-depends check-runtimes)
   endif()
 
@@ -301,13 +295,7 @@
   endforeach()
 
   if(LLVM_INCLUDE_TESTS)
-    include(${LLVM_BINARY_DIR}/runtimes/${name}/Tests.cmake OPTIONAL RESULT_VARIABLE have_tests)
-    set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/${name}/Tests.cmake)
-    if(have_tests)
-      set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_TESTSUITES ${SUB_LIT_TESTSUITES})
-      set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_PARAMS ${SUB_LIT_PARAMS})
-      set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_EXTRA_ARGS ${SUB_LIT_EXTRA_ARGS})
-    endif()
+    set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_TESTSUITES "@${LLVM_BINARY_DIR}/runtimes/${name}/Tests.rsp")
     set(runtimes-test-depends-${name} runtimes-test-depends)
     set(check-runtimes-${name} check-runtimes)
     list(APPEND ${name}_test_targets runtimes-test-depends-${name} check-runtimes-${name})
@@ -500,5 +488,7 @@
     foreach(target ${test_targets} ${SUB_CHECK_TARGETS})
       add_dependencies(${target} ${RUNTIMES_TEST_DEPENDS})
     endforeach()
+
+    set_property(GLOBAL APPEND PROPERTY LLVM_ALL_ADDITIONAL_TEST_TARGETS runtimes ${RUNTIMES_TEST_DEPENDS})
   endif()
 endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132438.454708.patch
Type: text/x-patch
Size: 3365 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220823/15382464/attachment.bin>


More information about the libcxx-commits mailing list