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

index fe2c8e61fdd6043245bc281942183f115dd71e31..3c4162586029217e3b4d494957f55f9088e1e1cb 100644 (file)
@@ -32,6 +32,15 @@ gdbpy_version, _ = p.communicate()
 if gdbpy_version == '':
     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 python_is_optimized():
     cflags = sysconfig.get_config_vars()['PY_CFLAGS']
     final_opt = ""
index c50f6cbc8e901d7b40cde21f8ce06f2cd60bc125..17c636baec08766a47ba92c7acd0f043e2e33348 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -227,6 +227,9 @@ Library
 Tests
 -----
 
+- Issue #15043: test_gdb is now skipped entirely if gdb security settings
+  block loading of the gdb hooks
+
 - Issue #14589: Update certificate chain for sha256.tbs-internet.com, fixing
   a test failure in test_ssl.