comparison tests/run-tests.py @ 29518:348b2b9da703

run-tests: add support for using 127.0.0.1 as a glob Some systems don't have a 127/8 address for localhost (I noticed this on a FreeBSD jail). In order to work around this, use 127.0.0.1 as a glob pattern. A future commit will update needed output lines and add a requirement to check-code.py.
author Augie Fackler <raf@durin42.com>
date Sat, 09 Jul 2016 23:01:02 -0400
parents 6a98f9408a50
children ee96d95e81a4
comparison
equal deleted inserted replaced
29517:f1fdd7e7d434 29518:348b2b9da703
947 if self._aborted: 947 if self._aborted:
948 raise KeyboardInterrupt() 948 raise KeyboardInterrupt()
949 949
950 return result 950 return result
951 951
952 # This script may want to drop globs from lines matching these patterns on 952 # Some glob patterns apply only in some circumstances, so the script
953 # Windows, but check-code.py wants a glob on these lines unconditionally. Don't 953 # might want to remove (glob) annotations that otherwise should be
954 # warn if that is the case for anything matching these lines. 954 # retained.
955 checkcodeglobpats = [ 955 checkcodeglobpats = [
956 # On Windows it looks like \ doesn't require a (glob), but we know
957 # better.
956 re.compile(br'^pushing to \$TESTTMP/.*[^)]$'), 958 re.compile(br'^pushing to \$TESTTMP/.*[^)]$'),
957 re.compile(br'^moving \S+/.*[^)]$'), 959 re.compile(br'^moving \S+/.*[^)]$'),
958 re.compile(br'^pulling from \$TESTTMP/.*[^)]$') 960 re.compile(br'^pulling from \$TESTTMP/.*[^)]$'),
961 # Not all platforms have 127.0.0.1 as loopback (though most do),
962 # so we always glob that too.
963 re.compile(br'.*127.0.0.1.*$'),
959 ] 964 ]
960 965
961 bchr = chr 966 bchr = chr
962 if PYTHON3: 967 if PYTHON3:
963 bchr = lambda x: bytes([x]) 968 bchr = lambda x: bytes([x])
1261 for pat in checkcodeglobpats: 1266 for pat in checkcodeglobpats:
1262 if pat.match(el): 1267 if pat.match(el):
1263 return True 1268 return True
1264 return b'-glob' 1269 return b'-glob'
1265 return True 1270 return True
1271 el = el.replace(b'127.0.0.1', b'*')
1266 i, n = 0, len(el) 1272 i, n = 0, len(el)
1267 res = b'' 1273 res = b''
1268 while i < n: 1274 while i < n:
1269 c = el[i:i + 1] 1275 c = el[i:i + 1]
1270 i += 1 1276 i += 1