From: Matthias Braun <matze@braunis.de>
Date: Wed, 28 Oct 2015 02:36:35 +0000 (+0000)
Subject: lit/TestRunner.py: Make parseIntegratedTestScriptCommands() keyword list a parameter... 
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=172572b6557b37a5c5b27140058e9625001245b3;p=oota-llvm.git

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.

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

diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py
index 24075ff9404..548081225be 100644
--- a/utils/lit/lit/TestRunner.py
+++ b/utils/lit/lit/TestRunner.py
@@ -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()