Skip to content

[lldb][test] Add --target-os argument to dotest.py #93887

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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lldb/packages/Python/lldbsuite/test/builders/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ def getArchCFlags(self, architecture):
"""Returns the ARCH_CFLAGS for the make system."""
return []

def getTargetOsFlag(self, target_os):
if target_os is None:
target_os = configuration.target_os
if target_os is None:
return []
return ["OS=%s" % target_os]

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
Expand Down Expand Up @@ -171,6 +178,7 @@ def getBuildCommand(
testdir=None,
testname=None,
make_targets=None,
target_os=None,
):
debug_info_args = self._getDebugInfoArgs(debug_info)
if debug_info_args is None:
Expand All @@ -182,6 +190,7 @@ def getBuildCommand(
debug_info_args,
make_targets,
self.getArchCFlags(architecture),
self.getTargetOsFlag(target_os),
self.getArchSpec(architecture),
self.getCCSpec(compiler),
self.getExtraMakeArgs(),
Expand Down
1 change: 1 addition & 0 deletions lldb/packages/Python/lldbsuite/test/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
count = 1

# The 'arch' and 'compiler' can be specified via command line.
target_os = None
arch = None
compiler = None
dsymutil = None
Expand Down
3 changes: 3 additions & 0 deletions lldb/packages/Python/lldbsuite/test/dotest.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ def parseOptionsAndInitTestdirs():
logging.error("No SDK found with the name %s; aborting...", args.apple_sdk)
sys.exit(-1)

if args.target_os:
configuration.target_os = args.target_os

if args.arch:
configuration.arch = args.arch
else:
Expand Down
9 changes: 9 additions & 0 deletions lldb/packages/Python/lldbsuite/test/dotest_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ def create_parser():

# C and Python toolchain options
group = parser.add_argument_group("Toolchain options")
group.add_argument(
"--target-os",
metavar="target_os",
dest="target_os",
default="",
help=textwrap.dedent(
"""Specify target os for test compilation. This is useful for cross-compilation."""
),
)
group.add_argument(
"-A",
"--arch",
Expand Down
4 changes: 4 additions & 0 deletions lldb/packages/Python/lldbsuite/test/lldbtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1454,11 +1454,15 @@ def getDebugInfo(self):
def build(
self,
debug_info=None,
target_os=None,
architecture=None,
compiler=None,
dictionary=None,
make_targets=None,
):
if not target_os and configuration.target_os:
target_os = configuration.target_os

"""Platform specific way to build binaries."""
if not architecture and configuration.arch:
architecture = configuration.arch
Expand Down
Loading