# HG changeset patch # User Nicolas Dumazet # Date 2010-08-12 05:53:34 # Node ID 6f59154fb6044c7882b7f91956fb66e0807c7180 # Parent 3cdd6fdc3d9e2a719381348646a6364e656c5c90 tests: catch re.error if test line is not a valid regular expression diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -499,6 +499,13 @@ def tsttest(test, options): finally: os.remove(name) + def rematch(el, l): + try: + return re.match(el, l) + except re.error: + # el is an invalid regex + return False + pos = -1 postout = [] for n, l in enumerate(output): @@ -513,7 +520,7 @@ def tsttest(test, options): if el == l: # perfect match (fast) postout.append(" " + l) - elif el and re.match(el, l): # fallback regex match + elif el and rematch(el, l): # fallback regex match postout.append(" " + el) else: # mismatch - let diff deal with it postout.append(" " + l)