Skip to content

[lldb] Allow specific 'make' tool for LLDB testsuite. #93367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

vvereschaka
Copy link
Contributor

Because the 'make' tool is required to run the lldb testsuite a detection of this program was added to the CMake script. If 'make' tool is missed on the host CMake raises a fatal error now.

It is possible to provide a full path to the 'make' tool via 'Make_EXECUTABLE' CMake variable through the command line:

  cmake -DMake_EXECUTABLE=c:\path\to\make.exe ...

The found tool gets passed into the lldb testsuite scripts using a newly added argument --make. This option also can be used directly via LLDB_TEST_USER_ARGS CMake configuraion parameter:

  cmake ...
    -DLLDB_TEST_USER_ARGS="...;--make;C:\\Path\\to\\make.exe;..."
    ...

These options are useful on the Windows build hosts.

Because the 'make' tool is required to run the lldb testsuite a detection of this
program was added to the CMake script. If 'make' tool is missed on the host
CMake raises a fatal error now.

It is possible to provide a full path to the 'make' tool via 'Make_EXECUTABLE'
CMake variable through the command line:

```
  cmake -DMake_EXECUTABLE=c:\path\to\make.exe ...
```

The found tool gets passed into the lldb testsuite scripts using a newly added
argument --make. This option also can be used directly via LLDB_TEST_USER_ARGS
CMake configuraion parameter:

```
  cmake ...
    -DLLDB_TEST_USER_ARGS="...;--make;C:\\Path\\to\\make.exe;..."
    ...
```

These options are useful on the Windows build hosts.
@vvereschaka vvereschaka self-assigned this May 25, 2024
@llvmbot
Copy link
Member

llvmbot commented May 25, 2024

@llvm/pr-subscribers-lldb

Author: Vladimir Vereschaka (vvereschaka)

Changes

Because the 'make' tool is required to run the lldb testsuite a detection of this program was added to the CMake script. If 'make' tool is missed on the host CMake raises a fatal error now.

It is possible to provide a full path to the 'make' tool via 'Make_EXECUTABLE' CMake variable through the command line:

  cmake -DMake_EXECUTABLE=c:\path\to\make.exe ...

The found tool gets passed into the lldb testsuite scripts using a newly added argument --make. This option also can be used directly via LLDB_TEST_USER_ARGS CMake configuraion parameter:

  cmake ...
    -DLLDB_TEST_USER_ARGS="...;--make;C:\\Path\\to\\make.exe;..."
    ...

These options are useful on the Windows build hosts.


Full diff: https://github.com/llvm/llvm-project/pull/93367.diff

11 Files Affected:

  • (modified) lldb/packages/Python/lldbsuite/test/builders/builder.py (+3-1)
  • (modified) lldb/packages/Python/lldbsuite/test/configuration.py (+1)
  • (modified) lldb/packages/Python/lldbsuite/test/dotest.py (+2)
  • (modified) lldb/packages/Python/lldbsuite/test/dotest_args.py (+6)
  • (modified) lldb/test/API/lit.cfg.py (+3)
  • (modified) lldb/test/API/lit.site.cfg.py.in (+1)
  • (modified) lldb/test/CMakeLists.txt (+10)
  • (modified) lldb/test/Shell/lit.site.cfg.py.in (+1)
  • (modified) lldb/test/Unit/lit.site.cfg.py.in (+1)
  • (modified) lldb/test/lit.site.cfg.py.in (+1)
  • (modified) lldb/utils/lldb-dotest/lldb-dotest.in (+3)
diff --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py
index 21ea3530e24fc..178ce8bc3c490 100644
--- a/lldb/packages/Python/lldbsuite/test/builders/builder.py
+++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py
@@ -40,7 +40,9 @@ def getMake(self, test_subdir, test_name):
         """Returns the invocation for GNU make.
         The first argument is a tuple of the relative path to the testcase
         and its filename stem."""
-        if platform.system() == "FreeBSD" or platform.system() == "NetBSD":
+        if configuration.make_path is not None:
+            make = configuration.make_path
+        elif platform.system() == "FreeBSD" or platform.system() == "NetBSD":
             make = "gmake"
         else:
             make = "make"
diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py
index dbd4a2d72a15d..27eef040497d1 100644
--- a/lldb/packages/Python/lldbsuite/test/configuration.py
+++ b/lldb/packages/Python/lldbsuite/test/configuration.py
@@ -43,6 +43,7 @@
 compiler = None
 dsymutil = None
 sdkroot = None
+make_path = None
 
 # The overriden dwarf verison.
 dwarf_version = 0
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index 2e537e3fd3ce0..42b39bc6e2f7b 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -266,6 +266,8 @@ def parseOptionsAndInitTestdirs():
                     configuration.compiler = candidate
                     break
 
+    if args.make:
+        configuration.make_path = args.make
     if args.dsymutil:
         configuration.dsymutil = args.dsymutil
     elif platform_system == "Darwin":
diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py
index 8b00c7a4d56e7..a0a840416c567 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -87,6 +87,12 @@ def create_parser():
         ),
     )
 
