# HG changeset patch # User Matt Mackall # Date 1369423843 18000 # Node ID 02112fca2ff3d4852e28093eac21b9965a21787e # Parent c2b8e0ffffc8a7168d1fb834771a2a2e7e241d9d run-tests: add a log function [ original upstream message ] diff -r c2b8e0ffffc8 -r 02112fca2ff3 tests/run-tests.py --- a/tests/run-tests.py Fri May 24 14:30:43 2013 -0500 +++ b/tests/run-tests.py Fri May 24 14:30:43 2013 -0500 @@ -320,6 +320,16 @@ sys.stdout.flush() iolock.release() +def log(*msg): + iolock.acquire() + if verbose: + print verbose, + for m in msg: + print m, + print + sys.stdout.flush() + iolock.release() + def findprogram(program): """Search PATH for a executable program""" for p in os.environ.get('PATH', os.defpath).split(os.pathsep): @@ -572,9 +582,7 @@ if el + '\n' == l: if os.name == 'nt': # matching on "/" is not needed for this line - iolock.acquire() - print "\nInfo, unnecessary glob: %s (glob)" % el - iolock.release() + log("\nInfo, unnecessary glob: %s (glob)" % el) return True i, n = 0, len(el) res = '' @@ -832,16 +840,12 @@ def skip(msg): if options.verbose: - iolock.acquire() - print "\nSkipping %s: %s" % (testpath, msg) - iolock.release() + log("\nSkipping %s: %s" % (testpath, msg)) return 's', test, msg def fail(msg, ret): if not options.nodiff: - iolock.acquire() - print "\nERROR: %s %s" % (testpath, msg) - iolock.release() + log("\nERROR: %s %s" % (testpath, msg)) if (not ret and options.interactive and os.path.exists(testpath + ".err")): iolock.acquire()