зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1503613: Make 'mach xpcshell-test' print the command in shell syntax. r=ted
When passed the `--verbose` flag, `mach xpcshell-test` already prints the current directory, environment variables, and command used for the test. However, it prints them in Python syntax. This seems like a good thing to do, as it's a clear indication of what the test is actually doing. But if one wants to reproduce a problem by running the xpcshell command directly, it's an error-prone pain to convert from Python lists of strings to the Bourne shell syntax. Fortunately, the Python 2.7 `pipes` module has a function, `pipes.quote`, which produces properly quoted Unix shell commands, ready to be copied and pasted into one's terminal. Unfortunately, the xpcshell tests still clean up the $obj/temp/xpc-plugins-FOO directory, so this still isn't quite ready to go. Differential Revision: https://phabricator.services.mozilla.com/D10392 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a962c06211
Коммит
b24022116e
|
@ -10,6 +10,7 @@ import copy
|
||||||
import json
|
import json
|
||||||
import mozdebug
|
import mozdebug
|
||||||
import os
|
import os
|
||||||
|
import pipes
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -285,6 +286,9 @@ class XPCShellTestThread(Thread):
|
||||||
changedEnv = (set("%s=%s" % i for i in self.env.iteritems())
|
changedEnv = (set("%s=%s" % i for i in self.env.iteritems())
|
||||||
- set("%s=%s" % i for i in os.environ.iteritems()))
|
- set("%s=%s" % i for i in os.environ.iteritems()))
|
||||||
self.log.info("%s | environment: %s" % (name, list(changedEnv)))
|
self.log.info("%s | environment: %s" % (name, list(changedEnv)))
|
||||||
|
shell_command_tokens = [pipes.quote(tok) for tok in list(changedEnv) + completeCmd]
|
||||||
|
self.log.info("%s | as shell command: (cd %s; %s)" %
|
||||||
|
(name, pipes.quote(testdir), ' '.join(shell_command_tokens)))
|
||||||
|
|
||||||
def killTimeout(self, proc):
|
def killTimeout(self, proc):
|
||||||
if proc is not None and hasattr(proc, "pid"):
|
if proc is not None and hasattr(proc, "pid"):
|
||||||
|
|
Загрузка…
Ссылка в новой задаче