[Lldb-commits] [PATCH] Append to CFLAGS_EXTRAS and LD_EXTRAS when building cmdline.

Robert Flack flackr at gmail.com
Thu Apr 9 17:10:32 PDT 2015


Hi clayborg,

When building the command-line for compilations during tests, append to CFLAGS_EXTRAS and LD_EXTRAS to preserve switches set by the environment (i.e. for cross compiling to test on another platform).

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8942

Files:
  test/plugins/builder_base.py

Index: test/plugins/builder_base.py
===================================================================
--- test/plugins/builder_base.py
+++ test/plugins/builder_base.py
@@ -78,8 +78,20 @@
     # If d is None or an empty mapping, just return an empty string.
     if not d:
         return ""
-    pattern = '%s="%s"' if "win32" in sys.platform else "%s='%s'"
-    cmdline = " ".join([pattern % (k, v) for k, v in d.items()])
+
+    def setOrAppendVariable(k, v):
+        """
+        Append to EXTRAS variables as clobbering them unsets extra flags passed
+        for cross compilation.
+        """
+        append_vars = ["CFLAGS_EXTRAS", "LD_EXTRAS"]
+        if k in append_vars and os.environ.has_key(k):
+            v = os.environ[k] + " " + v
+
+        pattern = '%s="%s"' if "win32" in sys.platform else "%s='%s'"
+        return pattern % (k, v)
+
+    cmdline = " ".join([setOrAppendVariable(k, v) for k, v in d.items()])
 
     return cmdline

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8942.23546.patch
Type: text/x-patch
Size: 961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150410/8341617d/attachment.bin>


More information about the lldb-commits mailing list