[test-suite] r254129 - lit: Parse stdout/stderr redirection in script

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 25 19:35:28 PST 2015


Author: matze
Date: Wed Nov 25 21:35:28 2015
New Revision: 254129

URL: http://llvm.org/viewvc/llvm-project?rev=254129&view=rev
Log:
lit: Parse stdout/stderr redirection in script

Modified:
    test-suite/trunk/lit.cfg

Modified: test-suite/trunk/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/lit.cfg?rev=254129&r1=254128&r2=254129&view=diff
==============================================================================
--- test-suite/trunk/lit.cfg (original)
+++ test-suite/trunk/lit.cfg Wed Nov 25 21:35:28 2015
@@ -81,15 +81,33 @@ def runScript(test, litConfig, script, t
     return res
 
 def prepareRunSafely(config, commandline, outfile):
-    stdin = "/dev/null"
+    stdin = None
+    stdout = None
+    stderr = None
     tokens = shlex.split(commandline)
+    # Parse "< INPUTFILE", "> OUTFILE", "2> OUTFILE" patterns
     for i in range(len(tokens)):
-        # Detect "< INPUTFILE" pattern
         if tokens[i] == "<" and i+1 < len(tokens):
             stdin = tokens[i+1]
             del tokens[i+1]
             del tokens[i]
             break
+        elif tokens[i] == ">" and i+1 < len(tokens):
+            stdout = tokens[i+1]
+            del tokens[i+1]
+            del tokens[i]
+            break
+        elif tokens[i] == "2>" and i+1 < len(tokens):
+            stderr = tokens[i+1]
+            del tokens[i+1]
+            del tokens[i]
+            break
+
+    if stdin is None:
+        stdin = "/dev/null"
+    if stdout is not None or stderr is not None:
+        raise Exception("stdout/stderr redirection in combination with RunSafely not implemented yet")
+
     timeit = "%s/tools/timeit" % config.test_source_root
     runsafely = "%s/RunSafely.sh" % config.test_suite_root
     timeout = "7200"




More information about the llvm-commits mailing list