Skip to content

Conversation

@dzhidzhoev
Copy link
Member

This argument allows to set specific sysroot pass which will be used for building LLDB API test programs.
It might come in handy for setting up cross-platform remote runs of API tests on Windows host.

It can be useful for cross-compiling LLDB API tests. The argument can be set using LLDB_TEST_USER_ARGS argument:

cmake ...
-DLLDB_TEST_USER_ARGS="...;--sysroot;C:\path\to\sysroot;..."
...

@llvmbot
Copy link
Member

llvmbot commented May 30, 2024

@llvm/pr-subscribers-lldb

Author: Vladislav Dzhidzhoev (dzhidzhoev)

Changes

This argument allows to set specific sysroot pass which will be used for building LLDB API test programs.
It might come in handy for setting up cross-platform remote runs of API tests on Windows host.

It can be useful for cross-compiling LLDB API tests. The argument can be set using LLDB_TEST_USER_ARGS argument:

cmake ...
-DLLDB_TEST_USER_ARGS="...;--sysroot;C:\path\to\sysroot;..."
...

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

2 Files Affected:

  • (modified) lldb/packages/Python/lldbsuite/test/dotest.py (+3-1)
  • (modified) lldb/packages/Python/lldbsuite/test/dotest_args.py (+9)
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index 2e537e3fd3ce0..70bc1d85091bc 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -304,7 +304,9 @@ def parseOptionsAndInitTestdirs():
         lldbtest_config.out_of_tree_debugserver = args.out_of_tree_debugserver
 
     # Set SDKROOT if we are using an Apple SDK
-    if platform_system == "Darwin" and args.apple_sdk:
+    if args.sysroot is not None:
+        configuration.sdkroot = args.sysroot
+    elif platform_system == "Darwin" and args.apple_sdk:
         configuration.sdkroot = seven.get_command_output(
             'xcrun --sdk "%s" --show-sdk-path 2> /dev/null' % (args.apple_sdk)
         )
diff --git a/lldb/packages/Python/lldbsuite/test/dotest_args.py b/lldb/packages/Python/lldbsuite/test/dotest_args.py
index 8b00c7a4d56e7..e385954f8cc03 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest_args.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest_args.py
@@ -49,6 +49,15 @@ def create_parser():
             """Specify the compiler(s) used to build the inferior executables. The compiler path can be an executable basename or a full path to a compiler executable. This option can be specified multiple times."""
         ),
     )
+    group.add_argument(
+        "--sysroot",
+        metavar="sysroot",
+        dest="sysroot",
+        default="",
+        help=textwrap.dedent(
+            """Specify the path to sysroot. This overrides apple_sdk sysroot."""
+        ),
+    )
     if sys.platform == "darwin":
         group.add_argument(
             "--apple-sdk",

@dzhidzhoev dzhidzhoev closed this May 31, 2024
@dzhidzhoev dzhidzhoev force-pushed the lldb/dotest-arg-sysroot branch from d755025 to 5e423f1 Compare May 31, 2024 15:25
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.

3 participants