[CMake] Update lit test configuration
authorPetr Hosek <phosek@chromium.org>
Tue, 5 Feb 2019 04:44:03 +0000 (04:44 +0000)
committerPetr Hosek <phosek@chromium.org>
Tue, 5 Feb 2019 04:44:03 +0000 (04:44 +0000)
There are several changes:
- Don't stringify Pythonized bools (that's why we're Pythonizing them)
- Support specifying target and sysroot via CMake variables
- Use consistent spelling for --target, --sysroot, --gcc-toolchain

llvm-svn: 353137

libcxx/test/lit.site.cfg.in
libcxx/utils/libcxx/test/config.py
libcxxabi/test/CMakeLists.txt
libcxxabi/test/lit.site.cfg.in
libunwind/test/CMakeLists.txt
libunwind/test/lit.site.cfg.in

index cb7b62c..019cca8 100644 (file)
@@ -4,12 +4,12 @@ config.project_obj_root         = "@CMAKE_BINARY_DIR@"
 config.libcxx_src_root          = "@LIBCXX_SOURCE_DIR@"
 config.libcxx_obj_root          = "@LIBCXX_BINARY_DIR@"
 config.cxx_library_root         = "@LIBCXX_LIBRARY_DIR@"
-config.enable_exceptions        = "@LIBCXX_ENABLE_EXCEPTIONS@"
-config.enable_experimental      = "@LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY@"
-config.enable_filesystem        = "@LIBCXX_ENABLE_FILESYSTEM@"
-config.enable_rtti              = "@LIBCXX_ENABLE_RTTI@"
-config.enable_shared            = "@LIBCXX_ENABLE_SHARED@"
-config.enable_32bit             = "@LIBCXX_BUILD_32_BITS@"
+config.enable_exceptions        = @LIBCXX_ENABLE_EXCEPTIONS@
+config.enable_experimental      = @LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY@
+config.enable_filesystem        = @LIBCXX_ENABLE_FILESYSTEM@
+config.enable_rtti              = @LIBCXX_ENABLE_RTTI@
+config.enable_shared            = @LIBCXX_ENABLE_SHARED@
+config.enable_32bit             = @LIBCXX_BUILD_32_BITS@
 config.cxx_abi                  = "@LIBCXX_CXX_ABI_LIBNAME@"
 config.use_sanitizer            = "@LLVM_USE_SANITIZER@"
 config.sanitizer_library        = "@LIBCXX_SANITIZER_LIBRARY@"
@@ -20,19 +20,19 @@ config.target_triple            = "@TARGET_TRIPLE@"
 config.use_target               = bool("@LIBCXX_TARGET_TRIPLE@")
 config.sysroot                  = "@LIBCXX_SYSROOT@"
 config.gcc_toolchain            = "@LIBCXX_GCC_TOOLCHAIN@"
-config.generate_coverage        = "@LIBCXX_GENERATE_COVERAGE@"
+config.generate_coverage        = @LIBCXX_GENERATE_COVERAGE@
 config.target_info              = "@LIBCXX_TARGET_INFO@"
 config.test_linker_flags        = "@LIBCXX_TEST_LINKER_FLAGS@"
 config.test_compiler_flags      = "@LIBCXX_TEST_COMPILER_FLAGS@"
 
 config.executor                 = "@LIBCXX_EXECUTOR@"
-config.llvm_unwinder            = "@LIBCXXABI_USE_LLVM_UNWINDER@"
-config.compiler_rt              = "@LIBCXX_USE_COMPILER_RT@"
-config.has_libatomic            = "@LIBCXX_HAS_ATOMIC_LIB@"
-config.use_libatomic            = "@LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB@"
-config.debug_build              = "@LIBCXX_DEBUG_BUILD@"
-config.libcxxabi_shared         = "@LIBCXXABI_ENABLE_SHARED@"
-config.cxx_ext_threads          = "@LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY@"
+config.llvm_unwinder            = @LIBCXXABI_USE_LLVM_UNWINDER@
+config.compiler_rt              = @LIBCXX_USE_COMPILER_RT@
+config.has_libatomic            = @LIBCXX_HAS_ATOMIC_LIB@
+config.use_libatomic            = @LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB@
+config.debug_build              = @LIBCXX_DEBUG_BUILD@
+config.libcxxabi_shared         = @LIBCXXABI_ENABLE_SHARED@
+config.cxx_ext_threads          = @LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY@
 
 # Let the main config do the real work.
 config.loaded_site_config = True
