[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 15:16:45 PST 2016


fjricci marked an inline comment as done.

================
Comment at: packages/Python/lldbsuite/test/plugins/builder_base.py:30-39
@@ -26,1 +29,12 @@
+    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
 
----------------
zturner wrote:
> This works, but I think it could be better.  It sounds like what you really want to do is resolve the symlink.  What about this:
> 
>     def getCompiler():
>         compiler = os.environ.get("CC", "clang")
>         return os.path.realpath(compiler)
That works, and is much cleaner, thanks!


http://reviews.llvm.org/D16488





More information about the llvm-commits mailing list