[libcxx-commits] [PATCH] D121276: [CMake] Include runtimes test suites in check-all

Petr Hosek via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 9 00:56:48 PST 2022


phosek created this revision.
phosek added reviewers: ldionne, beanz, smeenai, tstellar.
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.

Prior to this change, we would make check-all depend on check-runtimes
which is a target that runs tests in the runtimes build. This means that
the runtimes tests are going to run prior to other test suites in
check-all, and if one of them fails, we won't run the other test suites
at all.

      

To address this issue, we instead collect the list of test suites and
their dependencies from the runtimes subbuild, and include them in
check-all, so a failure of runtimes test suite doesn't prevent other
test suites from being executed.

      

This addresses https://github.com/llvm/llvm-project/issues/54154.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121276

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


Index: runtimes/Tests.cmake.in
===================================================================
--- /dev/null
+++ runtimes/Tests.cmake.in
@@ -0,0 +1,4 @@
+set(RUNTIMES_LIT_TESTSUITES @RUNTIMES_LIT_TESTSUITES@)
+set(RUNTIMES_LIT_PARAMS @RUNTIMES_LIT_PARAMS@)
+set(RUNTIMES_LIT_DEPENDS @RUNTIMES_LIT_DEPENDS@)
+set(RUNTIMES_LIT_EXTRA_ARGS @RUNTIMES_LIT_EXTRA_ARGS@)
Index: runtimes/CMakeLists.txt
===================================================================
--- runtimes/CMakeLists.txt
+++ runtimes/CMakeLists.txt
@@ -229,7 +229,6 @@
     DEPENDS ${RUNTIMES_LIT_DEPENDS}
     ARGS ${RUNTIMES_LIT_EXTRA_ARGS}
     )
-  add_custom_target(runtimes-test-depends DEPENDS ${RUNTIMES_LIT_DEPENDS})
 
   if (NOT HAVE_LLVM_LIT)
     # If built by manually invoking cmake on this directory, we don't have
@@ -238,6 +237,16 @@
     add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/llvm-lit
                      ${CMAKE_CURRENT_BINARY_DIR}/llvm-lit)
   endif()
+
+  if(LLVM_RUNTIMES_TARGET)
+    configure_file(
+      ${CMAKE_CURRENT_SOURCE_DIR}/Tests.cmake.in
+      ${LLVM_BINARY_DIR}/runtimes/${LLVM_RUNTIMES_TARGET}/Tests.cmake)
+  else()
+    configure_file(
+      ${CMAKE_CURRENT_SOURCE_DIR}/Tests.cmake.in
+      ${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
+  endif()
 endif()
 
 get_property(SUB_COMPONENTS GLOBAL PROPERTY SUB_COMPONENTS)
Index: llvm/runtimes/CMakeLists.txt
===================================================================
--- llvm/runtimes/CMakeLists.txt
+++ llvm/runtimes/CMakeLists.txt
@@ -220,7 +220,21 @@
   endforeach()
 
   if(LLVM_INCLUDE_TESTS)
-    list(APPEND test_targets runtimes-test-depends check-runtimes)
+    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_LIT_TESTSUITES ${RUNTIMES_LIT_TESTSUITES})
+      set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${RUNTIMES_LIT_PARAMS})
+      foreach(target_name IN LISTS ${RUNTIMES_LIT_DEPENDS})
+        list(APPEND _runtimes_lit_depends ${target_name})
+        if(NOT target_name IN_LIST extra_targets)
+          list(APPEND test_targets ${target_name})
+        endif()
+      endforeach()
+      set_property(GLOBAL APPEND PROPERTY LLVM_LIT_DEPENDS ${_runtimes_lit_depends})
+      set_property(GLOBAL APPEND PROPERTY LLVM_LIT_EXTRA_ARGS ${RUNTIMES_LIT_EXTRA_ARGS})
+    endif()
+    list(APPEND test_targets check-runtimes)
   endif()
 
   set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default ON)
@@ -296,6 +310,21 @@
   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_LIT_TESTSUITES ${RUNTIMES_LIT_TESTSUITES})
+      set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${RUNTIMES_LIT_PARAMS})
+      foreach(target_name IN LISTS ${RUNTIMES_LIT_DEPENDS})
+        set(${target_name}-${name} ${target_name})
+        list(APPEND _runtimes_lit_depends ${target_name}-${name})
+        if(NOT target_name IN_LIST extra_targets)
+          list(APPEND test_targets ${target_name}-${name})
+        endif()
+      endforeach()
+      set_property(GLOBAL APPEND PROPERTY LLVM_LIT_DEPENDS ${_runtimes_lit_depends})
+      set_property(GLOBAL APPEND PROPERTY LLVM_LIT_EXTRA_ARGS ${RUNTIMES_LIT_EXTRA_ARGS})
+    endif()
     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})
@@ -467,9 +496,6 @@
   endif()
 
   if(LLVM_INCLUDE_TESTS)
-    set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_DEPENDS runtimes-test-depends)
-    set_property(GLOBAL APPEND PROPERTY LLVM_ADDITIONAL_TEST_TARGETS check-runtimes)
-
     set(RUNTIMES_TEST_DEPENDS
         FileCheck
         count


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121276.414028.patch
Type: text/x-patch
Size: 4096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220309/e86bd851/attachment.bin>


More information about the libcxx-commits mailing list