[libcxx-commits] [libcxxabi] 58a2304 - [libc++] Serialize Lit parameters to make them available to from-scratch configs
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 29 07:51:50 PDT 2021
Author: Louis Dionne
Date: 2021-06-29T10:51:42-04:00
New Revision: 58a230455bbc680fc12641d9231dce5dfb907e91
URL: https://github.com/llvm/llvm-project/commit/58a230455bbc680fc12641d9231dce5dfb907e91
DIFF: https://github.com/llvm/llvm-project/commit/58a230455bbc680fc12641d9231dce5dfb907e91.diff
LOG: [libc++] Serialize Lit parameters to make them available to from-scratch configs
Before this patch, Lit parameters that were set as a result of CMake
options were not made available to from-scratch configs. This patch
serializes those parameters into the generated lit config file so that
they are available to all configs.
Differential Revision: https://reviews.llvm.org/D105047
Added:
Modified:
libcxx/test/CMakeLists.txt
libcxx/test/configs/legacy.cfg.in
libcxx/test/configs/libcxx-trunk-shared.cfg.in
libcxx/test/configs/libcxx-trunk-static.cfg.in
libcxxabi/test/CMakeLists.txt
libcxxabi/test/lit.site.cfg.in
libunwind/test/CMakeLists.txt
libunwind/test/libunwind/test/config.py
libunwind/test/lit.site.cfg.in
Removed:
################################################################################
diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index 429b7905fdce..71a7d16772d3 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -55,9 +55,6 @@ if(LIBCXX_INCLUDE_TESTS AND NOT LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXX AND NOT LIB
message(FATAL_ERROR "LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXX being OFF requires LIBCXX_ENABLE_STATIC to be ON")
endif()
-pythonize_bool(LIBCXX_ENABLE_EXCEPTIONS)
-pythonize_bool(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
-pythonize_bool(LIBCXX_ENABLE_RTTI)
pythonize_bool(LIBCXX_ENABLE_SHARED)
pythonize_bool(LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXX)
pythonize_bool(LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXXABI)
@@ -71,7 +68,6 @@ pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
pythonize_bool(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
pythonize_bool(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY)
pythonize_bool(LIBCXX_DEBUG_BUILD)
-pythonize_bool(LIBCXX_ENABLE_DEBUG_MODE_SUPPORT)
pythonize_bool(LIBCXX_ENABLE_PARALLEL_ALGORITHMS)
# By default, for non-standalone builds, libcxx and libcxxabi share a library
@@ -87,6 +83,35 @@ set(LIBCXX_EXECUTOR "\\\"${Python3_EXECUTABLE}\\\" ${CMAKE_CURRENT_LIST_DIR}/../
"Executor to use when running tests.")
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")
+
+macro(serialize_lit_param param value)
+ string(APPEND SERIALIZED_LIT_PARAMS "config.${param} = ${value}\n")
+endmacro()
+
+if (NOT LIBCXX_ENABLE_EXCEPTIONS)
+ serialize_lit_param(enable_exceptions False)
+endif()
+
+if (NOT LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY)
+ serialize_lit_param(enable_experimental False)
+endif()
+
+if (NOT LIBCXX_ENABLE_RTTI)
+ serialize_lit_param(enable_rtti False)
+endif()
+
+if (NOT LIBCXX_ENABLE_DEBUG_MODE_SUPPORT)
+ serialize_lit_param(enable_debug_tests False)
+endif()
+
+if (TARGET_TRIPLE)
+ serialize_lit_param(target_triple "\"${TARGET_TRIPLE}\"")
+endif()
+
+if (LLVM_USE_SANITIZER)
+ serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"")
+endif()
if (NOT DEFINED LIBCXX_TEST_DEPS)
message(FATAL_ERROR "Expected LIBCXX_TEST_DEPS to be defined")
diff --git a/libcxx/test/configs/legacy.cfg.in b/libcxx/test/configs/legacy.cfg.in
index f9737e85e0dc..adb813644fec 100644
--- a/libcxx/test/configs/legacy.cfg.in
+++ b/libcxx/test/configs/legacy.cfg.in
@@ -1,5 +1,7 @@
@AUTO_GEN_COMMENT@
+ at SERIALIZED_LIT_PARAMS@
+
import os
import site
@@ -10,18 +12,11 @@ config.libcxx_src_root = "@LIBCXX_SOURCE_DIR@"
config.libcxx_obj_root = "@LIBCXX_BINARY_DIR@"
config.cxx_library_root = "@LIBCXX_LIBRARY_DIR@"
config.abi_library_root = "@LIBCXX_CXX_ABI_LIBRARY_PATH@"
-config.enable_exceptions = @LIBCXX_ENABLE_EXCEPTIONS@
-config.enable_debug_tests = @LIBCXX_ENABLE_DEBUG_MODE_SUPPORT@
-config.enable_experimental = @LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY@
-config.enable_rtti = @LIBCXX_ENABLE_RTTI@
config.enable_shared = @LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXX@
config.enable_32bit = @LIBCXX_BUILD_32_BITS@
config.cxx_abi = "@LIBCXX_CXX_ABI_LIBNAME@"
-config.use_sanitizer = "@LLVM_USE_SANITIZER@"
config.configuration_variant = "@LIBCXX_LIT_VARIANT@"
config.host_triple = "@LLVM_HOST_TRIPLE@"
-if "@TARGET_TRIPLE@":
- config.target_triple = "@TARGET_TRIPLE@"
config.sysroot = "@LIBCXX_SYSROOT@"
config.gcc_toolchain = "@LIBCXX_GCC_TOOLCHAIN@"
config.generate_coverage = @LIBCXX_GENERATE_COVERAGE@
diff --git a/libcxx/test/configs/libcxx-trunk-shared.cfg.in b/libcxx/test/configs/libcxx-trunk-shared.cfg.in
index 127d824f3ecf..4bb4c43dc752 100644
--- a/libcxx/test/configs/libcxx-trunk-shared.cfg.in
+++ b/libcxx/test/configs/libcxx-trunk-shared.cfg.in
@@ -1,11 +1,12 @@
@AUTO_GEN_COMMENT@
+ at SERIALIZED_LIT_PARAMS@
+
LIBCXX_ROOT = "@LIBCXX_SOURCE_DIR@"
INSTALL_ROOT = "@CMAKE_BINARY_DIR@"
COMPILER = "@CMAKE_CXX_COMPILER@"
EXEC_ROOT = "@LIBCXX_BINARY_DIR@"
CMAKE_OSX_SYSROOT = "@CMAKE_OSX_SYSROOT@"
-TARGET_TRIPLE = "@TARGET_TRIPLE@"
import os
import pipes
@@ -23,8 +24,6 @@ config.test_source_root = os.path.join(LIBCXX_ROOT, 'test')
config.test_format = libcxx.test.format.CxxStandardLibraryTest()
config.recursiveExpansionLimit = 10
config.test_exec_root = EXEC_ROOT
-if TARGET_TRIPLE:
- config.target_triple = TARGET_TRIPLE
# Configure basic substitutions
runPy = os.path.join(LIBCXX_ROOT, 'utils', 'run.py')
diff --git a/libcxx/test/configs/libcxx-trunk-static.cfg.in b/libcxx/test/configs/libcxx-trunk-static.cfg.in
index 4a6b4f19ec45..5a111e05fe95 100644
--- a/libcxx/test/configs/libcxx-trunk-static.cfg.in
+++ b/libcxx/test/configs/libcxx-trunk-static.cfg.in
@@ -1,11 +1,12 @@
@AUTO_GEN_COMMENT@
+ at SERIALIZED_LIT_PARAMS@
+
LIBCXX_ROOT = "@LIBCXX_SOURCE_DIR@"
INSTALL_ROOT = "@CMAKE_BINARY_DIR@"
COMPILER = "@CMAKE_CXX_COMPILER@"
EXEC_ROOT = "@LIBCXX_BINARY_DIR@"
CMAKE_OSX_SYSROOT = "@CMAKE_OSX_SYSROOT@"
-TARGET_TRIPLE = "@TARGET_TRIPLE@"
import os
import pipes
@@ -23,8 +24,6 @@ config.test_source_root = os.path.join(LIBCXX_ROOT, 'test')
config.test_format = libcxx.test.format.CxxStandardLibraryTest()
config.recursiveExpansionLimit = 10
config.test_exec_root = EXEC_ROOT
-if TARGET_TRIPLE:
- config.target_triple = TARGET_TRIPLE
# Configure basic substitutions
runPy = os.path.join(LIBCXX_ROOT, 'utils', 'run.py')
diff --git a/libcxxabi/test/CMakeLists.txt b/libcxxabi/test/CMakeLists.txt
index d85dc412ed74..b571a2437cc8 100644
--- a/libcxxabi/test/CMakeLists.txt
+++ b/libcxxabi/test/CMakeLists.txt
@@ -41,7 +41,6 @@ pythonize_bool(LIBCXXABI_BUILD_32_BITS)
pythonize_bool(LIBCXX_ENABLE_SHARED)
pythonize_bool(LIBCXXABI_ENABLE_SHARED)
pythonize_bool(LIBCXXABI_ENABLE_THREADS)
-pythonize_bool(LIBCXXABI_ENABLE_EXCEPTIONS)
pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
pythonize_bool(LIBCXXABI_USE_COMPILER_RT)
pythonize_bool(LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY)
@@ -71,6 +70,26 @@ if (NOT LIBCXXABI_STANDALONE_BUILD)
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")
+
+macro(serialize_lit_param param value)
+ string(APPEND SERIALIZED_LIT_PARAMS "config.${param} = ${value}\n")
+endmacro()
+
+if (NOT LIBCXXABI_ENABLE_EXCEPTIONS)
+ serialize_lit_param(enable_exceptions False)
+endif()
+
+serialize_lit_param(enable_experimental False)
+
+if (LLVM_USE_SANITIZER)
+ serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"")
+endif()
+
+if (TARGET_TRIPLE)
+ serialize_lit_param(target_triple "\"${TARGET_TRIPLE}\"")
+endif()
+
configure_lit_site_cfg(
"${LIBCXXABI_TEST_CONFIG}"
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
diff --git a/libcxxabi/test/lit.site.cfg.in b/libcxxabi/test/lit.site.cfg.in
index 6c4e944de556..4015501de482 100644
--- a/libcxxabi/test/lit.site.cfg.in
+++ b/libcxxabi/test/lit.site.cfg.in
@@ -1,5 +1,7 @@
@AUTO_GEN_COMMENT@
+ at SERIALIZED_LIT_PARAMS@
+
import os
import site
@@ -16,20 +18,15 @@ config.cxx_library_root = "@LIBCXXABI_LIBCXX_LIBRARY_PATH@"
config.llvm_unwinder = @LIBCXXABI_USE_LLVM_UNWINDER@
config.builtins_library = "@LIBCXXABI_BUILTINS_LIBRARY@"
config.enable_threads = @LIBCXXABI_ENABLE_THREADS@
-config.use_sanitizer = "@LLVM_USE_SANITIZER@"
config.enable_32bit = @LIBCXXABI_BUILD_32_BITS@
config.target_info = "@LIBCXXABI_TARGET_INFO@"
config.executor = "@LIBCXXABI_EXECUTOR@"
config.libcxxabi_shared = @LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXXABI@
config.enable_shared = @LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX@
-config.enable_exceptions = @LIBCXXABI_ENABLE_EXCEPTIONS@
config.host_triple = "@LLVM_HOST_TRIPLE@"
-if "@TARGET_TRIPLE@":
- config.target_triple = "@TARGET_TRIPLE@"
config.sysroot = "@LIBCXXABI_SYSROOT@"
config.gcc_toolchain = "@LIBCXXABI_GCC_TOOLCHAIN@"
config.cxx_ext_threads = @LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY@
-config.enable_experimental = False
config.pstl_src_root = "@ParallelSTL_SOURCE_DIR@" if @LIBCXX_ENABLE_PARALLEL_ALGORITHMS@ else None
config.pstl_obj_root = "@ParallelSTL_BINARY_DIR@" if @LIBCXX_ENABLE_PARALLEL_ALGORITHMS@ else None
diff --git a/libunwind/test/CMakeLists.txt b/libunwind/test/CMakeLists.txt
index a5a739b5e74e..24c769cb9de7 100644
--- a/libunwind/test/CMakeLists.txt
+++ b/libunwind/test/CMakeLists.txt
@@ -24,6 +24,22 @@ set(LIBUNWIND_EXECUTOR "${Python3_EXECUTABLE} ${LIBUNWIND_LIBCXX_PATH}/utils/run
"Executor to use when running tests.")
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")
+
+macro(serialize_lit_param param value)
+ string(APPEND SERIALIZED_LIT_PARAMS "config.${param} = ${value}\n")
+endmacro()
+
+serialize_lit_param(enable_experimental False)
+
+if (LLVM_USE_SANITIZER)
+ serialize_lit_param(use_sanitizer "\"${LLVM_USE_SANITIZER}\"")
+endif()
+
+if (TARGET_TRIPLE)
+ serialize_lit_param(target_triple "\"${TARGET_TRIPLE}\"")
+endif()
+
configure_lit_site_cfg(
"${LIBUNWIND_TEST_CONFIG}"
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
diff --git a/libunwind/test/libunwind/test/config.py b/libunwind/test/libunwind/test/config.py
index b3f12bfe403c..18919c247f20 100644
--- a/libunwind/test/libunwind/test/config.py
+++ b/libunwind/test/libunwind/test/config.py
@@ -45,7 +45,7 @@ def configure_compile_flags(self):
self.cxx.compile_flags += ['-funwind-tables']
# Make symbols available in the tests.
triple = self.get_lit_conf('target_triple', None)
- if 'linux' in triple:
+ if triple is not None and 'linux' in triple:
self.cxx.link_flags += ['-Wl,--export-dynamic']
if not self.get_lit_bool('enable_threads', True):
self.cxx.compile_flags += ['-D_LIBUNWIND_HAS_NO_THREADS']
diff --git a/libunwind/test/lit.site.cfg.in b/libunwind/test/lit.site.cfg.in
index 51b46316e4bd..6f0c339b9ab6 100644
--- a/libunwind/test/lit.site.cfg.in
+++ b/libunwind/test/lit.site.cfg.in
@@ -1,5 +1,7 @@
@AUTO_GEN_COMMENT@
+ at SERIALIZED_LIT_PARAMS@
+
import os
import site
@@ -14,7 +16,6 @@ config.cxx_library_root = "@LIBUNWIND_LIBCXX_LIBRARY_PATH@"
config.llvm_unwinder = True
config.builtins_library = "@LIBUNWIND_BUILTINS_LIBRARY@"
config.enable_threads = @LIBUNWIND_ENABLE_THREADS@
-config.use_sanitizer = "@LLVM_USE_SANITIZER@"
config.enable_32bit = @LIBUNWIND_BUILD_32_BITS@
config.target_info = "@LIBUNWIND_TARGET_INFO@"
config.test_linker_flags = "@LIBUNWIND_TEST_LINKER_FLAGS@"
@@ -24,12 +25,9 @@ config.libunwind_shared = @LIBUNWIND_ENABLE_SHARED@
config.enable_shared = @LIBCXX_ENABLE_SHARED@
config.arm_ehabi = @LIBUNWIND_USES_ARM_EHABI@
config.host_triple = "@LLVM_HOST_TRIPLE@"
-if "@TARGET_TRIPLE@":
- config.target_triple = "@TARGET_TRIPLE@"
config.sysroot = "@LIBUNWIND_SYSROOT@"
config.gcc_toolchain = "@LIBUNWIND_GCC_TOOLCHAIN@"
config.cxx_ext_threads = @LIBUNWIND_BUILD_EXTERNAL_THREAD_LIBRARY@
-config.enable_experimental = False
site.addsitedir(os.path.join(config.libunwind_src_root, 'test'))
site.addsitedir(os.path.join(config.libcxx_src_root, 'utils'))
More information about the libcxx-commits
mailing list