+    group.add_argument(
+        "--make",
+        metavar="make",
+        dest="make",
+        help=textwrap.dedent("Specify which make to use."),
+    )
     group.add_argument(
         "--dsymutil",
         metavar="dsymutil",
diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index d934349fe3ca3..ce8ae0c3b2341 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -227,6 +227,9 @@ def delete_module_cache(path):
 if is_configured("lldb_executable"):
     dotest_cmd += ["--executable", config.lldb_executable]
 
+if is_configured("make_executable"):
+    dotest_cmd += ["--make", config.make_executable]
+
 if is_configured("test_compiler"):
     dotest_cmd += ["--compiler", config.test_compiler]
 
diff --git a/lldb/test/API/lit.site.cfg.py.in b/lldb/test/API/lit.site.cfg.py.in
index 8b2d09ae41cd2..d4cadd5440a8a 100644
--- a/lldb/test/API/lit.site.cfg.py.in
+++ b/lldb/test/API/lit.site.cfg.py.in
@@ -21,6 +21,7 @@ config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.lldb_build_directory = "@LLDB_TEST_BUILD_DIRECTORY@"
 config.python_executable = "@Python3_EXECUTABLE@"
 config.lua_executable = "@Lua_EXECUTABLE@"
+config.make_executable = "@Make_EXECUTABLE@"
 config.lua_test_entry = "TestLuaAPI.py"
 config.dotest_common_args_str = lit_config.substitute("@LLDB_TEST_COMMON_ARGS@")
 config.dotest_user_args_str = lit_config.substitute("@LLDB_TEST_USER_ARGS@")
diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt
index 6a9ca59f96b0f..8a2966d43f60d 100644
--- a/lldb/test/CMakeLists.txt
+++ b/lldb/test/CMakeLists.txt
@@ -9,6 +9,16 @@ if (NOT DEFINED Python3_EXECUTABLE)
     "`LLDB_INCLUDE_TESTS=OFF`.")
 endif()
 
+if (NOT DEFINED Make_EXECUTABLE)
+  find_program(Make_EXECUTABLE NAMES make
+               PATH_SUFFIXES bin
+               DOC "Make build tool"
+               # Avoid searching with CMAKE_SYSROOT for the target platform.
+               # The target platform could be a binary incompatible.
+               NO_CMAKE_FIND_ROOT_PATH
+               REQUIRED)
+endif()
+
 if(LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS)
   message(STATUS "Enforcing strict test requirements for LLDB")
   # Lit uses psutil to do per-test timeouts.
diff --git a/lldb/test/Shell/lit.site.cfg.py.in b/lldb/test/Shell/lit.site.cfg.py.in
index b69e7bce1bc0b..e6385842e900e 100644
--- a/lldb/test/Shell/lit.site.cfg.py.in
+++ b/lldb/test/Shell/lit.site.cfg.py.in
@@ -16,6 +16,7 @@ config.lldb_lit_tools_dir = lit_config.substitute(r"@LLDB_LIT_TOOLS_DIR@")
 config.cmake_sysroot = lit_config.substitute("@CMAKE_SYSROOT@")
 config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.python_executable = "@Python3_EXECUTABLE@"
+config.make_executable = "@Make_EXECUTABLE@"
 config.have_zlib = @LLVM_ENABLE_ZLIB@
 config.objc_gnustep_dir = "@LLDB_TEST_OBJC_GNUSTEP_DIR@"
 config.lldb_enable_lzma = @LLDB_ENABLE_LZMA@
diff --git a/lldb/test/Unit/lit.site.cfg.py.in b/lldb/test/Unit/lit.site.cfg.py.in
index b22af0f381439..dabf033b11f02 100644
--- a/lldb/test/Unit/lit.site.cfg.py.in
+++ b/lldb/test/Unit/lit.site.cfg.py.in
@@ -10,6 +10,7 @@ config.lldb_obj_root = "@LLDB_BINARY_DIR@"
 config.lldb_src_root = "@LLDB_SOURCE_DIR@"
 config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.python_executable = "@Python3_EXECUTABLE@"
+config.make_executable = "@Make_EXECUTABLE@"
 
 import lit.llvm
 lit.llvm.initialize(lit_config, config)
diff --git a/lldb/test/lit.site.cfg.py.in b/lldb/test/lit.site.cfg.py.in
index 5e1f60920638a..7eb0cea47efc0 100644
--- a/lldb/test/lit.site.cfg.py.in
+++ b/lldb/test/lit.site.cfg.py.in
@@ -10,6 +10,7 @@ config.lldb_obj_root = "@LLDB_BINARY_DIR@"
 config.lldb_src_root = "@LLDB_SOURCE_DIR@"
 config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.python_executable = "@Python3_EXECUTABLE@"
+config.make_executable = "@Make_EXECUTABLE@"
 
 import lit.llvm
 lit.llvm.initialize(lit_config, config)
diff --git a/lldb/utils/lldb-dotest/lldb-dotest.in b/lldb/utils/lldb-dotest/lldb-dotest.in
index 0e9648a6e6dc8..62a27fddb1933 100755
--- a/lldb/utils/lldb-dotest/lldb-dotest.in
+++ b/lldb/utils/lldb-dotest/lldb-dotest.in
@@ -19,6 +19,7 @@ has_libcxx = @LLDB_HAS_LIBCXX@
 libcxx_libs_dir = "@LIBCXX_LIBRARY_DIR@"
 libcxx_include_dir = "@LIBCXX_GENERATED_INCLUDE_DIR@"
 libcxx_include_target_dir = "@LIBCXX_GENERATED_INCLUDE_TARGET_DIR@"
+make_executable = "@Make_EXECUTABLE@"
 
 if __name__ == '__main__':
     wrapper_args = sys.argv[1:]
@@ -46,6 +47,8 @@ if __name__ == '__main__':
         cmd.extend(['--framework', lldb_framework_dir])
     if lldb_build_intel_pt == "1":
         cmd.extend(['--enable-plugin', 'intel-pt'])
+    if make_executable:
+        cmd.extend(['--make', make_executable])
     cmd.extend(['--lldb-obj-root', lldb_obj_root])
     cmd.extend(wrapper_args)
     # Invoke dotest.py and return exit code.

@vvereschaka vvereschaka deleted the lldb/make-executable branch May 28, 2025 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants