Index: lldb/trunk/lit/Suite/lit.site.cfg.in =================================================================== --- lldb/trunk/lit/Suite/lit.site.cfg.in +++ lldb/trunk/lit/Suite/lit.site.cfg.in @@ -12,13 +12,14 @@ config.target_triple = "@TARGET_TRIPLE@" config.python_executable = "@PYTHON_EXECUTABLE@" config.dotest_path = "@LLDB_SOURCE_DIR@/test/dotest.py" -config.dotest_args_str = "@LLDB_DOTEST_ARGS@" +config.dotest_args_str = "@LLDB_DOTEST_ARGS_STR@" # Support substitution of the tools and libs dirs with user parameters. This is # used when we can't determine the tool dir at configuration time. try: config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params + config.dotest_args_str = config.dotest_args_str % lit_config.params config.llvm_build_mode = config.llvm_build_mode % lit_config.params except KeyError as e: key, = e.args Index: lldb/trunk/test/CMakeLists.txt =================================================================== --- lldb/trunk/test/CMakeLists.txt +++ lldb/trunk/test/CMakeLists.txt @@ -51,8 +51,8 @@ # 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 @@ # the build directory. set(LLDB_TEST_COMMON_ARGS --arch=${LLDB_TEST_ARCH} - --executable $ - --dsymutil $ -s ${CMAKE_BINARY_DIR}/lldb-test-traces --build-dir @@ -75,9 +73,30 @@ -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 $ + --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 $) +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 @@ list(APPEND LLDB_TEST_COMMON_ARGS --codesign-identity "${LLDB_CODESIGN_IDENTITY}") endif() +# The framework path is passed to the test arguments as $. 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 $) endif() @@ -112,6 +134,9 @@ --env ARCHIVER=${CMAKE_AR} --env OBJCOPY=${CMAKE_OBJCOPY}) endif() +# In some cases, DEBUGSERVER_PATH is expressed as $. 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 @@ 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 @@ 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 $/lldb-dotest @@ -149,16 +176,19 @@ 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.