[Lldb-commits] [lldb] r183415 - Reworked the routine that qualifies the tool-chain for expected failures to handle sub-strings.

Ashok Thirumurthi ashok.thirumurthi at intel.com
Thu Jun 6 07:23:32 PDT 2013


Author: athirumu
Date: Thu Jun  6 09:23:31 2013
New Revision: 183415

URL: http://llvm.org/viewvc/llvm-project?rev=183415&view=rev
Log:
Reworked the routine that qualifies the tool-chain for expected failures to handle sub-strings.
- For instance, allows 'gcc' to match x86-64-linux-gnu-gcc as required on some Debian builds.
- Also adds doc-strings and a more consistent naming convention for related helpers.

Modified:
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=183415&r1=183414&r2=183415&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Thu Jun  6 09:23:31 2013
@@ -381,7 +381,7 @@ def expectedFailureGcc(bugnumber=None, c
             try:
                 bugnumber(*args, **kwargs)
             except Exception:
-                if "gcc" in test_compiler and self.expectedVersion(compiler_version):
+                if "gcc" in test_compiler and self.expectedCompilerVersion(compiler_version):
                     raise case._ExpectedFailure(sys.exc_info(),None)
                 else:
                     raise
@@ -398,7 +398,7 @@ def expectedFailureGcc(bugnumber=None, c
                 try:
                     func(*args, **kwargs)
                 except Exception:
-                    if "gcc" in test_compiler and self.expectedVersion(compiler_version):
+                    if "gcc" in test_compiler and self.expectedCompilerVersion(compiler_version):
                         raise case._ExpectedFailure(sys.exc_info(),bugnumber)
                     else:
                         raise
@@ -1182,8 +1182,12 @@ class Base(unittest2.TestCase):
                 version = m.group(1)
         return version
 
-    def expectedVersion(self, compiler_version):
-        """Determines if compiler_version matches the current tool chain."""
+    def expectedCompilerVersion(self, compiler_version):
+        """Returns True iff compiler_version[1] matches the current compiler version.
+           Use compiler_version[0] to specify the operator used to determine if a match has occurred.
+           Any operator other than the following defaults to an equality test:
+             '>', '>=', "=>", '<', '<=', '=<', '!=', "!" or 'not'
+        """
         if (compiler_version == None):
             return True
         operator = str(compiler_version[0])
@@ -1204,9 +1208,15 @@ class Base(unittest2.TestCase):
         return str(version) in str(self.getCompilerVersion())
 
     def expectedCompiler(self, compilers):
+        """Returns True iff any element of compilers is a sub-string of the current compiler."""
         if (compilers == None):
             return True
-        return self.getCompiler() in compilers
+
+        for compiler in compilers:
+            if compiler in self.getCompiler():
+                return True
+
+        return False
 
     def getRunOptions(self):
         """Command line option for -A and -C to run this test again, called from





More information about the lldb-commits mailing list