Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -36,9 +36,6 @@ add_subdirectory(tools) option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS}) -option(LLDB_TEST_USE_CUSTOM_C_COMPILER "Use the C compiler provided via LLDB_TEST_C_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF) -option(LLDB_TEST_USE_CUSTOM_CXX_COMPILER "Use the C++ compiler provided via LLDB_TEST_CXX_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF) - if(LLDB_INCLUDE_TESTS) # Set the path to the default lldb test executable. set(LLDB_DEFAULT_TEST_EXECUTABLE "${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb${CMAKE_EXECUTABLE_SUFFIX}") @@ -50,15 +47,36 @@ set(LLDB_DEFAULT_TEST_COMPILER "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}") endif() + # Phase out these settings. We only support clang, so we should have only one setting. + # dotest has its own logic to deal with C/C++ driver variants. + set(LLDB_TEST_C_COMPILER "" CACHE PATH "C Compiler to use for building LLDB test inferiors (deprecated)") + set(LLDB_TEST_CXX_COMPILER "" CACHE PATH "C++ Compiler to use for building LLDB test inferiors (deprecated)") + + set(LLDB_TEST_COMPILER "" CACHE PATH "Compiler to use for building LLDB test inferiors (defaults to builtin clang)") set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb executable used for testing") - set(LLDB_TEST_C_COMPILER "${LLDB_DEFAULT_TEST_COMPILER}" CACHE PATH "C Compiler to use for building LLDB test inferiors") - set(LLDB_TEST_CXX_COMPILER "${LLDB_DEFAULT_TEST_COMPILER}" CACHE PATH "C++ Compiler to use for building LLDB test inferiors") set(LLDB_TEST_DSYMUTIL "${LLDB_DEFAULT_TEST_DSYMUTIL}" CACHE PATH "dsymutil used for generating dSYM bundles") set(LLDB_TEST_FILECHECK "${LLDB_DEFAULT_TEST_FILECHECK}" CACHE PATH "FileCheck used for testing purposes") - if((NOT LLDB_TEST_C_COMPILER) OR (NOT LLDB_TEST_CXX_COMPILER)) - message(WARNING "LLDB test compilers not specified. Tests will not run.") + # Use LLDB_TEST_COMPILER_IS_DEFAULT to determine whether or not to replace + # CMAKE_CFG_INTDIR with LLVM_BUILD_MODE for dotest. + if(LLDB_TEST_COMPILER) + set(compiler_used ${LLDB_TEST_COMPILER}) + elseif(LLDB_TEST_C_COMPILER) + set(compiler_used ${LLDB_TEST_C_COMPILER}) + elseif(LLDB_TEST_CXX_COMPILER) + set(compiler_used ${LLDB_TEST_CXX_COMPILER}) + else() + set(LLDB_TEST_COMPILER_IS_DEFAULT ON) + set(compiler_used ${LLDB_DEFAULT_TEST_COMPILER}) endif() + if (compiler_used) + set(LLDB_TEST_COMPILER_USED ${compiler_used}) + else() + message(WARNING "LLDB test compiler not specified. Tests will not run.") + endif() + + unset(LLDB_TEST_C_COMPILER CACHE) + unset(LLDB_TEST_CXX_COMPILER CACHE) set(LLDB_TEST_DEPS lldb) Index: lit/CMakeLists.txt =================================================================== --- lit/CMakeLists.txt +++ lit/CMakeLists.txt @@ -11,14 +11,6 @@ set(LLDB_IS_64_BITS 1) endif() -if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER) - string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_C_COMPILER "${LLDB_TEST_C_COMPILER}") -endif () - -if (NOT LLDB_TEST_USE_CUSTOM_CXX_COMPILER) - string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_TEST_CXX_COMPILER "${LLDB_TEST_CXX_COMPILER}") -endif () - get_property(LLDB_DOTEST_ARGS GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY) string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLDB_LIBS_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) Index: test/CMakeLists.txt =================================================================== --- test/CMakeLists.txt +++ test/CMakeLists.txt @@ -50,7 +50,7 @@ --executable ${LLDB_TEST_EXECUTABLE} --dsymutil ${LLDB_TEST_DSYMUTIL} --filecheck ${LLDB_TEST_FILECHECK} - -C ${LLDB_TEST_C_COMPILER} + -C ${LLDB_TEST_COMPILER_USED} ) if ( CMAKE_SYSTEM_NAME MATCHES "Windows" ) Index: www/build.html =================================================================== --- www/build.html +++ www/build.html @@ -116,15 +116,14 @@ the PYTHONHOME environment variable if it is specified).
  • - LLDB_TEST_C_COMPILER or LLDB_TEST_CXX_COMPILER: The test suite needs to be able to find a copy of clang.exe + LLDB_TEST_COMPILER: The test suite needs to be able to find a copy of clang.exe that it can use to compile inferior programs. Note that MSVC is not supported here, it must be a path to a clang executable. Note that using a release clang.exe is strongly recommended here, as it will make the test suite run much faster. - This can be a path to any recent clang.exe, including one you built yourself. These variables are ignored unless the respective - LLDB_TEST_USE_CUSTOM_C_COMPILER and LLDB_TEST_USE_CUSTOM_CXX_COMPILER are set to ON. + This can be a path to any recent clang.exe, including one you built yourself.
  • Sample command line:
    - cmake -G Ninja -DLLDB_TEST_DEBUG_TEST_CRASHES=1 -DPYTHON_HOME=C:\Python35 -DLLDB_TEST_USE_CUSTOM_C_COMPILER=ON -DLLDB_TEST_C_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe ..\..\llvm + cmake -G Ninja -DLLDB_TEST_DEBUG_TEST_CRASHES=1 -DPYTHON_HOME=C:\Python35 -DLLDB_TEST_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe ..\..\llvm

    Working with both Ninja and MSVC

    Compiling with ninja is both faster and simpler than compiling with MSVC, but chances are you still want Index: www/test.html =================================================================== --- www/test.html +++ www/test.html @@ -39,9 +39,7 @@ The easiest way to run the LLDB test suite is to use the check-lldb build target. By default, the check-lldb target builds the test programs with the same compiler that was used to build LLDB. To build the tests with a different - compiler, you can set the LLDB_TEST_C_COMPILER or the LLDB_TEST_CXX_COMPILER CMake variables. - These variables are ignored unless the respective LLDB_TEST_USE_CUSTOM_C_COMPILER and - LLDB_TEST_USE_CUSTOM_CXX_COMPILER are set to ON. + compiler, you can set the LLDB_TEST_COMPILER CMake variable. It is possible to customize the architecture of the test binaries and compiler used by appending -A and -C options respectively to the CMake variable LLDB_TEST_USER_ARGS. For example, to test LLDB against 32-bit binaries