lit/TestRunner.py: Make parseIntegratedTestScriptCommands() keyword list a parameter...
authorMatthias Braun <matze@braunis.de>
Wed, 28 Oct 2015 02:36:35 +0000 (02:36 +0000)
committerMatthias Braun <matze@braunis.de>
Wed, 28 Oct 2015 02:36:35 +0000 (02:36 +0000)
This allows the function to be easily reused and also simplifies the
code as the keyword list is next to the keyword handling now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251478 91177308-0d34-0410-b5e6-96231b3b80d8

utils/lit/lit/TestRunner.py

index 24075ff94048e4667001db56bb1dff03ee732948..548081225be08cc1d5547d4341756610fd8678dd 100644 (file)
@@ -362,7 +362,7 @@ def executeScript(test, litConfig, tmpBase, commands, cwd):
     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(source_path):
     # 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, normalize_slashes=False,
     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()