[test-suite] r338793 - litsupport/timeit: Fix relative paths for stdin

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 2 17:07:34 PDT 2018


Author: matze
Date: Thu Aug  2 17:07:33 2018
New Revision: 338793

URL: http://llvm.org/viewvc/llvm-project?rev=338793&view=rev
Log:
litsupport/timeit: Fix relative paths for stdin

A relative path specified for stdin should be relative to the
benchmarks workdir, not relativ to the path lit was started in.

None of the currently used paths in stdin are relative so this problem
didn't manifest itself before.

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=338793&r1=338792&r2=338793&view=diff
==============================================================================
--- test-suite/trunk/litsupport/modules/timeit.py (original)
+++ test-suite/trunk/litsupport/modules/timeit.py Thu Aug  2 17:07:33 2018
@@ -1,5 +1,6 @@
 from litsupport import shellcommand
 from litsupport import testplan
+import os
 import re
 
 
@@ -17,9 +18,6 @@ def _mutateCommandLine(context, commandl
     args += ["--timeout", "7200"]
     args += ["--limit-file-size", "104857600"]
     args += ["--limit-rss-size", "838860800"]
-    if cmd.workdir is not None:
-        args += ["--chdir", cmd.workdir]
-        cmd.workdir = None
     if not config.traditional_output:
         if cmd.stdout is not None:
             args += ["--redirect-stdout", cmd.stdout]
@@ -33,11 +31,18 @@ def _mutateCommandLine(context, commandl
                             "possible with traditional output")
         args += ["--append-exitstatus"]
         args += ["--redirect-output", outfile]
-    if cmd.stdin is not None:
-        args += ["--redirect-input", cmd.stdin]
+    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)
+        args += ["--redirect-input", stdin]
         cmd.stdin = None
     else:
         args += ["--redirect-input", "/dev/null"]
+    if workdir is not None:
+        args += ["--chdir", workdir]
+        cmd.workdir = None
     args += ["--summary", timefile]
     # Remember timefilename for later
     context.timefiles.append(timefile)




More information about the llvm-commits mailing list