Mercurial > hg
comparison tests/run-tests.py @ 28569:1ad0ddf8cccc
run-tests: teach _processoutput to handle multiple lines of churn
Instead of treating expected output as happening in a precise order,
and assuming that if a line is missing it will never happen,
assume that expected output is a prioritized list of likely matching
lines.
This means that if:
foo/bar (glob)
baz/bad (glob)
changes to:
baz/bad
foo/bar
instead of generating:
baz/bad
foo/bar
For which we've lost both (glob) markers,
we will match both lines and generate:
baz/bad (glob)
foo/bar (glob)
This retains any special annotations we have for lines.
author | timeless <timeless@mozdev.org> |
---|---|
date | Thu, 17 Mar 2016 20:52:06 +0000 |
parents | 4a908089fe29 |
children | cdbc25306696 |
comparison
equal
deleted
inserted
replaced
28568:4a908089fe29 | 28569:1ad0ddf8cccc |
---|---|
1106 while lout: | 1106 while lout: |
1107 if not lout.endswith(b'\n'): | 1107 if not lout.endswith(b'\n'): |
1108 lout += b' (no-eol)\n' | 1108 lout += b' (no-eol)\n' |
1109 | 1109 |
1110 # Find the expected output at the current position. | 1110 # Find the expected output at the current position. |
1111 el = None | 1111 els = [None] |
1112 if expected.get(pos, None): | 1112 if expected.get(pos, None): |
1113 el = expected[pos].pop(0) | 1113 els = expected[pos] |
1114 if True: | 1114 |
1115 i = 0 | |
1116 while i < len(els): | |
1117 el = els[i] | |
1118 | |
1115 r = TTest.linematch(el, lout) | 1119 r = TTest.linematch(el, lout) |
1116 if isinstance(r, str): | 1120 if isinstance(r, str): |
1117 if r == '+glob': | 1121 if r == '+glob': |
1118 lout = el[:-1] + ' (glob)\n' | 1122 lout = el[:-1] + ' (glob)\n' |
1119 r = '' # Warn only this line. | 1123 r = '' # Warn only this line. |
1120 elif r == '-glob': | 1124 elif r == '-glob': |
1121 lout = ''.join(el.rsplit(' (glob)', 1)) | 1125 lout = ''.join(el.rsplit(' (glob)', 1)) |
1122 r = '' # Warn only this line. | 1126 r = '' # Warn only this line. |
1123 elif r == "retry": | 1127 elif r == "retry": |
1124 postout.append(b' ' + el) | 1128 postout.append(b' ' + el) |
1125 continue | 1129 els.pop(i) |
1130 break | |
1126 else: | 1131 else: |
1127 log('\ninfo, unknown linematch result: %r\n' % r) | 1132 log('\ninfo, unknown linematch result: %r\n' % r) |
1128 r = False | 1133 r = False |
1134 if r: | |
1135 els.pop(i) | |
1136 break | |
1137 i += 1 | |
1138 | |
1129 if r: | 1139 if r: |
1140 if r == "retry": | |
1141 continue | |
1130 postout.append(b' ' + el) | 1142 postout.append(b' ' + el) |
1131 else: | 1143 else: |
1132 if self.NEEDESCAPE(lout): | 1144 if self.NEEDESCAPE(lout): |
1133 lout = TTest._stringescape(b'%s (esc)\n' % | 1145 lout = TTest._stringescape(b'%s (esc)\n' % |
1134 lout.rstrip(b'\n')) | 1146 lout.rstrip(b'\n')) |