index aba1ada..a16bbde 100644 (file)
@@ -547,10 +547,10 @@ class Configuration(object):
         self.cxx.flags += ['-v']
         sysroot = self.get_lit_conf('sysroot')
         if sysroot:
-            self.cxx.flags += ['--sysroot', sysroot]
+            self.cxx.flags += ['--sysroot=' + sysroot]
         gcc_toolchain = self.get_lit_conf('gcc_toolchain')
         if gcc_toolchain:
-            self.cxx.flags += ['-gcc-toolchain', gcc_toolchain]
+            self.cxx.flags += ['--gcc-toolchain=' + gcc_toolchain]
         # NOTE: the _DEBUG definition must preceed the triple check because for
         # the Windows build of libc++, the forced inclusion of a header requires
         # that _DEBUG is defined.  Incorrect ordering will result in -target
@@ -559,8 +559,8 @@ class Configuration(object):
             self.cxx.compile_flags += ['-D_DEBUG']
         if self.use_target:
             if not self.cxx.addFlagIfSupported(
-                    ['-target', self.config.target_triple]):
-                self.lit_config.warning('use_target is true but -target is '\
+                    ['--target=' + self.config.target_triple]):
+                self.lit_config.warning('use_target is true but --target is '\
                         'not supported by the compiler')
         if self.use_deployment:
             arch, name, version = self.config.deployment
index 5e51c44..01fae13 100644 (file)
@@ -17,6 +17,7 @@ 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)
 set(LIBCXXABI_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
     "TargetInfo to use when setting up test environment.")
index d8e58be..a4c5764 100644 (file)
@@ -8,22 +8,23 @@ config.libcxx_src_root          = "@LIBCXXABI_LIBCXX_PATH@"
 config.cxx_headers              = "@LIBCXXABI_LIBCXX_INCLUDES@"
 config.libunwind_headers        = "@LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL@"
 config.cxx_library_root         = "@LIBCXXABI_LIBCXX_LIBRARY_PATH@"
-config.llvm_unwinder            = "@LIBCXXABI_USE_LLVM_UNWINDER@"
-config.enable_threads           = "@LIBCXXABI_ENABLE_THREADS@"
+config.llvm_unwinder            = @LIBCXXABI_USE_LLVM_UNWINDER@
+config.compiler_rt              = @LIBCXXABI_USE_COMPILER_RT@
+config.enable_threads           = @LIBCXXABI_ENABLE_THREADS@
 config.use_sanitizer            = "@LLVM_USE_SANITIZER@"
 config.sanitizer_library        = "@LIBCXXABI_SANITIZER_LIBRARY@"
-config.enable_32bit             = "@LIBCXXABI_BUILD_32_BITS@"
+config.enable_32bit             = @LIBCXXABI_BUILD_32_BITS@
 config.target_info              = "@LIBCXXABI_TARGET_INFO@"
 config.executor                 = "@LIBCXXABI_EXECUTOR@"
-config.libcxxabi_shared         = "@LIBCXXABI_ENABLE_SHARED@"
-config.enable_shared            = "@LIBCXX_ENABLE_SHARED@"
-config.enable_exceptions        = "@LIBCXXABI_ENABLE_EXCEPTIONS@"
+config.libcxxabi_shared         = @LIBCXXABI_ENABLE_SHARED@
+config.enable_shared            = @LIBCXX_ENABLE_SHARED@
+config.enable_exceptions        = @LIBCXXABI_ENABLE_EXCEPTIONS@
 config.host_triple              = "@LLVM_HOST_TRIPLE@"
 config.target_triple            = "@TARGET_TRIPLE@"
 config.use_target               = bool("@LIBCXXABI_TARGET_TRIPLE@")
 config.sysroot                  = "@LIBCXXABI_SYSROOT@"
 config.gcc_toolchain            = "@LIBCXXABI_GCC_TOOLCHAIN@"
