Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -85,9 +85,43 @@ message(FATAL_ERROR "LLDB test compilers not specified. Tests will not run") endif() + set(LLDB_TEST_DEPS lldb) + + # darwin-debug is an hard dependency for the testsuite. + if (CMAKE_SYSTEM_NAME MATCHES "Darwin") + list(APPEND LLDB_TEST_DEPS darwin-debug) + endif() + + if(TARGET lldb-server) + list(APPEND LLDB_TEST_DEPS lldb-server) + endif() + + if(TARGET debugserver) + if(NOT CMAKE_HOST_APPLE OR LLDB_CODESIGN_IDENTITY) + list(APPEND LLDB_TEST_DEPS debugserver) + endif() + endif() + + if(TARGET lldb-mi) + list(APPEND LLDB_TEST_DEPS lldb-mi) + endif() + + if(NOT LLDB_BUILT_STANDALONE) + list(APPEND LLDB_TEST_DEPS yaml2obj dsymutil) + endif() + + if(TARGET liblldb) + list(APPEND LLDB_TEST_DEPS liblldb) + endif() + + if(TARGET clang) + list(APPEND LLDB_TEST_DEPS clang) + endif() + add_subdirectory(test) add_subdirectory(unittests) add_subdirectory(lit) + add_subdirectory(utils/lldb-dotest) endif() if (NOT LLDB_DISABLE_PYTHON) Index: lit/CMakeLists.txt =================================================================== --- lit/CMakeLists.txt +++ lit/CMakeLists.txt @@ -17,6 +17,7 @@ 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 "${LLDB_DOTEST_ARGS}") if(BUILD_SHARED_LIBS) set(ENABLE_SHARED 1) @@ -33,13 +34,13 @@ ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg) configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in - ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg - ) + ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg) +configure_lit_site_cfg( + ${CMAKE_CURRENT_SOURCE_DIR}/Suite/lit.site.cfg.in + ${CMAKE_CURRENT_BINARY_DIR}/Suite/lit.site.cfg) -set(LLDB_TEST_DEPS +list(APPEND LLDB_TEST_DEPS LLDBUnitTests - dsymutil - lldb lldb-test llvm-config llvm-mc @@ -47,20 +48,10 @@ ) if(NOT LLDB_BUILT_STANDALONE) - list(APPEND LLDB_TEST_DEPS FileCheck not yaml2obj) -endif() - -# lldb-server is not built on every platform. -if (TARGET lldb-server) - list(APPEND LLDB_TEST_DEPS lldb-server) -endif() - -if(APPLE) - list(APPEND LLDB_TEST_DEPS debugserver) -endif() - -if(TARGET clang) - list(APPEND LLDB_TEST_DEPS clang) + list(APPEND LLDB_TEST_DEPS + FileCheck + not + ) endif() set(LLDB_TEST_PARAMS Index: lit/Suite/lit.site.cfg.in =================================================================== --- lit/Suite/lit.site.cfg.in +++ lit/Suite/lit.site.cfg.in @@ -12,7 +12,7 @@ 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_STR@" +config.dotest_args_str = "@LLDB_DOTEST_ARGS@" # 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. Index: test/CMakeLists.txt =================================================================== --- test/CMakeLists.txt +++ test/CMakeLists.txt @@ -13,35 +13,6 @@ ) endfunction() -set(LLDB_TEST_DEPS lldb) - -# darwin-debug is an hard dependency for the testsuite. -if (CMAKE_SYSTEM_NAME MATCHES "Darwin") - list(APPEND LLDB_TEST_DEPS darwin-debug) -endif() - -if(TARGET lldb-server) - list(APPEND LLDB_TEST_DEPS lldb-server) -endif() - -if(TARGET debugserver) - if(NOT CMAKE_HOST_APPLE OR LLDB_CODESIGN_IDENTITY) - list(APPEND LLDB_TEST_DEPS debugserver) - endif() -endif() - -if(TARGET lldb-mi) - list(APPEND LLDB_TEST_DEPS lldb-mi) -endif() - -if(NOT LLDB_BUILT_STANDALONE) - list(APPEND LLDB_TEST_DEPS yaml2obj dsymutil) -endif() - -if(TARGET liblldb) - list(APPEND LLDB_TEST_DEPS liblldb) -endif() - # The default architecture with which to compile test executables is the default LLVM target # architecture, which itself defaults to the host architecture. string(TOLOWER "${LLVM_TARGET_ARCH}" LLDB_DEFAULT_TEST_ARCH) @@ -75,28 +46,12 @@ -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 +list(APPEND LLDB_TEST_COMMON_ARGS --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) @@ -122,11 +77,8 @@ 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 $) + list(APPEND LLDB_TEST_COMMON_ARGS --framework ${LLVM_LIBRARY_OUTPUT_INTDIR}) endif() if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows|Darwin") @@ -134,9 +86,6 @@ --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() @@ -145,8 +94,7 @@ list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver) endif() -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}) +set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS} PARENT_SCOPE) add_python_test_target(check-lldb-single ${LLDB_SOURCE_DIR}/test/dotest.py @@ -158,38 +106,6 @@ # output is desired (i.e. in continuous integration contexts) check-lldb-single is a better target. add_custom_target(check-lldb) -# Generate a wrapper for dotest.py in the bin directory. -# We need configure_file to substitute variables. -configure_file( - lldb-dotest.in - ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured - ) -# 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 - INPUT - ${CMAKE_CURRENT_BINARY_DIR}/lldb-dotest.configured - ) -# Make this a custom target. -add_custom_target(lldb-dotest) -add_dependencies(lldb-dotest ${LLDB_TEST_DEPS}) - -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) - # If we're building with an in-tree clang, then list clang as a dependency # to run tests. if (TARGET clang) Index: tools/debugserver/source/CMakeLists.txt =================================================================== --- tools/debugserver/source/CMakeLists.txt +++ tools/debugserver/source/CMakeLists.txt @@ -77,7 +77,7 @@ RNBSocket.cpp SysSignal.cpp TTYState.cpp - + MacOSX/CFBundle.cpp MacOSX/CFString.cpp MacOSX/Genealogy.cpp @@ -99,7 +99,7 @@ CACHE STRING "Identity used for code signing. Set to empty string to skip the signing step.") if(NOT LLDB_CODESIGN_IDENTITY STREQUAL "") - set(DEBUGSERVER_PATH $ CACHE PATH "Path to debugserver.") + set(DEBUGSERVER_PATH ${LLVM_RUNTIME_OUTPUT_INTDIR}/debugserver${CMAKE_EXECUTABLE_SUFFIX} CACHE PATH "Path to debugserver.") set(SKIP_DEBUGSERVER OFF CACHE BOOL "Skip building the in-tree debug server") else() execute_process( Index: utils/lldb-dotest/CMakeLists.txt =================================================================== --- /dev/null +++ utils/lldb-dotest/CMakeLists.txt @@ -0,0 +1,20 @@ +# Make lldb-dotest a custom target. +add_custom_target(lldb-dotest) +add_dependencies(lldb-dotest ${LLDB_TEST_DEPS}) + +# Generate wrapper for each build mode. +if(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".") + foreach(LLVM_BUILD_MODE ${CMAKE_CONFIGURATION_TYPES}) + string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) + string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_DOTEST_ARGS "${LLDB_DOTEST_ARGS}") + configure_file( + lldb-dotest.in + ${LLDB_DOTEST_DIR}/lldb-dotest + ) + endforeach() +else() + configure_file( + lldb-dotest.in + ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-dotest + ) +endif()