Mercurial > hg
comparison tests/run-tests.py @ 21322:512968bfb00a
run-tests: move success() into Test
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 19 Apr 2014 20:35:54 -0700 |
parents | d06b09dc80a5 |
children | a7c677e2f6ae |
comparison
equal
deleted
inserted
replaced
21321:d06b09dc80a5 | 21322:512968bfb00a |
---|---|
673 if k.startswith('HG_'): | 673 if k.startswith('HG_'): |
674 del env[k] | 674 del env[k] |
675 | 675 |
676 return env | 676 return env |
677 | 677 |
678 def success(self): | |
679 return '.', self._test, '' | |
680 | |
678 class TestResult(object): | 681 class TestResult(object): |
679 """Holds the result of a test execution.""" | 682 """Holds the result of a test execution.""" |
680 | 683 |
681 def __init__(self): | 684 def __init__(self): |
682 self.ret = None | 685 self.ret = None |
1047 else: | 1050 else: |
1048 rename(testpath + ".err", testpath + ".out") | 1051 rename(testpath + ".err", testpath + ".out") |
1049 return '.', test, '' | 1052 return '.', test, '' |
1050 return warned and '~' or '!', test, msg | 1053 return warned and '~' or '!', test, msg |
1051 | 1054 |
1052 def success(): | |
1053 return '.', test, '' | |
1054 | |
1055 def ignore(msg): | 1055 def ignore(msg): |
1056 return 'i', test, msg | 1056 return 'i', test, msg |
1057 | 1057 |
1058 def describe(ret): | 1058 def describe(ret): |
1059 if ret < 0: | 1059 if ret < 0: |
1097 vlog("# Test", test) | 1097 vlog("# Test", test) |
1098 | 1098 |
1099 t = runner(test, testpath, options, count, ref, err) | 1099 t = runner(test, testpath, options, count, ref, err) |
1100 res = TestResult() | 1100 res = TestResult() |
1101 t.run(res) | 1101 t.run(res) |
1102 t.cleanup() | |
1103 | 1102 |
1104 if res.exception: | 1103 if res.exception: |
1105 return fail('Exception during execution: %s' % res.exception, 255) | 1104 return fail('Exception during execution: %s' % res.exception, 255) |
1106 | 1105 |
1107 ret = res.ret | 1106 ret = res.ret |
1152 msg += "output changed" | 1151 msg += "output changed" |
1153 result = fail(msg, ret) | 1152 result = fail(msg, ret) |
1154 elif ret: | 1153 elif ret: |
1155 result = fail(describe(ret), ret) | 1154 result = fail(describe(ret), ret) |
1156 else: | 1155 else: |
1157 result = success() | 1156 result = t.success() |
1158 | 1157 |
1159 if not options.verbose: | 1158 if not options.verbose: |
1160 iolock.acquire() | 1159 iolock.acquire() |
1161 sys.stdout.write(result[0]) | 1160 sys.stdout.write(result[0]) |
1162 sys.stdout.flush() | 1161 sys.stdout.flush() |
1163 iolock.release() | 1162 iolock.release() |
1163 | |
1164 t.cleanup() | |
1164 | 1165 |
1165 return result | 1166 return result |
1166 | 1167 |
1167 _hgpath = None | 1168 _hgpath = None |
1168 | 1169 |