-config.cxx_ext_threads          = "@LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY@"
+config.cxx_ext_threads          = @LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY@
 
 # Let the main config do the real work.
 lit_config.load_config(config, "@LIBCXXABI_SOURCE_DIR@/test/lit.cfg")
index 97917b8..d902e3e 100644 (file)
@@ -16,6 +16,7 @@ pythonize_bool(LIBCXX_ENABLE_SHARED)
 pythonize_bool(LIBUNWIND_ENABLE_SHARED)
 pythonize_bool(LIBUNWIND_ENABLE_THREADS)
 pythonize_bool(LIBUNWIND_ENABLE_EXCEPTIONS)
+pythonize_bool(LIBUNWIND_USE_COMPILER_RT)
 pythonize_bool(LIBUNWIND_BUILD_EXTERNAL_THREAD_LIBRARY)
 set(LIBUNWIND_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING
     "TargetInfo to use when setting up test environment.")
index 2532a3e..4b4cb7e 100644 (file)
@@ -7,23 +7,24 @@ config.abi_library_path         = "@LIBUNWIND_LIBRARY_DIR@"
 config.libcxx_src_root          = "@LIBUNWIND_LIBCXX_PATH@"
 config.libunwind_headers        = "@LIBUNWIND_SOURCE_DIR@/include"
 config.cxx_library_root         = "@LIBUNWIND_LIBCXX_LIBRARY_PATH@"
-config.llvm_unwinder            = "1"
-config.enable_threads           = "@LIBUNWIND_ENABLE_THREADS@"
+config.llvm_unwinder            = True
+config.compiler_rt              = @LIBUNWIND_USE_COMPILER_RT@
+config.enable_threads           = @LIBUNWIND_ENABLE_THREADS@
 config.use_sanitizer            = "@LLVM_USE_SANITIZER@"
-config.enable_32bit             = "@LIBUNWIND_BUILD_32_BITS@"
+config.enable_32bit             = @LIBUNWIND_BUILD_32_BITS@
 config.target_info              = "@LIBUNWIND_TARGET_INFO@"
 config.test_linker_flags        = "@LIBUNWIND_TEST_LINKER_FLAGS@"
 config.test_compiler_flags      = "@LIBUNWIND_TEST_COMPILER_FLAGS@"
 config.executor                 = "@LIBUNWIND_EXECUTOR@"
-config.libunwind_shared         = "@LIBUNWIND_ENABLE_SHARED@"
-config.enable_shared            = "@LIBCXX_ENABLE_SHARED@"
-config.enable_exceptions        = "@LIBUNWIND_ENABLE_EXCEPTIONS@"
+config.libunwind_shared         = @LIBUNWIND_ENABLE_SHARED@
+config.enable_shared            = @LIBCXX_ENABLE_SHARED@
+config.enable_exceptions        = @LIBUNWIND_ENABLE_EXCEPTIONS@
 config.host_triple              = "@LLVM_HOST_TRIPLE@"
 config.target_triple            = "@TARGET_TRIPLE@"
 config.use_target               = bool("@LIBUNWIND_TARGET_TRIPLE@")
 config.sysroot                  = "@LIBUNWIND_SYSROOT@"
 config.gcc_toolchain            = "@LIBUNWIND_GCC_TOOLCHAIN@"
-config.cxx_ext_threads          = "@LIBUNWIND_BUILD_EXTERNAL_THREAD_LIBRARY@"
+config.cxx_ext_threads          = @LIBUNWIND_BUILD_EXTERNAL_THREAD_LIBRARY@
 
 # Let the main config do the real work.
 lit_config.load_config(config, "@LIBUNWIND_SOURCE_DIR@/test/lit.cfg")