This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by sbaranga on Jun 1 2016, 2:56 AM.

Details

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

Diff Detail

Repository
rL LLVM

Event Timeline

sbaranga updated this revision to Diff 59186.Jun 1 2016, 2:56 AM
sbaranga retitled this revision from to [test-suite] Use shellcommand.wrap() when adding the run_under command.
sbaranga updated this object.
sbaranga added a reviewer: MatzeB.
sbaranga added a subscriber: llvm-commits.
MatzeB accepted this revision.Jun 1 2016, 10:56 AM
MatzeB edited edge metadata.

LGTM. Though I would recommend adding some checks:

litsupport/run_under.py
9–10 ↗(On Diff #59186)

This looks like it can fit into a single line.

You should play it safe and abort if run_under_cmd has any of the stdin, stdout, stderr, workdir, envvars properties set because they will get lost here.

This revision is now accepted and ready to land.Jun 1 2016, 10:56 AM
sbaranga updated this revision to Diff 59530.Jun 3 2016, 4:39 AM
sbaranga edited edge metadata.

Raise an exception when the run_under command has any of the stdin, stdout, stderr, workdir or envvars set.

This revision was automatically updated to reflect the committed changes.

Thanks for the review! I've made the changes and committed in r271661.