Skip to content

Commit 6f69318

Browse files
committed
[runtimes] Allow passing Lit parameters through CMake
This allows passing parameters to the test suites without using LLVM_LIT_ARGS. The problem is that we sometimes want to set some Lit arguments on the CMake command line, but the Lit parameters in a CMake cache file. If the only knob to do that is LLVM_LIT_ARGS, the command-line entry overrides the cache one, and the parameters set by the cache are ignored. This fixes a current issue with the build bots that they completely ignore the 'std' param set by Lit, because other Lit arguments are provided via LLVM_LIT_ARGS on the CMake command-line.
1 parent 5ab446c commit 6f69318

File tree

9 files changed

+22
-11
lines changed

9 files changed

+22
-11
lines changed

libcxx/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ option(LIBCXX_ENABLE_PARALLEL_ALGORITHMS "Enable the parallel algorithms library
111111
option(LIBCXX_TEST_GDB_PRETTY_PRINTERS "Test gdb pretty printers." OFF)
112112
set(LIBCXX_TEST_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/test/lit.site.cfg.in" CACHE STRING
113113
"The Lit testing configuration to use when running the tests.")
114+
set(LIBCXX_TEST_PARAMS "" CACHE STRING
115+
"A list of parameters to run the Lit test suite with.")
114116

115117
# Benchmark options -----------------------------------------------------------
116118
option(LIBCXX_INCLUDE_BENCHMARKS "Build the libc++ benchmarks and their dependencies" ON)
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
set(LLVM_LIT_ARGS "--param std=c++03" CACHE STRING "")
1+
set(LIBCXX_TEST_PARAMS "std=c++03" CACHE STRING "")
2+
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
set(LLVM_LIT_ARGS "--param std=c++11" CACHE STRING "")
1+
set(LIBCXX_TEST_PARAMS "std=c++11" CACHE STRING "")
2+
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
set(LLVM_LIT_ARGS "--param std=c++14" CACHE STRING "")
1+
set(LIBCXX_TEST_PARAMS "std=c++14" CACHE STRING "")
2+
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
set(LLVM_LIT_ARGS "--param std=c++17" CACHE STRING "")
1+
set(LIBCXX_TEST_PARAMS "std=c++17" CACHE STRING "")
2+
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
set(LLVM_LIT_ARGS "--param std=c++2a" CACHE STRING "")
1+
set(LIBCXX_TEST_PARAMS "std=c++2a" CACHE STRING "")
2+
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")

libcxx/test/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ if(LIBCXX_TEST_GDB_PRETTY_PRINTERS)
103103
endif()
104104

105105
if (LIBCXX_INCLUDE_TESTS)
106-
include(AddLLVM) # for configure_lit_site_cfg and add_lit_testsuite
106+
include(AddLLVM) # for configure_lit_site_cfg and add_lit_target
107107

108108
configure_lit_site_cfg(
109109
"${LIBCXX_TEST_CONFIG}"
@@ -114,10 +114,11 @@ if (LIBCXX_INCLUDE_TESTS)
114114
DEPENDS cxx ${LIBCXX_TEST_DEPS}
115115
COMMENT "Builds dependencies required to run the test suite.")
116116

117-
add_lit_testsuite(check-cxx
117+
add_lit_target(check-cxx
118118
"Running libcxx tests"
119119
${CMAKE_CURRENT_BINARY_DIR}
120-
DEPENDS check-cxx-deps)
120+
DEPENDS check-cxx-deps
121+
PARAMS "${LIBCXX_TEST_PARAMS}")
121122
endif()
122123

123124
if (LIBCXX_GENERATE_COVERAGE)

libcxxabi/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ option(LIBCXXABI_HERMETIC_STATIC_LIBRARY
137137

138138
set(LIBCXXABI_TEST_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/test/lit.site.cfg.in" CACHE STRING
139139
"The Lit testing configuration to use when running the tests.")
140+
set(LIBCXXABI_TEST_PARAMS "" CACHE STRING
141+
"A list of parameters to run the Lit test suite with.")
140142

141143
#===============================================================================
142144
# Configure System

libcxxabi/test/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include(AddLLVM) # for add_lit_testsuite
1+
include(AddLLVM) # for configure_lit_site_cfg and add_lit_target
22
macro(pythonize_bool var)
33
if (${var})
44
set(${var} True)
@@ -76,6 +76,7 @@ configure_lit_site_cfg(
7676
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
7777
MAIN_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py")
7878

79-
add_lit_testsuite(check-cxxabi "Running libcxxabi tests"
79+
add_lit_target(check-cxxabi "Running libcxxabi tests"
8080
${CMAKE_CURRENT_BINARY_DIR}
81-
DEPENDS ${LIBCXXABI_TEST_DEPS})
81+
DEPENDS ${LIBCXXABI_TEST_DEPS}
82+
PARAMS "${LIBCXXABI_TEST_PARAMS}")

0 commit comments

Comments
 (0)