Hi dmalea,

This patch fixes the following unit tests when the lldb unit tests are run on 
ubuntu
    TestAnonymous.py
    TestSharedLib.py
    TestSharedLibStrippedSymbols.py
    TestUniqueTypes.py

The unit tests fail when lldb is configured/built with cache or when the 
individual unit tests are built with cache.  Under these conditions, the 
"compiler" variable in lldbtest.py's getCompilerVersion() contains the ccache 
prefix or compiler options in addition to the compiler name.  The which() 
function in lldbutil does not handle multiple words well and returns "None" - 
even though clang is embedded in the compiler name.

This patch strips off any prefixes and/or options by looking for the last word 
in the compiler variable that appears to be an executable and then discarding 
everything else.

Doug

http://reviews.llvm.org/D6007

Files:
  test/lldbtest.py
Index: test/lldbtest.py
===================================================================
--- test/lldbtest.py
+++ test/lldbtest.py
@@ -1193,6 +1193,18 @@
         version = 'unknown'
 
         compiler = self.getCompiler()
+
+        # strip off leading spaces, prefixes (e.g. ccache, distcc, etc.) and 
+        # trailing complier options to create a single-word compiler name.
+        # otherwise, unit tests will fail if:
+        #     1) check-lldb is configured/built w/ ccache
+        #     2) they are built w/ ccache
+        compiler_split = compiler.split(" ")
+        for word in reversed(compiler_split) :
+            if which(word) != None :
+                compiler = word
+                break
+
         version_output = system([[which(compiler), "-v"]])[1]
         for line in version_output.split(os.linesep):
             m = re.search('version ([0-9\.]+)', line)
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to