Author: Stefan Gränitz Date: 2024-10-10T12:55:31+02:00 New Revision: 0e913237871e8c9290e82be30be8b3484952eee0
URL: https://github.com/llvm/llvm-project/commit/0e913237871e8c9290e82be30be8b3484952eee0 DIFF: https://github.com/llvm/llvm-project/commit/0e913237871e8c9290e82be30be8b3484952eee0.diff LOG: [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. Added: Modified: lldb/packages/Python/lldbsuite/test/dotest.py lldb/test/API/CMakeLists.txt lldb/test/API/lit.cfg.py lldb/test/API/lit.site.cfg.py.in Removed: ################################################################################ diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index b1ae896d3fd3b4..681ea1638f2d6f 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -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 diff --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt index 27f285230cafaf..896ce2c8c27724 100644 --- a/lldb/test/API/CMakeLists.txt +++ b/lldb/test/API/CMakeLists.txt @@ -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.") diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py index 6a0a1b0a766755..6481ae8b663c8c 100644 --- a/lldb/test/API/lit.cfg.py +++ b/lldb/test/API/lit.cfg.py @@ -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] diff --git a/lldb/test/API/lit.site.cfg.py.in b/lldb/test/API/lit.site.cfg.py.in index db3cd2971f347a..7dd8ffd2f5cb4c 100644 --- a/lldb/test/API/lit.site.cfg.py.in +++ b/lldb/test/API/lit.site.cfg.py.in @@ -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@" _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits