[lldb] Add early CMake check for 'make' tool (#111531)

Many LLDB's dotest.py based tests require the `make` tool. If it's not found in Path, they fail with an obscure error and show up as `UNRESOLVED`. On Windows, llvm-lit takes care of MSYS based testing tools like cat, printf, etc., but `make` is not part of that. Let's catch the situation early and check for it at configuration time.

This error isn't fatal: It should fail the build, but not immediately stop the configuration process. There might be other issues further down the line that can be caught in the same buildbot run.
This commit is contained in:
Stefan Gränitz
2024-10-10 12:55:31 +02:00
committed by GitHub
parent 3645c64d87
commit 0e91323787
4 changed files with 19 additions and 4 deletions

View File

@@ -268,10 +268,6 @@ def parseOptionsAndInitTestdirs():
if args.make:
configuration.make_path = args.make
elif platform_system == "FreeBSD" or platform_system == "NetBSD":
configuration.make_path = "gmake"
else:
configuration.make_path = "make"
if args.dsymutil:
configuration.dsymutil = args.dsymutil

View File

@@ -49,6 +49,20 @@ set(LLDB_DEFAULT_TEST_EXECUTABLE "${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb${CMAKE_EXEC
set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_TOOLS_BINARY_DIR}/dsymutil${CMAKE_EXECUTABLE_SUFFIX}")
if(LLDB_TEST_MAKE)
set(LLDB_DEFAULT_TEST_MAKE ${LLDB_TEST_MAKE})
else()
find_program(LLDB_DEFAULT_TEST_MAKE make gmake)
if(LLDB_DEFAULT_TEST_MAKE)
message(STATUS "Found make: ${LLDB_DEFAULT_TEST_MAKE}")
else()
message(STATUS "Not found: make")
message(SEND_ERROR
"LLDB tests require 'make' tool. Please pass via `LLDB_TEST_MAKE` "
"(or otherwise disable tests with `LLDB_INCLUDE_TESTS=OFF`)")
endif()
endif()
if (TARGET clang)
set(LLDB_DEFAULT_TEST_COMPILER "${LLVM_TOOLS_BINARY_DIR}/clang${CMAKE_EXECUTABLE_SUFFIX}")
else()
@@ -58,6 +72,7 @@ endif()
set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb executable used for testing")
set(LLDB_TEST_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_MAKE "${LLDB_DEFAULT_TEST_MAKE}" CACHE PATH "make tool used for building test executables")
if ("${LLDB_TEST_COMPILER}" STREQUAL "")
message(FATAL_ERROR "LLDB test compiler not specified. Tests will not run.")

View File

@@ -250,6 +250,9 @@ if is_configured("test_compiler"):
if is_configured("dsymutil"):
dotest_cmd += ["--dsymutil", config.dsymutil]
if is_configured("make"):
dotest_cmd += ["--make", config.make]
if is_configured("llvm_tools_dir"):
dotest_cmd += ["--llvm-tools-dir", config.llvm_tools_dir]

View File

@@ -34,6 +34,7 @@ config.lldb_executable = lit_config.substitute('@LLDB_TEST_EXECUTABLE@')
config.test_arch = '@LLDB_TEST_ARCH@'
config.test_compiler = lit_config.substitute('@LLDB_TEST_COMPILER@')
config.dsymutil = lit_config.substitute('@LLDB_TEST_DSYMUTIL@')
config.make = lit_config.substitute('@LLDB_TEST_MAKE@')
config.has_libcxx = @LLDB_HAS_LIBCXX@
config.libcxx_libs_dir = "@LIBCXX_LIBRARY_DIR@"
config.libcxx_include_dir = "@LIBCXX_GENERATED_INCLUDE_DIR@"