[Python-checkins] bpo-34401: Fix test_gdb for HP GDB version string (GH-20804)

Miss Islington (bot) webhook-mailer at python.org
Thu Jun 11 10:07:44 EDT 2020


https://github.com/python/cpython/commit/5b8e3a533560c39eb40b2fb950d2b14caacfaf6a
commit: 5b8e3a533560c39eb40b2fb950d2b14caacfaf6a
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-06-11T07:07:39-07:00
summary:

bpo-34401: Fix test_gdb for HP GDB version string (GH-20804)


The GDB provided by HPE on HP-UX contains a modified version string. Therefore
the tests fail. Adapt the regex to match that string.

Patch by Michael Osipov.

Co-Authored-by: Michael Osipov <michael.osipov at siemens.com>
(cherry picked from commit b2dca49ca3769cb60713f5c2b43e5d5bbdc1f9c7)

Co-authored-by: Victor Stinner <vstinner at python.org>

files:
A Misc/NEWS.d/next/Tests/2018-08-20-09-38-52.bpo-34401.eGxMPm.rst
M Lib/test/test_gdb.py

diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py
index f043c9256e02f..d90ca5a51ae1b 100644
--- a/Lib/test/test_gdb.py
+++ b/Lib/test/test_gdb.py
@@ -39,7 +39,8 @@ def get_gdb_version():
     # 'GNU gdb (GDB) Fedora 7.9.1-17.fc22\n' -> 7.9
     # 'GNU gdb 6.1.1 [FreeBSD]\n' -> 6.1
     # 'GNU gdb (GDB) Fedora (7.5.1-37.fc18)\n' -> 7.5
-    match = re.search(r"^GNU gdb.*?\b(\d+)\.(\d+)", version)
+    # 'HP gdb 6.7 for HP Itanium (32 or 64 bit) and target HP-UX 11iv2 and 11iv3.\n' -> 6.7
+    match = re.search(r"^(?:GNU|HP) gdb.*?\b(\d+)\.(\d+)", version)
     if match is None:
         raise Exception("unable to parse GDB version: %r" % version)
     return (version, int(match.group(1)), int(match.group(2)))
diff --git a/Misc/NEWS.d/next/Tests/2018-08-20-09-38-52.bpo-34401.eGxMPm.rst b/Misc/NEWS.d/next/Tests/2018-08-20-09-38-52.bpo-34401.eGxMPm.rst
new file mode 100644
index 0000000000000..1b28d94c056d4
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2018-08-20-09-38-52.bpo-34401.eGxMPm.rst
@@ -0,0 +1 @@
+Make test_gdb properly run on HP-UX. Patch by Michael Osipov.



More information about the Python-checkins mailing list