Mercurial > hg
comparison tests/run-tests.py @ 13992:ec4ae5727f07
run-tests: keep a list of passed tests
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 22 Apr 2011 11:32:05 -0500 |
parents | 8cfe191e2ce4 |
children | 174d0a113757 |
comparison
equal
deleted
inserted
replaced
13991:8cfe191e2ce4 | 13992:ec4ae5727f07 |
---|---|
631 | 631 |
632 for s, r in replacements: | 632 for s, r in replacements: |
633 output = re.sub(s, r, output) | 633 output = re.sub(s, r, output) |
634 return ret, splitnewlines(output) | 634 return ret, splitnewlines(output) |
635 | 635 |
636 def runone(options, test, skips, fails, ignores): | 636 def runone(options, test, skips, passes, fails, ignores): |
637 '''tristate output: | 637 '''tristate output: |
638 None -> skipped | 638 None -> skipped |
639 True -> passed | 639 True -> passed |
640 False -> failed''' | 640 False -> failed''' |
641 | 641 |
743 | 743 |
744 if options.timeout > 0: | 744 if options.timeout > 0: |
745 signal.alarm(0) | 745 signal.alarm(0) |
746 | 746 |
747 mark = '.' | 747 mark = '.' |
748 if ret == 0: | |
749 passes.append(test) | |
748 | 750 |
749 skipped = (ret == SKIPPED_STATUS) | 751 skipped = (ret == SKIPPED_STATUS) |
750 | 752 |
751 # If we're not in --debug mode and reference output file exists, | 753 # If we're not in --debug mode and reference output file exists, |
752 # check test output against it. | 754 # check test output against it. |
933 options.timeout) | 935 options.timeout) |
934 except AttributeError: | 936 except AttributeError: |
935 print 'WARNING: cannot run tests with timeouts' | 937 print 'WARNING: cannot run tests with timeouts' |
936 options.timeout = 0 | 938 options.timeout = 0 |
937 | 939 |
938 tested = 0 | |
939 failed = 0 | |
940 skipped = 0 | |
941 | |
942 if options.restart: | 940 if options.restart: |
943 orig = list(tests) | 941 orig = list(tests) |
944 while tests: | 942 while tests: |
945 if os.path.exists(tests[0] + ".err"): | 943 if os.path.exists(tests[0] + ".err"): |
946 break | 944 break |
947 tests.pop(0) | 945 tests.pop(0) |
948 if not tests: | 946 if not tests: |
949 print "running all tests" | 947 print "running all tests" |
950 tests = orig | 948 tests = orig |
951 | 949 |
950 passes = [] | |
952 skips = [] | 951 skips = [] |
953 fails = [] | 952 fails = [] |
954 ignores = [] | 953 ignores = [] |
955 | 954 |
956 for test in tests: | 955 for test in tests: |
957 if options.blacklist: | 956 if options.blacklist: |
958 filename = options.blacklist.get(test) | 957 filename = options.blacklist.get(test) |
959 if filename is not None: | 958 if filename is not None: |
960 skipped.append((test, "blacklisted (%s)" % filename)) | 959 skipped.append((test, "blacklisted (%s)" % filename)) |
961 skipped += 1 | |
962 continue | 960 continue |
963 | 961 |
964 if options.retest and not os.path.exists(test + ".err"): | 962 if options.retest and not os.path.exists(test + ".err"): |
965 ignores.append((test, "not retesting")) | 963 ignores.append((test, "not retesting")) |
966 continue | 964 continue |
967 | 965 |
968 ret = runone(options, test, skips, fails, ignores) | 966 ret = runone(options, test, skips, passes, fails, ignores) |
969 if ret is None: | 967 if options.first and ret is not None and not ret: |
970 skipped += 1 | 968 break |
971 elif not ret: | |
972 failed += 1 | |
973 if options.first: | |
974 break | |
975 tested += 1 | |
976 | 969 |
977 if options.child: | 970 if options.child: |
978 fp = os.fdopen(options.child, 'w') | 971 fp = os.fdopen(options.child, 'w') |
979 fp.write('%d\n%d\n%d\n' % (tested, skipped, failed)) | 972 fp.write('%d\n%d\n%d\n' % (tested, skipped, failed)) |
980 for s in skips: | 973 for s in skips: |
988 print "Skipped %s: %s" % s | 981 print "Skipped %s: %s" % s |
989 for s in fails: | 982 for s in fails: |
990 print "Failed %s: %s" % s | 983 print "Failed %s: %s" % s |
991 _checkhglib("Tested") | 984 _checkhglib("Tested") |
992 print "# Ran %d tests, %d skipped, %d failed." % ( | 985 print "# Ran %d tests, %d skipped, %d failed." % ( |
993 tested, len(skips) + len(ignores), failed) | 986 len(passes) + len(fails), len(skips) + len(ignores), len(fails)) |
994 | 987 |
995 if options.anycoverage: | 988 if options.anycoverage: |
996 outputcoverage(options) | 989 outputcoverage(options) |
997 except KeyboardInterrupt: | 990 except KeyboardInterrupt: |
998 failed = True | 991 failed = True |
999 print "\ninterrupted!" | 992 print "\ninterrupted!" |
1000 | 993 |
1001 if failed: | 994 if fails: |
1002 sys.exit(1) | 995 sys.exit(1) |
1003 | 996 |
1004 def main(): | 997 def main(): |
1005 (options, args) = parseargs() | 998 (options, args) = parseargs() |
1006 if not options.child: | 999 if not options.child: |