Skip to content

Commit

Permalink
[runtimes] Allow passing Lit parameters through CMake
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ldionne committed Jul 9, 2020
1 parent 5ab446c commit 6f69318
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 11 deletions.
2 changes: 2 additions & 0 deletions libcxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ option(LIBCXX_ENABLE_PARALLEL_ALGORITHMS "Enable the parallel algorithms library
option(LIBCXX_TEST_GDB_PRETTY_PRINTERS "Test gdb pretty printers." OFF)
set(LIBCXX_TEST_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/test/lit.site.cfg.in" CACHE STRING
"The Lit testing configuration to use when running the tests.")
set(LIBCXX_TEST_PARAMS "" CACHE STRING
"A list of parameters to run the Lit test suite with.")

# Benchmark options -----------------------------------------------------------
option(LIBCXX_INCLUDE_BENCHMARKS "Build the libc++ benchmarks and their dependencies" ON)
Expand Down
3 changes: 2 additions & 1 deletion libcxx/cmake/caches/Generic-cxx03.cmake
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
set(LLVM_LIT_ARGS "--param std=c++03" CACHE STRING "")
set(LIBCXX_TEST_PARAMS "std=c++03" CACHE STRING "")
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
3 changes: 2 additions & 1 deletion libcxx/cmake/caches/Generic-cxx11.cmake
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
set(LLVM_LIT_ARGS "--param std=c++11" CACHE STRING "")
set(LIBCXX_TEST_PARAMS "std=c++11" CACHE STRING "")
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
3 changes: 2 additions & 1 deletion libcxx/cmake/caches/Generic-cxx14.cmake
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
set(LLVM_LIT_ARGS "--param std=c++14" CACHE STRING "")
set(LIBCXX_TEST_PARAMS "std=c++14" CACHE STRING "")
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
3 changes: 2 additions & 1 deletion libcxx/cmake/caches/Generic-cxx17.cmake
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
set(LLVM_LIT_ARGS "--param std=c++17" CACHE STRING "")
set(LIBCXX_TEST_PARAMS "std=c++17" CACHE STRING "")
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
3 changes: 2 additions & 1 deletion libcxx/cmake/caches/Generic-cxx2a.cmake
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
set(LLVM_LIT_ARGS "--param std=c++2a" CACHE STRING "")
set(LIBCXX_TEST_PARAMS "std=c++2a" CACHE STRING "")
set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "")
7 changes: 4 additions & 3 deletions libcxx/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ if(LIBCXX_TEST_GDB_PRETTY_PRINTERS)
endif()

if (LIBCXX_INCLUDE_TESTS)
include(AddLLVM) # for configure_lit_site_cfg and add_lit_testsuite
include(AddLLVM) # for configure_lit_site_cfg and add_lit_target

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

add_lit_testsuite(check-cxx
add_lit_target(check-cxx
"Running libcxx tests"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS check-cxx-deps)
DEPENDS check-cxx-deps
PARAMS "${LIBCXX_TEST_PARAMS}")
endif()

if (LIBCXX_GENERATE_COVERAGE)
Expand Down
2 changes: 2 additions & 0 deletions libcxxabi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ option(LIBCXXABI_HERMETIC_STATIC_LIBRARY

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

#===============================================================================
# Configure System
Expand Down
7 changes: 4 additions & 3 deletions libcxxabi/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include(AddLLVM) # for add_lit_testsuite
include(AddLLVM) # for configure_lit_site_cfg and add_lit_target
macro(pythonize_bool var)
if (${var})
set(${var} True)
Expand Down Expand Up @@ -76,6 +76,7 @@ configure_lit_site_cfg(
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
MAIN_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py")

add_lit_testsuite(check-cxxabi "Running libcxxabi tests"
add_lit_target(check-cxxabi "Running libcxxabi tests"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${LIBCXXABI_TEST_DEPS})
DEPENDS ${LIBCXXABI_TEST_DEPS}
PARAMS "${LIBCXXABI_TEST_PARAMS}")

0 comments on commit 6f69318

Please sign in to comment.