[Lldb-commits] [lldb] 4118522 - [lldb] Explicitly use the configuration architecture when building test executables

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 22 06:30:45 PDT 2020


Author: Raphael Isemann
Date: 2020-10-22T15:30:25+02:00
New Revision: 41185226f6d80663b4a1064c6f47581ee567d78d

URL: https://github.com/llvm/llvm-project/commit/41185226f6d80663b4a1064c6f47581ee567d78d
DIFF: https://github.com/llvm/llvm-project/commit/41185226f6d80663b4a1064c6f47581ee567d78d.diff

LOG: [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

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/builders/builder.py
    lldb/packages/Python/lldbsuite/test/lldbtest.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py
index fbfa86700e22..6c9584224f4a 100644
--- a/lldb/packages/Python/lldbsuite/test/builders/builder.py
+++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py
@@ -93,11 +93,7 @@ def getArchSpec(self, architecture):
         Helper function to return the key-value string to specify the architecture
         used for the make system.
         """
-        arch = architecture if architecture else None
-        if not arch and configuration.arch:
-            arch = configuration.arch
-
-        return ("ARCH=" + arch) if arch else ""
+        return ("ARCH=" + architecture) if architecture else ""
 
     def getCCSpec(self, compiler):
         """

diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 69da3914f1f2..f469ce86f26e 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -2606,6 +2606,9 @@ def build(
         """Platform specific way to build the default binaries."""
         module = builder_module()
 
+        if not architecture and configuration.arch:
+            architecture = configuration.arch
+
         dictionary = lldbplatformutil.finalize_build_dictionary(dictionary)
         if self.getDebugInfo() is None:
             return self.buildDefault(architecture, compiler, dictionary)


        


More information about the lldb-commits mailing list