Mercurial > hg
changeset 13988:994ad067ac6e
run-tests: move interactive handling into runone
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 21 Apr 2011 18:19:45 -0500 |
parents | e0f07847f8de |
children | 55ba68a4dd28 |
files | tests/run-tests.py |
diffstat | 1 files changed, 16 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Thu Apr 21 13:47:45 2011 -0700 +++ b/tests/run-tests.py Thu Apr 21 18:19:45 2011 -0500 @@ -646,11 +646,19 @@ print "\nSkipping %s: %s" % (testpath, msg) return None - def fail(msg): - fails.append((test, msg)) + def fail(msg, ret): if not options.nodiff: print "\nERROR: %s %s" % (testpath, msg) - return None + if not ret and options.interactive: + print "Accept this change? [n] ", + answer = sys.stdin.readline().strip() + if answer.lower() in "y yes".split(): + if test.endswith(".t"): + rename(test + ".err", test) + else: + rename(test + ".err", test + ".out") + return + fails.append((test, msg)) vlog("# Test", test) @@ -747,18 +755,18 @@ if not missing: missing = ['irrelevant'] if failed: - fail("hghave failed checking for %s" % failed[-1]) + fail("hghave failed checking for %s" % failed[-1], ret) skipped = False else: skip(missing[-1]) elif out != refout: mark = '!' if ret == 'timeout': - fail("timed out") + fail("timed out", ret) elif ret: - fail("output changed and returned error code %d" % ret) + fail("output changed and returned error code %d" % ret, ret) else: - fail("output changed") + fail("output changed", ret) if ret != 'timeout' and not options.nodiff: if options.view: os.system("%s %s %s" % (options.view, ref, err)) @@ -767,7 +775,7 @@ ret = 1 elif ret: mark = '!' - fail("returned error code %d" % ret) + fail("returned error code %d" % ret, ret) if not options.verbose: sys.stdout.write(mark) @@ -950,17 +958,6 @@ if ret is None: skipped += 1 elif not ret: - if options.interactive: - print "Accept this change? [n] ", - answer = sys.stdin.readline().strip() - if answer.lower() in "y yes".split(): - if test.endswith(".t"): - rename(test + ".err", test) - else: - rename(test + ".err", test + ".out") - tested += 1 - fails.pop() - continue failed += 1 if options.first: break