[test-suite] r271661 - [test-suite] Use shellcommand.wrap() when adding the run_under command

Silviu Baranga via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 3 04:35:08 PDT 2016


Author: sbaranga
Date: Fri Jun  3 06:35:05 2016
New Revision: 271661

URL: http://llvm.org/viewvc/llvm-project?rev=271661&view=rev
Log:
[test-suite] Use shellcommand.wrap() when adding the run_under command

Summary:
When mutating a command like "cd X; ./cmd" to add the run_under
arguments (for example "taskset -c 1"), the mutated command needs to
maintain the "cd X;" part in the output command prefix:
   "cd X; taskset -c 1 ./cmd"

If we don't do this, the mutated command cannot be parsed.

Use shellcommand.wrap() to mutate the command instead of string
concatenation, since shellcommand knows how to handle the
"cd X; ..".

Reviewers: MatzeB

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D20854

Modified:
    test-suite/trunk/litsupport/run_under.py

Modified: test-suite/trunk/litsupport/run_under.py
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/litsupport/run_under.py?rev=271661&r1=271660&r2=271661&view=diff
==============================================================================
--- test-suite/trunk/litsupport/run_under.py (original)
+++ test-suite/trunk/litsupport/run_under.py Fri Jun  3 06:35:05 2016
@@ -3,7 +3,19 @@ from litsupport import testplan
 
 
 def mutateCommandLine(context, commandline):
-    return context.config.run_under + " " + commandline
+    cmd = shellcommand.parse(commandline)
+    run_under_cmd = shellcommand.parse(context.config.run_under)
+
+    if (run_under_cmd.stdin is not None or
+        run_under_cmd.stdout is not None or
+        run_under_cmd.stderr is not None or
+        run_under_cmd.workdir is not None or
+        run_under_cmd.envvars):
+        raise Exception("invalid run_under argument!")
+
+    cmd.wrap(run_under_cmd.executable, run_under_cmd.arguments)
+
+    return cmd.toCommandline()
 
 
 def mutatePlan(context, plan):




More information about the llvm-commits mailing list