[libcxx-commits] [libcxxabi] 0c3401c - [runtimes] Serialize all Lit params instead of passing them to add_lit_testsuite

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 15 04:53:32 PDT 2021


Author: Louis Dionne
Date: 2021-07-15T07:53:15-04:00
New Revision: 0c3401c86e82cb5d8ba0c9dec6573473e505c5fc

URL: https://github.com/llvm/llvm-project/commit/0c3401c86e82cb5d8ba0c9dec6573473e505c5fc
DIFF: https://github.com/llvm/llvm-project/commit/0c3401c86e82cb5d8ba0c9dec6573473e505c5fc.diff

LOG: [runtimes] Serialize all Lit params instead of passing them to add_lit_testsuite

add_lit_testsuite() takes Lit parameters passed to it and adds them
to the parameters used globally when running all test suites. That
means that a target like `check-all`, which ends up calling Lit on
the whole monorepo, will see the test parameters for all the individual
project's test suites.

So, for example, it would see `--param std=c++03` (from libc++abi), and
`--param std=c++03` (from libc++), and `--param whatever` (from another
project being tested at the same time). While always unclean, that works
when the parameters all agree. However, if the parameters share the same
name but have different values, only one of those two values will be used
and it will be incredibly confusing to understand why one of the test
suites is being run with the incorrect parameter value.

For that reason, this commit moves away from using add_lit_testsuite()'s
PARAM functionality, and serializes the parameter values for the runtimes
in the generated config.py file instead, which is local to the specific
test suite.

Differential Revision: https://reviews.llvm.org/D105991

Added: 
    

Modified: 
    libcxx/test/CMakeLists.txt
    libcxxabi/test/CMakeLists.txt
    libunwind/test/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index 0252ff42963f..df16ab574f67 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -117,6 +117,12 @@ if (LIBCXX_BUILD_32_BITS)
   serialize_lit_param(enable_32bit True)
 endif()
 
+foreach(param IN LISTS LIBCXX_TEST_PARAMS)
+  string(REGEX REPLACE "(.+)=(.+)" "\\1" name "${param}")
+  string(REGEX REPLACE "(.+)=(.+)" "\\2" value "${param}")
+  serialize_lit_param("${name}" "\"${value}\"")
+endforeach()
+
 if (NOT DEFINED LIBCXX_TEST_DEPS)
   message(FATAL_ERROR "Expected LIBCXX_TEST_DEPS to be defined")
 endif()
@@ -136,8 +142,7 @@ if (LIBCXX_INCLUDE_TESTS)
   add_lit_testsuite(check-cxx
     "Running libcxx tests"
     ${CMAKE_CURRENT_BINARY_DIR}
-    DEPENDS cxx-test-depends
-    PARAMS "${LIBCXX_TEST_PARAMS}")
+    DEPENDS cxx-test-depends)
 endif()
 
 if (LIBCXX_GENERATE_COVERAGE)

diff  --git a/libcxxabi/test/CMakeLists.txt b/libcxxabi/test/CMakeLists.txt
index 788fd5a448bb..526e85204103 100644
--- a/libcxxabi/test/CMakeLists.txt
+++ b/libcxxabi/test/CMakeLists.txt
@@ -94,6 +94,12 @@ if (LIBCXXABI_BUILD_32_BITS)
   serialize_lit_param(enable_32bit True)
 endif()
 
+foreach(param IN LISTS LIBCXXABI_TEST_PARAMS)
+  string(REGEX REPLACE "(.+)=(.+)" "\\1" name "${param}")
+  string(REGEX REPLACE "(.+)=(.+)" "\\2" value "${param}")
+  serialize_lit_param("${name}" "\"${value}\"")
+endforeach()
+
 configure_lit_site_cfg(
   "${LIBCXXABI_TEST_CONFIG}"
   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
@@ -101,5 +107,4 @@ configure_lit_site_cfg(
 
 add_lit_testsuite(check-cxxabi "Running libcxxabi tests"
   ${CMAKE_CURRENT_BINARY_DIR}
-  DEPENDS ${LIBCXXABI_TEST_DEPS}
-  PARAMS "${LIBCXXABI_TEST_PARAMS}")
+  DEPENDS ${LIBCXXABI_TEST_DEPS})

diff  --git a/libunwind/test/CMakeLists.txt b/libunwind/test/CMakeLists.txt
index 5be44e566b6c..8e7fa4427104 100644
--- a/libunwind/test/CMakeLists.txt
+++ b/libunwind/test/CMakeLists.txt
@@ -44,6 +44,12 @@ if (LIBUNWIND_BUILD_32_BITS)
   serialize_lit_param(enable_32bit True)
 endif()
 
+foreach(param IN LISTS LIBUNWIND_TEST_PARAMS)
+  string(REGEX REPLACE "(.+)=(.+)" "\\1" name "${param}")
+  string(REGEX REPLACE "(.+)=(.+)" "\\2" value "${param}")
+  serialize_lit_param("${name}" "\"${value}\"")
+endforeach()
+
 configure_lit_site_cfg(
   "${LIBUNWIND_TEST_CONFIG}"
   ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
@@ -51,5 +57,4 @@ configure_lit_site_cfg(
 
 add_lit_testsuite(check-unwind "Running libunwind tests"
   ${CMAKE_CURRENT_BINARY_DIR}
-  DEPENDS unwind ${LIBUNWIND_TEST_DEPS}
-  PARAMS "${LIBUNWIND_TEST_PARAMS}")
+  DEPENDS unwind ${LIBUNWIND_TEST_DEPS})


        


More information about the libcxx-commits mailing list