[runtimes] Reintroduce a way to select the compiler used for the test suite (#93542)

A while back, the cxx_under_test Lit parameter was removed. This patch
reintroduces a Lit parameter called "compiler" which controls the value
of the %{cxx} substitution used in the test suite.

To run the test suite with a different compiler, one can now pass
--param compiler=<path>.
This commit is contained in:
Louis Dionne 2024-05-28 18:29:47 -07:00 committed by GitHub
parent 04f01a2b9c
commit 633ea41b54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 14 additions and 5 deletions

View File

@ -16,6 +16,8 @@ endif()
set(AUTO_GEN_COMMENT "## Autogenerated by libcxx configuration.\n# Do not edit!")
set(SERIALIZED_LIT_PARAMS "# Lit parameters serialized here for llvm-lit to pick them up\n")
serialize_lit_string_param(SERIALIZED_LIT_PARAMS compiler "${CMAKE_CXX_COMPILER}")
if (NOT LIBCXX_ENABLE_EXCEPTIONS)
serialize_lit_param(SERIALIZED_LIT_PARAMS enable_exceptions False)
endif()

View File

@ -23,8 +23,6 @@ config.recursiveExpansionLimit = 10
config.test_exec_root = os.path.join('@CMAKE_BINARY_DIR@', 'test')
# Add substitutions for bootstrapping the test suite configuration
import shlex
config.substitutions.append(('%{cxx}', shlex.quote('@CMAKE_CXX_COMPILER@')))
config.substitutions.append(('%{libcxx-dir}', '@LIBCXX_SOURCE_DIR@'))
config.substitutions.append(('%{include-dir}', '@LIBCXX_GENERATED_INCLUDE_DIR@'))
config.substitutions.append(('%{target-include-dir}', '@LIBCXX_GENERATED_INCLUDE_TARGET_DIR@'))

View File

@ -143,6 +143,14 @@ def getSuitableClangTidy(cfg):
# fmt: off
DEFAULT_PARAMETERS = [
Parameter(
name="compiler",
type=str,
help="The path of the compiler to use for testing.",
actions=lambda cxx: [
AddSubstitution("%{cxx}", shlex.quote(cxx)),
],
),
Parameter(
name="target_triple",
type=str,

View File

@ -24,6 +24,8 @@ endif()
set(AUTO_GEN_COMMENT "## Autogenerated by libcxxabi configuration.\n# Do not edit!")
set(SERIALIZED_LIT_PARAMS "# Lit parameters serialized here for llvm-lit to pick them up\n")
serialize_lit_string_param(SERIALIZED_LIT_PARAMS compiler "${CMAKE_CXX_COMPILER}")
if (NOT LIBCXXABI_ENABLE_EXCEPTIONS)
serialize_lit_param(SERIALIZED_LIT_PARAMS enable_exceptions False)
endif()

View File

@ -26,7 +26,6 @@ config.test_exec_root = os.path.join('@CMAKE_BINARY_DIR@', 'test')
# TODO: This is a non-standard Lit attribute and we should have another way of accessing this.
config.host_triple = '@LLVM_HOST_TRIPLE@'
config.substitutions.append(('%{cxx}', '@CMAKE_CXX_COMPILER@'))
config.substitutions.append(('%{libcxx}', '@LIBCXXABI_LIBCXX_PATH@'))
config.substitutions.append(('%{include}', '@LIBCXXABI_SOURCE_DIR@/include'))
config.substitutions.append(('%{cxx-include}', '@LIBCXXABI_HEADER_DIR@/include/c++/v1'))

View File

@ -15,6 +15,8 @@ pythonize_bool(LIBUNWIND_USES_ARM_EHABI)
set(AUTO_GEN_COMMENT "## Autogenerated by libunwind configuration.\n# Do not edit!")
set(SERIALIZED_LIT_PARAMS "# Lit parameters serialized here for llvm-lit to pick them up\n")
serialize_lit_string_param(SERIALIZED_LIT_PARAMS compiler "${CMAKE_CXX_COMPILER}")
if (LIBUNWIND_EXECUTOR)
message(DEPRECATION "LIBUNWIND_EXECUTOR is deprecated, please add executor=... to LIBUNWIND_TEST_PARAMS")
serialize_lit_string_param(SERIALIZED_LIT_PARAMS executor "${LIBUNWIND_EXECUTOR}")

View File

@ -29,7 +29,5 @@ if not @LIBUNWIND_ENABLE_THREADS@:
config.available_features.add('libunwind-no-threads')
# Add substitutions for bootstrapping the test suite configuration
import shlex
config.substitutions.append(('%{cxx}', shlex.quote('@CMAKE_CXX_COMPILER@')))
config.substitutions.append(('%{include}', '@LIBUNWIND_SOURCE_DIR@/include'))
config.substitutions.append(('%{lib}', '@LIBUNWIND_LIBRARY_DIR@'))