Bug 743026: Make the --verbose flag to runxpcshelltests.py also show the command, environment, and cwd. r=ted
authorJim Blandy <jimb@mozilla.com>
Mon, 16 Apr 2012 14:19:07 -0700
changeset 95094 a1f8356394fc1cbf745c3b6083c7f537c47e801c
parent 95093 bc01a7e2d26a3b5f2d35e52351673ee5a3382a90
child 95095 5d5e4abb88a360bc7bbff83f0ebe5518ca8c28f6
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs743026
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 743026: Make the --verbose flag to runxpcshelltests.py also show the command, environment, and cwd. r=ted
testing/xpcshell/runxpcshelltests.py
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -651,21 +651,31 @@ class XPCShellTests(object):
 
       # The test file will have to be loaded after the head files.
       cmdT = self.buildCmdTestFile(name)
 
       args = self.xpcsRunArgs
       if 'debug' in test:
           args.insert(0, '-d')
 
+      completeCmd = cmdH + cmdT + args
+
       try:
         self.log.info("TEST-INFO | %s | running test ..." % name)
+        if verbose:
+            self.log.info("TEST-INFO | %s | full command: %r" % (name, completeCmd))
+            self.log.info("TEST-INFO | %s | current directory: %r" % (name, testdir))
+            # Show only those environment variables that are changed from
+            # the ambient environment.
+            changedEnv = (set("%s=%s" % i for i in self.env.iteritems())
+                          - set("%s=%s" % i for i in os.environ.iteritems()))
+            self.log.info("TEST-INFO | %s | environment: %s" % (name, list(changedEnv)))
         startTime = time.time()
 
-        proc = self.launchProcess(cmdH + cmdT + args,
+        proc = self.launchProcess(completeCmd,
                     stdout=pStdout, stderr=pStderr, env=self.env, cwd=testdir)
 
         # Allow user to kill hung subprocess with SIGINT w/o killing this script
         # - don't move this line above launchProcess, or child will inherit the SIG_IGN
         signal.signal(signal.SIGINT, markGotSIGINT)
         # |stderr == None| as |pStderr| was either |None| or redirected to |stdout|.
         stdout, stderr = self.communicate(proc)
         signal.signal(signal.SIGINT, signal.SIG_DFL)