Skip to content

Commit 0e91323

Browse files
[lldb] Add early CMake check for 'make' tool (llvm#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.
1 parent 3645c64 commit 0e91323

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

lldb/packages/Python/lldbsuite/test/dotest.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,6 @@ def parseOptionsAndInitTestdirs():
268268

269269
if args.make:
270270
configuration.make_path = args.make
271-
elif platform_system == "FreeBSD" or platform_system == "NetBSD":
272-
configuration.make_path = "gmake"
273-
else:
274-
configuration.make_path = "make"
275271

276272
if args.dsymutil:
277273
configuration.dsymutil = args.dsymutil

lldb/test/API/CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,20 @@ set(LLDB_DEFAULT_TEST_EXECUTABLE "${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb${CMAKE_EXEC
4949

5050
set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_TOOLS_BINARY_DIR}/dsymutil${CMAKE_EXECUTABLE_SUFFIX}")
5151

52+
if(LLDB_TEST_MAKE)
53+
set(LLDB_DEFAULT_TEST_MAKE ${LLDB_TEST_MAKE})
54+
else()
55+
find_program(LLDB_DEFAULT_TEST_MAKE make gmake)
56+
if(LLDB_DEFAULT_TEST_MAKE)
57+
message(STATUS "Found make: ${LLDB_DEFAULT_TEST_MAKE}")
58+
else()
59+
message(STATUS "Not found: make")
60+
message(SEND_ERROR
61+
"LLDB tests require 'make' tool. Please pass via `LLDB_TEST_MAKE` "
62+
"(or otherwise disable tests with `LLDB_INCLUDE_TESTS=OFF`)")
63+
endif()
64+
endif()
65+
5266
if (TARGET clang)
5367
set(LLDB_DEFAULT_TEST_COMPILER "${LLVM_TOOLS_BINARY_DIR}/clang${CMAKE_EXECUTABLE_SUFFIX}")
5468
else()
@@ -58,6 +72,7 @@ endif()
5872
set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb executable used for testing")
5973
set(LLDB_TEST_COMPILER "${LLDB_DEFAULT_TEST_COMPILER}" CACHE PATH "C Compiler to use for building LLDB test inferiors")
6074
set(LLDB_TEST_DSYMUTIL "${LLDB_DEFAULT_TEST_DSYMUTIL}" CACHE PATH "dsymutil used for generating dSYM bundles")
75+
set(LLDB_TEST_MAKE "${LLDB_DEFAULT_TEST_MAKE}" CACHE PATH "make tool used for building test executables")
6176

6277
if ("${LLDB_TEST_COMPILER}" STREQUAL "")
6378
message(FATAL_ERROR "LLDB test compiler not specified. Tests will not run.")

lldb/test/API/lit.cfg.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ def delete_module_cache(path):
250250
if is_configured("dsymutil"):
251251
dotest_cmd += ["--dsymutil", config.dsymutil]
252252

253+
if is_configured("make"):
254+
dotest_cmd += ["--make", config.make]
255+
253256
if is_configured("llvm_tools_dir"):
254257
dotest_cmd += ["--llvm-tools-dir", config.llvm_tools_dir]
255258

lldb/test/API/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ config.lldb_executable = lit_config.substitute('@LLDB_TEST_EXECUTABLE@')
3434
config.test_arch = '@LLDB_TEST_ARCH@'
3535
config.test_compiler = lit_config.substitute('@LLDB_TEST_COMPILER@')
3636
config.dsymutil = lit_config.substitute('@LLDB_TEST_DSYMUTIL@')
37+
config.make = lit_config.substitute('@LLDB_TEST_MAKE@')
3738
config.has_libcxx = @LLDB_HAS_LIBCXX@
3839
config.libcxx_libs_dir = "@LIBCXX_LIBRARY_DIR@"
3940
config.libcxx_include_dir = "@LIBCXX_GENERATED_INCLUDE_DIR@"

0 commit comments

Comments
 (0)