[PATCH] run-tests: show PID if running in parallel mode with -v

Greg Ward greg-hg at gerg.ca
Fri May 29 21:18:06 CDT 2009


# HG changeset patch
# User Greg Ward <greg-hg at gerg.ca>
# Date 1243649873 14400
# Node ID b9757f76850ea767a713389385794ecd0d207c52
# Parent  27cc4fa6722d97fa0d23bc990906d4d47ff43cff
run-tests: show PID if running in parallel mode with -v.

(Extremely handy when you break parallel operation and need to figure
out what's going on.  The assumption is that if you run with -v, you
want more details.)

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -96,7 +96,13 @@
                            options.annotate)
 
     if options.verbose:
+        if options.jobs > 1 or options.child is not None:
+            pid = "[%d]" % os.getpid()
+        else:
+            pid = None
         def vlog(*msg):
+            if pid:
+                print pid,
             for m in msg:
                 print m,
             print
@@ -178,8 +184,7 @@
 
 def cleanup(options):
     if not options.keep_tmpdir:
-        if options.verbose:
-            print "# Cleaning up HGTMP", HGTMP
+        vlog("# Cleaning up HGTMP", HGTMP)
         shutil.rmtree(HGTMP, True)
 
 def usecorrectpython():


More information about the Mercurial-devel mailing list