]> granicus.if.org Git - python/commitdiff
Issue #15043: skip test_gdb if the custom hooks can't be loaded
authorNick Coghlan <ncoghlan@gmail.com>
Sun, 17 Jun 2012 08:57:20 +0000 (18:57 +1000)
committerNick Coghlan <ncoghlan@gmail.com>
Sun, 17 Jun 2012 08:57:20 +0000 (18:57 +1000)
Lib/test/test_gdb.py
Misc/NEWS

index aea7c0c3eeccb2e438d940c6ec1b2eaf37defeef..a02f5c754efe2372ba4cf0b49b2280abe7fa2abb 100644 (file)
@@ -32,6 +32,15 @@ gdbpy_version, _ = p.communicate()
 if gdbpy_version == b'':
     raise unittest.SkipTest("gdb not built with embedded python support")
 
+# Verify that "gdb" can load our custom hooks
+p = subprocess.Popen(["gdb", "--batch", cmd,
+                      "--args", sys.executable],
+                     stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+__, gdbpy_errors = p.communicate()
+if b"auto-loading has been declined" in gdbpy_errors:
+    msg = "gdb security settings prevent use of custom hooks: %s"
+    raise unittest.SkipTest(msg % gdbpy_errors)
+
 def gdb_has_frame_select():
     # Does this build of gdb have gdb.Frame.select ?
     cmd = "--eval-command=python print(dir(gdb.Frame))"
index f9abb667202b90e78d4f27b31f43060e8c16ea5a..53b596696c764b6fbd5d8c1472683eb154210a5f 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -301,6 +301,9 @@ Extension Modules
 Tests
 -----
 
+- Issue #15043: test_gdb is now skipped entirely if gdb security settings
+  block loading of the gdb hooks
+
 - Issue #14026: In test_cmd_line_script, check that sys.argv is populated
   correctly for the various invocation approaches (Patch by Jason Yeo)