# HG changeset patch # User Matt Mackall # Date 1272596645 18000 # Node ID 8f951ed6c63c02fdf9e228282e6365cd89f2b038 # Parent cf0a309f6c4dfb1297607a622a7edcceb6d1d043 run-tests: add --view switch to use external diff viewer diff -r cf0a309f6c4d -r 8f951ed6c63c tests/run-tests.py --- a/tests/run-tests.py Thu Apr 29 18:25:45 2010 -0500 +++ b/tests/run-tests.py Thu Apr 29 22:04:05 2010 -0500 @@ -132,6 +132,8 @@ " (implies --keep-tmpdir)") parser.add_option("-v", "--verbose", action="store_true", help="output verbose messages") + parser.add_option("--view", type="string", + help="external diff viewer") parser.add_option("--with-hg", type="string", metavar="HG", help="test using specified hg script rather than a " @@ -573,6 +575,7 @@ mark = '.' skipped = (ret == SKIPPED_STATUS) + # If we're not in --debug mode and reference output file exists, # check test output against it. if options.debug: @@ -584,6 +587,13 @@ else: refout = [] + if (ret != 0 or out != refout) and not skipped and not options.debug: + # Save errors to a file for diagnosis + f = open(err, "wb") + for line in out: + f.write(line) + f.close() + if skipped: mark = 's' if out is None: # debug mode: nothing to parse @@ -605,7 +615,10 @@ else: fail("output changed") if not options.nodiff: - showdiff(refout, out, ref, err) + if options.view: + os.system("%s %s %s" % (options.view, ref, err)) + else: + showdiff(refout, out, ref, err) ret = 1 elif ret: mark = '!' @@ -615,13 +628,6 @@ sys.stdout.write(mark) sys.stdout.flush() - if ret != 0 and not skipped and not options.debug: - # Save errors to a file for diagnosis - f = open(err, "wb") - for line in out: - f.write(line) - f.close() - killdaemons() os.chdir(TESTDIR)