[llvm] r251478 - lit/TestRunner.py: Make parseIntegratedTestScriptCommands() keyword list a parameter; NFC

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 27 19:36:35 PDT 2015


Author: matze
Date: Tue Oct 27 21:36:35 2015
New Revision: 251478

URL: http://llvm.org/viewvc/llvm-project?rev=251478&view=rev
Log:
lit/TestRunner.py: Make parseIntegratedTestScriptCommands() keyword list a parameter; NFC

This allows the function to be easily reused and also simplifies the
code as the keyword list is next to the keyword handling now.

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=251478&r1=251477&r2=251478&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestRunner.py (original)
+++ llvm/trunk/utils/lit/lit/TestRunner.py Tue Oct 27 21:36:35 2015
@@ -362,7 +362,7 @@ def executeScript(test, litConfig, tmpBa
     return lit.util.executeCommand(command, cwd=cwd,
                                    env=test.config.environment)
 
-def parseIntegratedTestScriptCommands(source_path):
+def parseIntegratedTestScriptCommands(source_path, keywords):
     """
     parseIntegratedTestScriptCommands(source_path) -> commands
 
@@ -381,7 +381,6 @@ def parseIntegratedTestScriptCommands(so
     # remaining code can work with "strings" agnostic of the executing Python
     # version.
 
-    keywords = ['RUN:', 'XFAIL:', 'REQUIRES:', 'UNSUPPORTED:', 'END.']
     keywords_re = re.compile(
         to_bytes("(%s)(.*)\n" % ("|".join(k for k in keywords),)))
 
@@ -469,8 +468,9 @@ def parseIntegratedTestScript(test, norm
     script = []
     requires = []
     unsupported = []
+    keywords = ['RUN:', 'XFAIL:', 'REQUIRES:', 'UNSUPPORTED:', 'END.']
     for line_number, command_type, ln in \
-            parseIntegratedTestScriptCommands(sourcepath):
+            parseIntegratedTestScriptCommands(sourcepath, keywords):
         if command_type == 'RUN':
             # Trim trailing whitespace.
             ln = ln.rstrip()




More information about the llvm-commits mailing list