[Lldb-commits] [lldb] r259484 - Fix compiler lookup when specified without path

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 2 01:49:37 PST 2016

Author: labath
Date: Tue Feb  2 03:49:37 2016
New Revision: 259484

URL: http://llvm.org/viewvc/llvm-project?rev=259484&view=rev
Fix compiler lookup when specified without path

r259433 introduced a regression, where if a compiler is specified without a path (e.g., CC=clang,
relying on the fact that clang is in $PATH), then the test suite would fail (at the compiler
version detection step) because realpath would interpret this as a path relative to cwd). The fix
is to perform the $PATH expansion (via `which`) before the realpath step.


Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=259484&r1=259483&r2=259484&view=diff
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Tue Feb  2 03:49:37 2016
@@ -1945,11 +1945,10 @@ class Base(unittest2.TestCase):
         """ Returns a string that represents the compiler version.
             Supports: llvm, clang.
-        from .lldbutil import which
         version = 'unknown'
         compiler = self.getCompilerBinary()
-        version_output = system([[which(compiler), "-v"]])[1]
+        version_output = system([[compiler, "-v"]])[1]
         for line in version_output.split(os.linesep):
             m = re.search('version ([0-9\.]+)', line)
             if m:

Modified: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py?rev=259484&r1=259483&r2=259484&view=diff
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py Tue Feb  2 03:49:37 2016
@@ -15,6 +15,7 @@ variable.
 import os, sys
 import platform
 import lldbsuite.test.lldbtest as lldbtest
+import lldbsuite.test.lldbutil as lldbutil
 def getArchitecture():
     """Returns the architecture in effect the test suite is running with."""
@@ -23,6 +24,7 @@ def getArchitecture():
 def getCompiler():
     """Returns the compiler in effect the test suite is running with."""
     compiler = os.environ.get("CC", "clang")
+    compiler = lldbutil.which(compiler)
     return os.path.realpath(compiler)
 def getArchFlag():

More information about the lldb-commits mailing list