Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit be4e4b5

Browse files
committed
Issue #15043: skip test_gdb if the custom hooks can't be loaded
1 parent 50f147a commit be4e4b5

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

Lib/test/test_gdb.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@
3232
if gdbpy_version == b'':
3333
raise unittest.SkipTest("gdb not built with embedded python support")
3434

35+
# Verify that "gdb" can load our custom hooks
36+
p = subprocess.Popen(["gdb", "--batch", cmd,
37+
"--args", sys.executable],
38+
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
39+
__, gdbpy_errors = p.communicate()
40+
if b"auto-loading has been declined" in gdbpy_errors:
41+
msg = "gdb security settings prevent use of custom hooks: %s"
42+
raise unittest.SkipTest(msg % gdbpy_errors)
43+
3544
def gdb_has_frame_select():
3645
# Does this build of gdb have gdb.Frame.select ?
3746
cmd = "--eval-command=python print(dir(gdb.Frame))"

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ Extension Modules
301301
Tests
302302
-----
303303

304+
- Issue #15043: test_gdb is now skipped entirely if gdb security settings
305+
block loading of the gdb hooks
306+
304307
- Issue #14026: In test_cmd_line_script, check that sys.argv is populated
305308
correctly for the various invocation approaches (Patch by Jason Yeo)
306309

0 commit comments

Comments
 (0)