[Python-checkins] cpython (2.7): Issue #15043: skip test_gdb if the custom hooks can't be loaded (backport from

nick.coghlan python-checkins at python.org
Sun Jun 17 11:04:07 CEST 2012


http://hg.python.org/cpython/rev/ac2f5067c220
changeset:   77488:ac2f5067c220
branch:      2.7
parent:      77483:4d62f788aa19
user:        Nick Coghlan <ncoghlan at gmail.com>
date:        Sun Jun 17 19:03:39 2012 +1000
summary:
  Issue #15043: skip test_gdb if the custom hooks can't be loaded (backport from 3.x)

files:
  Lib/test/test_gdb.py |  9 +++++++++
  Misc/NEWS            |  3 +++
  2 files changed, 12 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py
--- a/Lib/test/test_gdb.py
+++ b/Lib/test/test_gdb.py
@@ -32,6 +32,15 @@
 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 = ""
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -227,6 +227,9 @@
 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.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list