644 skips.append((test, msg)) |
644 skips.append((test, msg)) |
645 else: |
645 else: |
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 |
657 # create a fresh hgrc |
665 # create a fresh hgrc |
658 hgrc = open(HGRCPATH, 'w+') |
666 hgrc = open(HGRCPATH, 'w+') |
745 else: |
753 else: |
746 missing, failed = parsehghaveoutput(out) |
754 missing, failed = parsehghaveoutput(out) |
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)) |
765 else: |
773 else: |
766 showdiff(refout, out, ref, err) |
774 showdiff(refout, out, ref, err) |
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) |
774 sys.stdout.flush() |
782 sys.stdout.flush() |
775 |
783 |
948 |
956 |
949 ret = runone(options, test, skips, fails) |
957 ret = runone(options, test, skips, fails) |
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 |
967 tested += 1 |
964 tested += 1 |
968 |
965 |