Skip to content

Commit

Permalink
[lldb] Add early CMake check for 'make' tool (llvm#111531)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
weliveindetail authored Oct 10, 2024
1 parent 3645c64 commit 0e91323
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lldb/packages/Python/lldbsuite/test/dotest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions lldb/test/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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.")
Expand Down
3 changes: 3 additions & 0 deletions lldb/test/API/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ def delete_module_cache(path):
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]

Expand Down
1 change: 1 addition & 0 deletions lldb/test/API/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@"
Expand Down

0 comments on commit 0e91323

Please sign in to comment.