[Python-checkins] cpython (merge 3.2 -> default): Merge from 3.2 (Issue #15043: skip test_gdb if the custom hooks can't be loaded)

nick.coghlan python-checkins at python.org
Sun Jun 17 11:19:59 CEST 2012


http://hg.python.org/cpython/rev/9456591d0761
changeset:   77490:9456591d0761
parent:      77489:939a68f5d14c
parent:      77487:2db5010a610c
user:        Nick Coghlan <ncoghlan at gmail.com>
date:        Sun Jun 17 19:16:02 2012 +1000
summary:
  Merge from 3.2 (Issue #15043: skip test_gdb if the custom hooks can't be loaded)

files:
  Lib/test/test_gdb.py |  9 +++++++++
  Misc/NEWS            |  5 ++++-
  2 files changed, 13 insertions(+), 1 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
@@ -36,6 +36,15 @@
 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))"
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -134,7 +134,10 @@
 Tests
 -----
 
-- Issue #14963 (partial): Add test cases for exception handling behaviour
+- Issue #15043: test_gdb is now skipped entirely if gdb security settings
+  block loading of the gdb hooks
+
+- Issue #14963: Add test cases for exception handling behaviour
   in contextlib.ExitStack (Initial patch by Alon Horev)
 
 

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


More information about the Python-checkins mailing list