Skip to content

Commit ebf6209

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 847628e commit ebf6209

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
@@ -271,10 +271,6 @@ def parseOptionsAndInitTestdirs():
271271

272272
if args.make:
273273
configuration.make_path = args.make
274-
elif platform_system == "FreeBSD" or platform_system == "NetBSD":
275-
configuration.make_path = "gmake"
276-
else:
277-
configuration.make_path = "make"
278274

279275
if args.dsymutil:
280276
configuration.dsymutil = args.dsymutil

lldb/test/API/CMakeLists.txt

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

6464
set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_TOOLS_BINARY_DIR}/dsymutil${CMAKE_EXECUTABLE_SUFFIX}")
6565

66+
if(LLDB_TEST_MAKE)
67+
set(LLDB_DEFAULT_TEST_MAKE ${LLDB_TEST_MAKE})
68+
else()
69+
find_program(LLDB_DEFAULT_TEST_MAKE make gmake)
70+
if(LLDB_DEFAULT_TEST_MAKE)
71+
message(STATUS "Found make: ${LLDB_DEFAULT_TEST_MAKE}")
72+
else()
73+
message(STATUS "Not found: make")
74+
message(SEND_ERROR
75+
"LLDB tests require 'make' tool. Please pass via `LLDB_TEST_MAKE` "
76+
"(or otherwise disable tests with `LLDB_INCLUDE_TESTS=OFF`)")
77+
endif()
78+
endif()
79+
6680
if (TARGET clang)
6781
set(LLDB_DEFAULT_TEST_COMPILER "${LLVM_TOOLS_BINARY_DIR}/clang${CMAKE_EXECUTABLE_SUFFIX}")
6882
else()
@@ -72,6 +86,7 @@ endif()
7286
set(LLDB_TEST_EXECUTABLE "${LLDB_DEFAULT_TEST_EXECUTABLE}" CACHE PATH "lldb executable used for testing")
7387
set(LLDB_TEST_COMPILER "${LLDB_DEFAULT_TEST_COMPILER}" CACHE PATH "C Compiler to use for building LLDB test inferiors")
7488
set(LLDB_TEST_DSYMUTIL "${LLDB_DEFAULT_TEST_DSYMUTIL}" CACHE PATH "dsymutil used for generating dSYM bundles")
89+
set(LLDB_TEST_MAKE "${LLDB_DEFAULT_TEST_MAKE}" CACHE PATH "make tool used for building test executables")
7590

7691
if ("${LLDB_TEST_COMPILER}" STREQUAL "")
7792
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
@@ -255,6 +255,9 @@ def delete_module_cache(path):
255255
if is_configured("dsymutil"):
256256
dotest_cmd += ["--dsymutil", config.dsymutil]
257257

258+
if is_configured("make"):
259+
dotest_cmd += ["--make", config.make]
260+
258261
if is_configured("llvm_tools_dir"):
259262
dotest_cmd += ["--llvm-tools-dir", config.llvm_tools_dir]
260263

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ config.test_arch = '@LLDB_TEST_ARCH@'
3232
config.test_compiler = lit_config.substitute('@LLDB_TEST_COMPILER@')
3333
config.test_swift_compiler = lit_config.substitute('@LLDB_SWIFTC@')
3434
config.dsymutil = lit_config.substitute('@LLDB_TEST_DSYMUTIL@')
35+
config.make = lit_config.substitute('@LLDB_TEST_MAKE@')
3536
config.has_libcxx = @LLDB_HAS_LIBCXX@
3637
config.libcxx_libs_dir = "@LIBCXX_LIBRARY_DIR@"
3738
config.libcxx_include_dir = "@LIBCXX_GENERATED_INCLUDE_DIR@"

0 commit comments

Comments
 (0)