##// END OF EJS Templates
run-tests: move interactive handling into runone
Matt Mackall -
r13988:994ad067 default
parent child Browse files
Show More
@@ -646,11 +646,19 b' def runone(options, test, skips, fails):'
646 print "\nSkipping %s: %s" % (testpath, msg)
646 print "\nSkipping %s: %s" % (testpath, msg)
647 return None
647 return None
648
648
649 def fail(msg):
649 def fail(msg, ret):
650 fails.append((test, msg))
651 if not options.nodiff:
650 if not options.nodiff:
652 print "\nERROR: %s %s" % (testpath, msg)
651 print "\nERROR: %s %s" % (testpath, msg)
653 return None
652 if not ret and options.interactive:
653 print "Accept this change? [n] ",
654 answer = sys.stdin.readline().strip()
655 if answer.lower() in "y yes".split():
656 if test.endswith(".t"):
657 rename(test + ".err", test)
658 else:
659 rename(test + ".err", test + ".out")
660 return
661 fails.append((test, msg))
654
662
655 vlog("# Test", test)
663 vlog("# Test", test)
656
664
@@ -747,18 +755,18 b' def runone(options, test, skips, fails):'
747 if not missing:
755 if not missing:
748 missing = ['irrelevant']
756 missing = ['irrelevant']
749 if failed:
757 if failed:
750 fail("hghave failed checking for %s" % failed[-1])
758 fail("hghave failed checking for %s" % failed[-1], ret)
751 skipped = False
759 skipped = False
752 else:
760 else:
753 skip(missing[-1])
761 skip(missing[-1])
754 elif out != refout:
762 elif out != refout:
755 mark = '!'
763 mark = '!'
756 if ret == 'timeout':
764 if ret == 'timeout':
757 fail("timed out")
765 fail("timed out", ret)
758 elif ret:
766 elif ret:
759 fail("output changed and returned error code %d" % ret)
767 fail("output changed and returned error code %d" % ret, ret)
760 else:
768 else:
761 fail("output changed")
769 fail("output changed", ret)
762 if ret != 'timeout' and not options.nodiff:
770 if ret != 'timeout' and not options.nodiff:
763 if options.view:
771 if options.view:
764 os.system("%s %s %s" % (options.view, ref, err))
772 os.system("%s %s %s" % (options.view, ref, err))
@@ -767,7 +775,7 b' def runone(options, test, skips, fails):'
767 ret = 1
775 ret = 1
768 elif ret:
776 elif ret:
769 mark = '!'
777 mark = '!'
770 fail("returned error code %d" % ret)
778 fail("returned error code %d" % ret, ret)
771
779
772 if not options.verbose:
780 if not options.verbose:
773 sys.stdout.write(mark)
781 sys.stdout.write(mark)
@@ -950,17 +958,6 b' def runtests(options, tests):'
950 if ret is None:
958 if ret is None:
951 skipped += 1
959 skipped += 1
952 elif not ret:
960 elif not ret:
953 if options.interactive:
954 print "Accept this change? [n] ",
955 answer = sys.stdin.readline().strip()
956 if answer.lower() in "y yes".split():
957 if test.endswith(".t"):
958 rename(test + ".err", test)
959 else:
960 rename(test + ".err", test + ".out")
961 tested += 1
962 fails.pop()
963 continue
964 failed += 1
961 failed += 1
965 if options.first:
962 if options.first:
966 break
963 break
General Comments 0
You need to be logged in to leave comments. Login now