Show More
@@ -1034,59 +1034,6 b' def scheduletests(runner, tests):' | |||
|
1034 | 1034 | except KeyboardInterrupt: |
|
1035 | 1035 | abort = True |
|
1036 | 1036 | |
|
1037 | def runtests(runner, tests): | |
|
1038 | try: | |
|
1039 | if runner.inst: | |
|
1040 | runner.installhg() | |
|
1041 | runner.checkhglib("Testing") | |
|
1042 | else: | |
|
1043 | runner.usecorrectpython() | |
|
1044 | ||
|
1045 | if runner.options.restart: | |
|
1046 | orig = list(tests) | |
|
1047 | while tests: | |
|
1048 | if os.path.exists(tests[0] + ".err"): | |
|
1049 | break | |
|
1050 | tests.pop(0) | |
|
1051 | if not tests: | |
|
1052 | print "running all tests" | |
|
1053 | tests = orig | |
|
1054 | ||
|
1055 | scheduletests(runner, tests) | |
|
1056 | ||
|
1057 | failed = len(runner.results['!']) | |
|
1058 | warned = len(runner.results['~']) | |
|
1059 | tested = len(runner.results['.']) + failed + warned | |
|
1060 | skipped = len(runner.results['s']) | |
|
1061 | ignored = len(runner.results['i']) | |
|
1062 | ||
|
1063 | ||
|
1064 | if not runner.options.noskips: | |
|
1065 | for s in runner.results['s']: | |
|
1066 | print "Skipped %s: %s" % s | |
|
1067 | for s in runner.results['~']: | |
|
1068 | print "Warned %s: %s" % s | |
|
1069 | for s in runner.results['!']: | |
|
1070 | print "Failed %s: %s" % s | |
|
1071 | runner.checkhglib("Tested") | |
|
1072 | print "# Ran %d tests, %d skipped, %d warned, %d failed." % ( | |
|
1073 | tested, skipped + ignored, warned, failed) | |
|
1074 | if runner.results['!']: | |
|
1075 | print 'python hash seed:', os.environ['PYTHONHASHSEED'] | |
|
1076 | if runner.options.time: | |
|
1077 | runner.outputtimes() | |
|
1078 | ||
|
1079 | if runner.options.anycoverage: | |
|
1080 | runner.outputcoverage() | |
|
1081 | except KeyboardInterrupt: | |
|
1082 | failed = True | |
|
1083 | print "\ninterrupted!" | |
|
1084 | ||
|
1085 | if failed: | |
|
1086 | return 1 | |
|
1087 | if warned: | |
|
1088 | return 80 | |
|
1089 | ||
|
1090 | 1037 | class TestRunner(object): |
|
1091 | 1038 | """Holds context for executing tests. |
|
1092 | 1039 | |
@@ -1117,6 +1064,59 b' class TestRunner(object):' | |||
|
1117 | 1064 | } |
|
1118 | 1065 | self._createdfiles = [] |
|
1119 | 1066 | |
|
1067 | def runtests(self, tests): | |
|
1068 | try: | |
|
1069 | if self.inst: | |
|
1070 | self.installhg() | |
|
1071 | self.checkhglib("Testing") | |
|
1072 | else: | |
|
1073 | self.usecorrectpython() | |
|
1074 | ||
|
1075 | if self.options.restart: | |
|
1076 | orig = list(tests) | |
|
1077 | while tests: | |
|
1078 | if os.path.exists(tests[0] + ".err"): | |
|
1079 | break | |
|
1080 | tests.pop(0) | |
|
1081 | if not tests: | |
|
1082 | print "running all tests" | |
|
1083 | tests = orig | |
|
1084 | ||
|
1085 | scheduletests(self, tests) | |
|
1086 | ||
|
1087 | failed = len(self.results['!']) | |
|
1088 | warned = len(self.results['~']) | |
|
1089 | tested = len(self.results['.']) + failed + warned | |
|
1090 | skipped = len(self.results['s']) | |
|
1091 | ignored = len(self.results['i']) | |
|
1092 | ||
|
1093 | ||
|
1094 | if not self.options.noskips: | |
|
1095 | for s in self.results['s']: | |
|
1096 | print "Skipped %s: %s" % s | |
|
1097 | for s in self.results['~']: | |
|
1098 | print "Warned %s: %s" % s | |
|
1099 | for s in self.results['!']: | |
|
1100 | print "Failed %s: %s" % s | |
|
1101 | self.checkhglib("Tested") | |
|
1102 | print "# Ran %d tests, %d skipped, %d warned, %d failed." % ( | |
|
1103 | tested, skipped + ignored, warned, failed) | |
|
1104 | if self.results['!']: | |
|
1105 | print 'python hash seed:', os.environ['PYTHONHASHSEED'] | |
|
1106 | if self.options.time: | |
|
1107 | self.outputtimes() | |
|
1108 | ||
|
1109 | if self.options.anycoverage: | |
|
1110 | self.outputcoverage() | |
|
1111 | except KeyboardInterrupt: | |
|
1112 | failed = True | |
|
1113 | print "\ninterrupted!" | |
|
1114 | ||
|
1115 | if failed: | |
|
1116 | return 1 | |
|
1117 | if warned: | |
|
1118 | return 80 | |
|
1119 | ||
|
1120 | 1120 | def gettest(self, test, count): |
|
1121 | 1121 | """Obtain a Test by looking at its filename. |
|
1122 | 1122 | |
@@ -1433,7 +1433,7 b' def main(args, parser=None):' | |||
|
1433 | 1433 | vlog("# Using", IMPL_PATH, os.environ[IMPL_PATH]) |
|
1434 | 1434 | |
|
1435 | 1435 | try: |
|
1436 |
return runtests( |
|
|
1436 | return runner.runtests(tests) or 0 | |
|
1437 | 1437 | finally: |
|
1438 | 1438 | time.sleep(.1) |
|
1439 | 1439 | runner.cleanup() |
General Comments 0
You need to be logged in to leave comments.
Login now