# HG changeset patch # User Matt Mackall # Date 1369423843 18000 # Node ID 6857f53456f261fd035a2df823032dc0798b059e # Parent 5fa9463309707805d3d0e98f8c2ef85bd6d889c9 run-tests: add a log function diff -r 5fa946330970 -r 6857f53456f2 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()