test_gdb: fix regex to parse the GDB version

Fix the regex to support the version 7.10: minor version with two digits
This commit is contained in:
Victor Stinner 2015-09-15 00:19:47 +02:00
parent 061653091e
commit df11d7c2b4
1 changed files with 3 additions and 2 deletions

View File

@ -33,8 +33,9 @@ def get_gdb_version():
# Regex to parse: # Regex to parse:
# 'GNU gdb (GDB; SUSE Linux Enterprise 12) 7.7\n' -> 7.7 # 'GNU gdb (GDB; SUSE Linux Enterprise 12) 7.7\n' -> 7.7
# 'GNU gdb (GDB) Fedora 7.9.1-17.fc22\n' -> 7.9 # 'GNU gdb (GDB) Fedora 7.9.1-17.fc22\n' -> 7.9
# 'GNU gdb 6.1.1 [FreeBSD]\n' # 'GNU gdb 6.1.1 [FreeBSD]\n' -> 6.1
match = re.search("^GNU gdb.*? (\d+)\.(\d)", version) # 'GNU gdb (GDB) Fedora (7.5.1-37.fc18)\n' -> 7.5
match = re.search(r"^GNU gdb.*?\b(\d+)\.(\d+)", version)
if match is None: if match is None:
raise Exception("unable to parse GDB version: %r" % version) raise Exception("unable to parse GDB version: %r" % version)
return (version, int(match.group(1)), int(match.group(2))) return (version, int(match.group(1)), int(match.group(2)))