[Lldb-commits] [lldb] [lldb] Allow specific 'make' tool for LLDB testsuite. (PR #93367)

2024-05-24 Thread via lldb-commits

llvmbot wrote:




@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
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 

[Lldb-commits] [lldb] [lldb] Allow specific 'make' tool for LLDB testsuite. (PR #93367)

2024-05-24 Thread Vladimir Vereschaka via lldb-commits

https://github.com/vvereschaka created 
https://github.com/llvm/llvm-project/pull/93367

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.

>From 427d6d5a7ce14204ea09ba12934e93b9cefc9d63 Mon Sep 17 00:00:00 2001
From: Vladimir Vereschaka 
Date: Fri, 24 May 2024 21:01:45 -0700
Subject: [PATCH] [lldb] Allow specific 'make' tool for LLDB testsuite.

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.
---
 .../packages/Python/lldbsuite/test/builders/builder.py |  4 +++-
 lldb/packages/Python/lldbsuite/test/configuration.py   |  1 +
 lldb/packages/Python/lldbsuite/test/dotest.py  |  2 ++
 lldb/packages/Python/lldbsuite/test/dotest_args.py |  6 ++
 lldb/test/API/lit.cfg.py   |  3 +++
 lldb/test/API/lit.site.cfg.py.in   |  1 +
 lldb/test/CMakeLists.txt   | 10 ++
 lldb/test/Shell/lit.site.cfg.py.in |  1 +
 lldb/test/Unit/lit.site.cfg.py.in  |  1 +
 lldb/test/lit.site.cfg.py.in   |  1 +
 lldb/utils/lldb-dotest/lldb-dotest.in  |  3 +++
 11 files changed, 32 insertions(+), 1 deletion(-)

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