Show More
@@ -678,6 +678,27 b' class Test(object):' | |||||
678 | def success(self): |
|
678 | def success(self): | |
679 | return '.', self._test, '' |
|
679 | return '.', self._test, '' | |
680 |
|
680 | |||
|
681 | def fail(self, msg, ret): | |||
|
682 | warned = ret is False | |||
|
683 | if not self._options.nodiff: | |||
|
684 | log("\n%s: %s %s" % (warned and 'Warning' or 'ERROR', self._test, | |||
|
685 | msg)) | |||
|
686 | if (not ret and self._options.interactive and | |||
|
687 | os.path.exists(self._errpath)): | |||
|
688 | iolock.acquire() | |||
|
689 | print 'Accept this change? [n] ', | |||
|
690 | answer = sys.stdin.readline().strip() | |||
|
691 | iolock.release() | |||
|
692 | if answer.lower() in ('y', 'yes').split(): | |||
|
693 | if self._test.endswith('.t'): | |||
|
694 | rename(self._errpath, self._testpath) | |||
|
695 | else: | |||
|
696 | rename(self._errpath, '%s.out' % self._testpath) | |||
|
697 | ||||
|
698 | return '.', self._test, '' | |||
|
699 | ||||
|
700 | return warned and '~' or '!', self._test, msg | |||
|
701 | ||||
681 | class TestResult(object): |
|
702 | class TestResult(object): | |
682 | """Holds the result of a test execution.""" |
|
703 | """Holds the result of a test execution.""" | |
683 |
|
704 | |||
@@ -1034,24 +1055,6 b' def runone(options, test, count):' | |||||
1034 | log("\nSkipping %s: %s" % (testpath, msg)) |
|
1055 | log("\nSkipping %s: %s" % (testpath, msg)) | |
1035 | return 's', test, msg |
|
1056 | return 's', test, msg | |
1036 |
|
1057 | |||
1037 | def fail(msg, ret): |
|
|||
1038 | warned = ret is False |
|
|||
1039 | if not options.nodiff: |
|
|||
1040 | log("\n%s: %s %s" % (warned and 'Warning' or 'ERROR', test, msg)) |
|
|||
1041 | if (not ret and options.interactive |
|
|||
1042 | and os.path.exists(testpath + ".err")): |
|
|||
1043 | iolock.acquire() |
|
|||
1044 | print "Accept this change? [n] ", |
|
|||
1045 | answer = sys.stdin.readline().strip() |
|
|||
1046 | iolock.release() |
|
|||
1047 | if answer.lower() in "y yes".split(): |
|
|||
1048 | if test.endswith(".t"): |
|
|||
1049 | rename(testpath + ".err", testpath) |
|
|||
1050 | else: |
|
|||
1051 | rename(testpath + ".err", testpath + ".out") |
|
|||
1052 | return '.', test, '' |
|
|||
1053 | return warned and '~' or '!', test, msg |
|
|||
1054 |
|
||||
1055 | def ignore(msg): |
|
1058 | def ignore(msg): | |
1056 | return 'i', test, msg |
|
1059 | return 'i', test, msg | |
1057 |
|
1060 | |||
@@ -1101,7 +1104,7 b' def runone(options, test, count):' | |||||
1101 | t.run(res) |
|
1104 | t.run(res) | |
1102 |
|
1105 | |||
1103 | if res.exception: |
|
1106 | if res.exception: | |
1104 | return fail('Exception during execution: %s' % res.exception, 255) |
|
1107 | return t.fail('Exception during execution: %s' % res.exception, 255) | |
1105 |
|
1108 | |||
1106 | ret = res.ret |
|
1109 | ret = res.ret | |
1107 | out = res.out |
|
1110 | out = res.out | |
@@ -1128,12 +1131,12 b' def runone(options, test, count):' | |||||
1128 | if not missing: |
|
1131 | if not missing: | |
1129 | missing = ['irrelevant'] |
|
1132 | missing = ['irrelevant'] | |
1130 | if failed: |
|
1133 | if failed: | |
1131 | result = fail("hghave failed checking for %s" % failed[-1], ret) |
|
1134 | result = t.fail("hghave failed checking for %s" % failed[-1], ret) | |
1132 | skipped = False |
|
1135 | skipped = False | |
1133 | else: |
|
1136 | else: | |
1134 | result = skip(missing[-1]) |
|
1137 | result = skip(missing[-1]) | |
1135 | elif ret == 'timeout': |
|
1138 | elif ret == 'timeout': | |
1136 | result = fail("timed out", ret) |
|
1139 | result = t.fail("timed out", ret) | |
1137 | elif out != refout: |
|
1140 | elif out != refout: | |
1138 | info = {} |
|
1141 | info = {} | |
1139 | if not options.nodiff: |
|
1142 | if not options.nodiff: | |
@@ -1149,9 +1152,9 b' def runone(options, test, count):' | |||||
1149 | msg += "output changed and " + describe(ret) |
|
1152 | msg += "output changed and " + describe(ret) | |
1150 | else: |
|
1153 | else: | |
1151 | msg += "output changed" |
|
1154 | msg += "output changed" | |
1152 | result = fail(msg, ret) |
|
1155 | result = t.fail(msg, ret) | |
1153 | elif ret: |
|
1156 | elif ret: | |
1154 | result = fail(describe(ret), ret) |
|
1157 | result = t.fail(describe(ret), ret) | |
1155 | else: |
|
1158 | else: | |
1156 | result = t.success() |
|
1159 | result = t.success() | |
1157 |
|
1160 |
General Comments 0
You need to be logged in to leave comments.
Login now