Skip to content

Commit 4118522

Browse files
committed
[lldb] Explicitly use the configuration architecture when building test executables
The Darwin builder currently assumes in `getArchCFlags` that the passed `arch` value is an actual string it can string.join with vendor/os/version/env strings: ``` triple = '-'.join([arch, vendor, os, version, env]) ``` However this is not true for most tests as we just pass down the `arch=None` default value from `TestBase.build`. This causes that if we actually end up in this function we just error out when concatenating `None` with the other actual strings of vendor/os/version/env. What we should do instead is check that if there is no test-specific architecture that we fall back to the configuration's architecture value. It seems we already worked around this in `builder.getArchSpec` by explicitly falling back to the architecture specified in the configuration. This patch just moves this fallback logic to the top `build` function so that it affects all functions called from `TestBase.build`. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D89056
1 parent e4b4543 commit 4118522

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

lldb/packages/Python/lldbsuite/test/builders/builder.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,7 @@ def getArchSpec(self, architecture):
9393
Helper function to return the key-value string to specify the architecture
9494
used for the make system.
9595
"""
96-
arch = architecture if architecture else None
97-
if not arch and configuration.arch:
98-
arch = configuration.arch
99-
100-
return ("ARCH=" + arch) if arch else ""
96+
return ("ARCH=" + architecture) if architecture else ""
10197

10298
def getCCSpec(self, compiler):
10399
"""

lldb/packages/Python/lldbsuite/test/lldbtest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2606,6 +2606,9 @@ def build(
26062606
"""Platform specific way to build the default binaries."""
26072607
module = builder_module()
26082608

2609+
if not architecture and configuration.arch:
2610+
architecture = configuration.arch
2611+
26092612
dictionary = lldbplatformutil.finalize_build_dictionary(dictionary)
26102613
if self.getDebugInfo() is None:
26112614
return self.buildDefault(architecture, compiler, dictionary)

0 commit comments

Comments
 (0)