summaryrefslogtreecommitdiffstats
path: root/lldb/test/CMakeLists.txt
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-04-21 18:23:04 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-04-21 18:23:04 +0000
commit49f4aee0e32ae256a9048de81e60d17668633979 (patch)
tree59739f15f4160d3cd656b45c257abefede4d42d3 /lldb/test/CMakeLists.txt
parent05242bf691063b4491783ef407d778403365304f (diff)
downloadbcm5719-llvm-49f4aee0e32ae256a9048de81e60d17668633979.tar.gz
bcm5719-llvm-49f4aee0e32ae256a9048de81e60d17668633979.zip
[lit] Generate a single lit cfg file for tests that require dotest.py
The current way that the lit configuration is generated for the LLDB tests that run using dotest causes cmake to fail when using a generator which supports multiple configurations (such as Visual Studio). The failure is because file GENERATE will create a file *per possible configuration* resulting in the same lit configuration file being overwritten multiple times. To fix the issue, we need to create a single lit file that is agnostic of the configurations and can be used for any configuration. Patch by: Stella Stamenova Differential revision: https://reviews.llvm.org/D45918 llvm-svn: 330518
Diffstat (limited to 'lldb/test/CMakeLists.txt')
-rw-r--r--lldb/test/CMakeLists.txt60
1 files changed, 45 insertions, 15 deletions
diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt
index c0820b3dc25..040d7ae5379 100644
--- a/lldb/test/CMakeLists.txt
+++ b/lldb/test/CMakeLists.txt
@@ -51,8 +51,8 @@ endif ()
# Allow the user to override the default by setting LLDB_TEST_ARCH
set(LLDB_TEST_ARCH
- ${LLDB_DEFAULT_TEST_ARCH}
- CACHE STRING "Specify the architecture to run LLDB tests as (x86|x64). Determines whether tests are compiled with -m32 or -m64")
+ ${LLDB_DEFAULT_TEST_ARCH}
+ CACHE STRING "Specify the architecture to run LLDB tests as (x86|x64). Determines whether tests are compiled with -m32 or -m64")
# Users can override LLDB_TEST_USER_ARGS to specify arbitrary arguments to pass to the script
set(LLDB_TEST_USER_ARGS
@@ -66,8 +66,6 @@ set(LLDB_TEST_USER_ARGS
# the build directory.
set(LLDB_TEST_COMMON_ARGS
--arch=${LLDB_TEST_ARCH}
- --executable $<TARGET_FILE:lldb>
- --dsymutil $<TARGET_FILE:dsymutil>
-s
${CMAKE_BINARY_DIR}/lldb-test-traces
--build-dir
@@ -75,9 +73,30 @@ set(LLDB_TEST_COMMON_ARGS
-S nm
-u CXXFLAGS
-u CFLAGS
+ )
+
+# We need two properties here, because they are used for different purposes. When we are generating
+# one file per configuration for lldb-dotest, we want the paths to be configuration specific. However,
+# when we are generating a single lit file, the file itself should not be per configuration and the paths
+# contained inside should be generic also.
+set(LLDB_EXECUTABLE_PATH_ARGS
+ --executable $<TARGET_FILE:lldb>
+ --dsymutil $<TARGET_FILE:dsymutil>
+ )
+set(LLDB_EXECUTABLE_PATH_ARGS_STR
+ --executable ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb${CMAKE_EXECUTABLE_SUFFIX}
+ --dsymutil ${LLVM_RUNTIME_OUTPUT_INTDIR}/dsymutil${CMAKE_EXECUTABLE_SUFFIX}
-C ${LLDB_TEST_C_COMPILER}
)
+# There's an additional complication which is that when the compiler is NOT a custom compiler, we need to
+# make sure to get the configuration specific path as well
+if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER)
+ list(APPEND LLDB_EXECUTABLE_PATH_ARGS -C $<TARGET_FILE:clang>)
+else()
+ list(APPEND LLDB_EXECUTABLE_PATH_ARGS -C ${LLDB_TEST_C_COMPILER})
+endif()
+
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
# All tests are currently flaky on Windows, so rerun them all once when they fail.
set(LLDB_TEST_COMMON_ARGS ${LLDB_TEST_COMMON_ARGS} --rerun-all-issues)
@@ -103,6 +122,9 @@ if(LLDB_CODESIGN_IDENTITY)
list(APPEND LLDB_TEST_COMMON_ARGS --codesign-identity "${LLDB_CODESIGN_IDENTITY}")
endif()
+# The framework path is passed to the test arguments as $<TARGET_FILE_DIR:liblldb>. This won't work in the
+# LLDB_DOTEST_ARGS_STR when using a generator that supports multiple configurations such as Visual Studio,
+# but since the framework is currently confined to Darwin/Apple, we can leave it as is.
if(LLDB_BUILD_FRAMEWORK)
list(APPEND LLDB_TEST_COMMON_ARGS --framework $<TARGET_FILE_DIR:liblldb>)
endif()
@@ -112,6 +134,9 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin")
--env ARCHIVER=${CMAKE_AR} --env OBJCOPY=${CMAKE_OBJCOPY})
endif()
+# In some cases, DEBUGSERVER_PATH is expressed as $<TARGET_FILE:debugserver>. This won't work in the
+# LLDB_DOTEST_ARGS_STR when using a generator that supports multiple configurations such as Visual Studio,
+# but since debugserver is currently confined to Darwin/Apple, we can leave it as is.
if(CMAKE_HOST_APPLE)
list(APPEND LLDB_TEST_COMMON_ARGS --server ${DEBUGSERVER_PATH})
endif()
@@ -120,7 +145,8 @@ if(SKIP_DEBUGSERVER)
list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
endif()
-set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS})
+set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_EXECUTABLE_PATH_ARGS};${LLDB_TEST_USER_ARGS})
+set(LLDB_DOTEST_ARGS_STR ${LLDB_TEST_COMMON_ARGS};${LLDB_EXECUTABLE_PATH_ARGS_STR};${LLDB_TEST_USER_ARGS})
add_python_test_target(check-lldb-single
${LLDB_SOURCE_DIR}/test/dotest.py
@@ -138,7 +164,8 @@ configure_file(
lldb-dotest.in
${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured
)
-# We need this to expand the generator expressions.
+# We need this to expand the generator expressions. TARGET_FILE_DIR is OK here because we want to
+# generate a copy of lldb-dotest per configuration.
file(GENERATE
OUTPUT
$<TARGET_FILE_DIR:lldb>/lldb-dotest
@@ -149,16 +176,19 @@ file(GENERATE
add_custom_target(lldb-dotest)
add_dependencies(lldb-dotest ${LLDB_TEST_DEPS})
-configure_file(
+if (CMAKE_CFG_INTDIR STREQUAL ".")
+ set(LLVM_BUILD_MODE ".")
+else ()
+ set(LLVM_BUILD_MODE "%(build_mode)s")
+endif ()
+
+string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_LIBS_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
+string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_ARGS_STR "${LLDB_DOTEST_ARGS_STR}")
+
+configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/../lit/Suite/lit.site.cfg.in
- ${CMAKE_CURRENT_BINARY_DIR}/../lit/Suite/lit.site.cfg
- )
-file(GENERATE
- OUTPUT
- ${CMAKE_CURRENT_BINARY_DIR}/../lit/Suite/lit.site.cfg
- INPUT
- ${CMAKE_CURRENT_BINARY_DIR}/../lit/Suite/lit.site.cfg
- )
+ ${CMAKE_CURRENT_BINARY_DIR}/../lit/Suite/lit.site.cfg)
# If we're building with an in-tree clang, then list clang as a dependency
# to run tests.
OpenPOWER on IntegriCloud