[test-suite] r340225 - litsupport: Fix stdout/stderr redirection in combination with chdir

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 15:34:21 PDT 2018


Author: matze
Date: Mon Aug 20 15:34:21 2018
New Revision: 340225

URL: http://llvm.org/viewvc/llvm-project?rev=340225&view=rev
Log:
litsupport: Fix stdout/stderr redirection in combination with chdir

We failed to take the work directory into account when specifying
relative paths for stdout/stderr redirection.

This wasn't a problem before as we didn't use any relative paths so far,
but I plan to introduce some in an upcoming patch.

Modified:
    test-suite/trunk/litsupport/modules/timeit.py

Modified: test-suite/trunk/litsupport/modules/timeit.py
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/litsupport/modules/timeit.py?rev=340225&r1=340224&r2=340225&view=diff
==============================================================================
--- test-suite/trunk/litsupport/modules/timeit.py (original)
+++ test-suite/trunk/litsupport/modules/timeit.py Mon Aug 20 15:34:21 2018
@@ -18,12 +18,19 @@ def _mutateCommandLine(context, commandl
     args += ["--timeout", "7200"]
     args += ["--limit-file-size", "104857600"]
     args += ["--limit-rss-size", "838860800"]
+    workdir = cmd.workdir
     if not config.traditional_output:
+        stdout = cmd.stdout
         if cmd.stdout is not None:
-            args += ["--redirect-stdout", cmd.stdout]
+            if not os.path.isabs(stdout) and workdir is not None:
+                stdout = os.path.join(workdir, stdout)
+            args += ["--redirect-stdout", stdout]
             cmd.stdout = None
-        if cmd.stderr is not None:
-            args += ["--redirect-stderr", cmd.stderr]
+        stderr = cmd.stderr
+        if stderr is not None:
+            if not os.path.isabs(stderr) and workdir is not None:
+                stderr = os.path.join(workdir, stderr)
+            args += ["--redirect-stderr", stderr]
             cmd.stderr = None
     else:
         if cmd.stdout is not None or cmd.stderr is not None:
@@ -32,7 +39,6 @@ def _mutateCommandLine(context, commandl
         args += ["--append-exitstatus"]
         args += ["--redirect-output", outfile]
     stdin = cmd.stdin
-    workdir = cmd.workdir
     if stdin is not None:
         if not os.path.isabs(stdin) and workdir is not None:
             stdin = os.path.join(workdir, stdin)




More information about the llvm-commits mailing list