[llvm-commits] [llvm] r97728 - /llvm/trunk/utils/lit/lit/TestRunner.py

John McCall rjmccall at apple.com
Thu Mar 4 03:48:42 PST 2010


Author: rjmccall
Date: Thu Mar  4 05:48:42 2010
New Revision: 97728

URL: http://llvm.org/viewvc/llvm-project?rev=97728&view=rev
Log:
Simplify the condition-checking logic and hopefully clear up a build failure
that somehow got through my testing.


Modified:
    llvm/trunk/utils/lit/lit/TestRunner.py

Modified: llvm/trunk/utils/lit/lit/TestRunner.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestRunner.py?rev=97728&r1=97727&r2=97728&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Thu Mar  4 05:48:42 2010
@@ -353,6 +353,8 @@
 
     return True
 
+import re
+
 def parseIntegratedTestScript(test):
     """parseIntegratedTestScript - Scan an LLVM/Clang style integrated test
     script and extract the lines to 'RUN' as well as 'XFAIL' and 'XTARGET'
@@ -387,20 +389,11 @@
     xtargets = []
     ignoredAny = False
     for ln in open(sourcepath):
-        if 'IF(' in ln:
-            # Required syntax here is IF(condition(value)):
-            index = ln.index('IF(')
-            ln = ln[index+3:]
-            index = ln.index('(')
-            if index is -1:
-                return (Test.UNRESOLVED, "ill-formed IF at '"+ln[:10]+"'")
-            condition = ln[:index]
-            ln = ln[index+1:]
-            index = ln.index(')')
-            if index is -1 or ln[index:index+3] != ')):':
-                return (Test.UNRESOLVED, "ill-formed IF at '"+ln[:10]+"'")
-            value = ln[:index]
-            ln = ln[index+3:]
+        conditional = re.search('IF\((.+?)\((.+?)\)\):', ln)
+        if conditional:
+            ln = ln[conditional.end():]
+            condition = conditional.group(1)
+            value = conditional.group(2)
 
             # Actually test the condition.
             if condition not in test.config.conditions:





More information about the llvm-commits mailing list