Skip to content

Commit 7e801d1

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 9406ee5 commit 7e801d1

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
@@ -65,6 +65,20 @@ set(LLDB_DEFAULT_TEST_EXECUTABLE "${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb${CMAKE_EXEC
6565

6666
set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_TOOLS_BINARY_DIR}/dsymutil${CMAKE_EXECUTABLE_SUFFIX}")
6767

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

7893
if ("${LLDB_TEST_COMPILER}" STREQUAL "")
7994
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
@@ -278,6 +278,9 @@ def delete_module_cache(path):
278278
if is_configured("dsymutil"):
279279
dotest_cmd += ["--dsymutil", config.dsymutil]
280280

281+
if is_configured("make"):
282+
dotest_cmd += ["--make", config.make]
283+
281284
if is_configured("llvm_tools_dir"):
282285
dotest_cmd += ["--llvm-tools-dir", config.llvm_tools_dir]
283286

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

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

0 commit comments

Comments
 (0)