[PATCH] D16488: Fix getCompiler in unit testing framework on compiler symlinks

Francis Ricci via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 22 14:25:52 PST 2016


fjricci updated this revision to Diff 45745.
fjricci added a comment.

Accidentally ran clang-format, fix an indentation error


http://reviews.llvm.org/D16488

Files:
  packages/Python/lldbsuite/test/plugins/builder_base.py

Index: packages/Python/lldbsuite/test/plugins/builder_base.py
===================================================================
--- packages/Python/lldbsuite/test/plugins/builder_base.py
+++ packages/Python/lldbsuite/test/plugins/builder_base.py
@@ -15,14 +15,28 @@
 import os, sys
 import platform
 import lldbsuite.test.lldbtest as lldbtest
+from subprocess import check_output, STDOUT
 
 def getArchitecture():
     """Returns the architecture in effect the test suite is running with."""
     return os.environ["ARCH"] if "ARCH" in os.environ else ""
 
 def getCompiler():
     """Returns the compiler in effect the test suite is running with."""
-    return os.environ["CC"] if "CC" in os.environ else "clang"
+    if not "CC" in os.environ:
+      return "clang"
+
+    compiler = os.environ["CC"]
+    if "gcc" in compiler or "clang" in compiler:
+      return compiler
+
+    version = check_output([compiler, "-v"], stderr=STDOUT);
+    if version.find("clang") != -1:
+      return "clang"
+    if version.find("gcc") != -1:
+      return "gcc"
+
+    return compiler
 
 def getArchFlag():
     """Returns the flag required to specify the arch"""


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16488.45745.patch
Type: text/x-patch
Size: 1159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160122/2b2e5c81/attachment.bin>


More information about the llvm-commits mailing list