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

silviu.baranga@arm.com via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 1 02:56:32 PDT 2016


sbaranga created this revision.
sbaranga added a reviewer: MatzeB.
sbaranga added a subscriber: llvm-commits.

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; ..".

http://reviews.llvm.org/D20854

Files:
  litsupport/run_under.py

Index: litsupport/run_under.py
===================================================================
--- litsupport/run_under.py
+++ litsupport/run_under.py
@@ -3,7 +3,13 @@
 
 
 def mutateCommandLine(context, commandline):
-    return context.config.run_under + " " + commandline
+    cmd = shellcommand.parse(commandline)
+    run_under_cmd = shellcommand.parse(context.config.run_under)
+
+    cmd.wrap(run_under_cmd.executable,
+             run_under_cmd.arguments)
+
+    return cmd.toCommandline()
 
 
 def mutatePlan(context, plan):


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20854.59186.patch
Type: text/x-patch
Size: 539 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160601/493ce571/attachment.bin>


More information about the llvm-commits mailing list