# HG changeset patch # User Nicolas Dumazet # Date 1281592414 -32400 # Node ID cd294ce45931bba6c0bb044824b8cf39afe2178c # Parent 1869efbf104d2f943a7ecad5504285321a9752af tests: catch re.error if test line is not a valid regular expression [ original upstream message ] diff -r 1869efbf104d -r cd294ce45931 tests/run-tests.py --- a/tests/run-tests.py Mon Aug 02 23:27:22 2010 -0500 +++ b/tests/run-tests.py Thu Aug 12 14:53:34 2010 +0900 @@ -499,6 +499,13 @@ 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 @@ 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)