mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-40436: Fix code parsing gdb version (GH-19792)
test_gdb and test.pythoninfo now check gdb command exit code.
This commit is contained in:
parent
9a8c1315c3
commit
ec9bea4a37
3 changed files with 12 additions and 2 deletions
|
@ -376,6 +376,9 @@ def collect_gdb(info_add):
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
universal_newlines=True)
|
universal_newlines=True)
|
||||||
version = proc.communicate()[0]
|
version = proc.communicate()[0]
|
||||||
|
if proc.returncode:
|
||||||
|
# ignore gdb failure: test_gdb will log the error
|
||||||
|
return
|
||||||
except OSError:
|
except OSError:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,18 @@ from test.support import findfile, python_is_optimized
|
||||||
|
|
||||||
def get_gdb_version():
|
def get_gdb_version():
|
||||||
try:
|
try:
|
||||||
proc = subprocess.Popen(["gdb", "-nx", "--version"],
|
cmd = ["gdb", "-nx", "--version"]
|
||||||
|
proc = subprocess.Popen(cmd,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
universal_newlines=True)
|
universal_newlines=True)
|
||||||
with proc:
|
with proc:
|
||||||
version = proc.communicate()[0]
|
version, stderr = proc.communicate()
|
||||||
|
|
||||||
|
if proc.returncode:
|
||||||
|
raise Exception(f"Command {' '.join(cmd)!r} failed "
|
||||||
|
f"with exit code {proc.returncode}: "
|
||||||
|
f"stdout={version!r} stderr={stderr!r}")
|
||||||
except OSError:
|
except OSError:
|
||||||
# This is what "no gdb" looks like. There may, however, be other
|
# This is what "no gdb" looks like. There may, however, be other
|
||||||
# errors that manifest this way too.
|
# errors that manifest this way too.
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
test_gdb and test.pythoninfo now check gdb command exit code.
|
Loading…
Add table
Add a link
Reference in a new issue