[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.

GitOrigin-RevId: 6f69318c7248275b509ecf0f88eb2ba725aaeb82
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b6f1f08..8881a50 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -137,6 +137,8 @@
 
 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
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index b942b9c..8dcd65d 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -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)
@@ -76,6 +76,7 @@
   ${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}")