diff --git a/tests/run-tests.py b/tests/run-tests.py index 390a10b7843becd49fd7d91f685334555f1cff90_dGVzdHMvcnVuLXRlc3RzLnB5..6025cac3d02fbc41c1fab4a2ada8b2c5f4407b47_dGVzdHMvcnVuLXRlc3RzLnB5 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -1043,7 +1043,7 @@ if salt in l: lout, lcmd = l.split(salt, 1) - if lout: + while lout: if not lout.endswith(b'\n'): lout += b' (no-eol)\n' @@ -1060,6 +1060,9 @@ elif r == '-glob': lout = ''.join(el.rsplit(' (glob)', 1)) r = '' # Warn only this line. + elif r == "retry": + postout.append(b' ' + el) + continue else: log('\ninfo, unknown linematch result: %r\n' % r) r = False @@ -1074,6 +1077,15 @@ warnonly = 3 # for sure not elif warnonly == 1: # Is "not yet" and line is warn only. warnonly = 2 # Yes do warn. + break + + # clean up any optional leftovers + while expected.get(pos, None): + el = expected[pos].pop(0) + if not el.endswith(" (?)\n"): + expected[pos].insert(0, el) + break + postout.append(b' ' + el) if lcmd: # Add on last return code. @@ -1136,6 +1148,7 @@ @staticmethod def linematch(el, l): + retry = False if el == l: # perfect match (fast) return True if el: @@ -1139,6 +1152,9 @@ if el == l: # perfect match (fast) return True if el: + if el.endswith(" (?)\n"): + retry = "retry" + el = el[:-5] + "\n" if el.endswith(b" (esc)\n"): if PYTHON3: el = el[:-7].decode('unicode_escape') + '\n' @@ -1148,7 +1164,7 @@ if el == l or os.name == 'nt' and el[:-1] + b'\r\n' == l: return True if el.endswith(b" (re)\n"): - return TTest.rematch(el[:-6], l) + return TTest.rematch(el[:-6], l) or retry if el.endswith(b" (glob)\n"): # ignore '(glob)' added to l by 'replacements' if l.endswith(b" (glob)\n"): @@ -1156,7 +1172,7 @@ return TTest.globmatch(el[:-8], l) if os.altsep and l.replace(b'\\', b'/') == el: return b'+glob' - return False + return retry @staticmethod def parsehghaveoutput(lines): diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t index 390a10b7843becd49fd7d91f685334555f1cff90_dGVzdHMvdGVzdC1ydW4tdGVzdHMudA==..6025cac3d02fbc41c1fab4a2ada8b2c5f4407b47_dGVzdHMvdGVzdC1ydW4tdGVzdHMudA== 100644 --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -21,4 +21,5 @@ > $ echo babar > babar > $ echo xyzzy + > never happens (?) > xyzzy @@ -24,4 +25,5 @@ > xyzzy + > nor this (?) > EOF $ $TESTDIR/run-tests.py --with-hg=`which hg` @@ -237,8 +239,8 @@ *SALT* 2 0 (glob) + echo xyzzy xyzzy - + echo *SALT* 4 0 (glob) - *SALT* 4 0 (glob) + + echo *SALT* 6 0 (glob) + *SALT* 6 0 (glob) . # Ran 2 tests, 0 skipped, 0 warned, 0 failed.