[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:24:51 PST 2016
fjricci created this revision.
fjricci added reviewers: zturner, emaste.
fjricci added subscribers: sas, llvm-commits.
Checks using the result of getCompiler() will fail to identify the compiler
correctly if CC is a symlink path (ie /usr/bin/cc).
Use "CC" -v to determine the actual compiler type in these cases.
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.45743.patch
Type: text/x-patch
Size: 1155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160122/57a22d13/attachment.bin>
More information about the llvm-commits
mailing list