diff options
author | OCHyams <orlando.hyams@sony.com> | 2022-02-09 11:32:29 +0000 |
---|---|---|
committer | OCHyams <orlando.hyams@sony.com> | 2022-02-09 11:45:39 +0000 |
commit | 00b2a9c9da40ef17c7645bc6cb1a7614cda1aac5 (patch) | |
tree | 4469c74fb34a83bd17096791a4ea7e46f466325b /cross-project-tests | |
parent | 29caa8583f60ed5aa668144491ce65be00986947 (diff) | |
download | llvm-00b2a9c9da40ef17c7645bc6cb1a7614cda1aac5.zip llvm-00b2a9c9da40ef17c7645bc6cb1a7614cda1aac5.tar.gz llvm-00b2a9c9da40ef17c7645bc6cb1a7614cda1aac5.tar.bz2 |
[cross-project-tests] Make GDB version string parsing more robust
Follow up to D118468 (5257efdc5b30212b62a9d68857dc8e66d0e1a863).
When built from source, gdb's version string looks like this:
GNU gdb (GDB) 9.2
...
But for installed versions it looks different. E.g.
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
...
Use a regex rather than str.parition in the version string parsing in order to
handle this case too.
Diffstat (limited to 'cross-project-tests')
-rw-r--r-- | cross-project-tests/lit.cfg.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cross-project-tests/lit.cfg.py b/cross-project-tests/lit.cfg.py index c4bb83d..ffa208f 100644 --- a/cross-project-tests/lit.cfg.py +++ b/cross-project-tests/lit.cfg.py @@ -216,11 +216,11 @@ def get_gdb_version_string(): if len(gdb_vers_lines) < 1: print("Unkown GDB version format (too few lines)", file=sys.stderr) return None - string = gdb_vers_lines[0].strip().partition('GNU gdb (GDB) ')[2] - if len(string) == 0: - print("Unkown GDB version format", file=sys.stderr) + match = re.search('GNU gdb \(.*?\) ((\d|\.)+)', gdb_vers_lines[0].strip()) + if match is None: + print(f"Unkown GDB version format: {gdb_vers_lines[0]}", file=sys.stderr) return None - return string + return match.group(1) def get_clang_default_dwarf_version_string(triple): """Return the default dwarf version string for clang on this (host) platform |