summaryrefslogtreecommitdiff
path: root/Lib/test/test_gdb.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_gdb.py')
-rw-r--r--Lib/test/test_gdb.py51
1 files changed, 27 insertions, 24 deletions
diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py
index 78fc55c2f2..ccef4223c2 100644
--- a/Lib/test/test_gdb.py
+++ b/Lib/test/test_gdb.py
@@ -176,6 +176,7 @@ class DebuggerTests(unittest.TestCase):
args = ['--eval-command=%s' % cmd for cmd in commands]
args += ["--args",
sys.executable]
+ args.extend(subprocess._args_from_interpreter_flags())
if not import_site:
# -S suppresses the default 'import site'
@@ -198,27 +199,17 @@ class DebuggerTests(unittest.TestCase):
# Ignore some benign messages on stderr.
ignore_patterns = (
'Function "%s" not defined.' % breakpoint,
- "warning: no loadable sections found in added symbol-file"
- " system-supplied DSO",
- "warning: Unable to find libthread_db matching"
- " inferior's thread library, thread debugging will"
- " not be available.",
- "warning: Cannot initialize thread debugging"
- " library: Debugger service failed",
- 'warning: Could not load shared library symbols for '
- 'linux-vdso.so',
- 'warning: Could not load shared library symbols for '
- 'linux-gate.so',
- 'warning: Could not load shared library symbols for '
- 'linux-vdso64.so',
'Do you need "set solib-search-path" or '
'"set sysroot"?',
- 'warning: Source file is more recent than executable.',
- # Issue #19753: missing symbols on System Z
- 'Missing separate debuginfo for ',
- 'Try: zypper install -C ',
+ # BFD: /usr/lib/debug/(...): unable to initialize decompress
+ # status for section .debug_aranges
+ 'BFD: ',
+ # ignore all warnings
+ 'warning: ',
)
for line in errlines:
+ if not line:
+ continue
if not line.startswith(ignore_patterns):
unexpected_errlines.append(line)
@@ -301,7 +292,9 @@ class PrettyPrintTests(DebuggerTests):
'Verify the pretty-printing of dictionaries'
self.assertGdbRepr({})
self.assertGdbRepr({'foo': 'bar'}, "{'foo': 'bar'}")
- self.assertGdbRepr({'foo': 'bar', 'douglas': 42}, "{'douglas': 42, 'foo': 'bar'}")
+ # PYTHONHASHSEED is need to get the exact item order
+ if not sys.flags.ignore_environment:
+ self.assertGdbRepr({'foo': 'bar', 'douglas': 42}, "{'douglas': 42, 'foo': 'bar'}")
def test_lists(self):
'Verify the pretty-printing of lists'
@@ -364,9 +357,12 @@ class PrettyPrintTests(DebuggerTests):
'Verify the pretty-printing of sets'
if (gdb_major_version, gdb_minor_version) < (7, 3):
self.skipTest("pretty-printing of sets needs gdb 7.3 or later")
- self.assertGdbRepr(set(), 'set()')
- self.assertGdbRepr(set(['a', 'b']), "{'a', 'b'}")
- self.assertGdbRepr(set([4, 5, 6]), "{4, 5, 6}")
+ self.assertGdbRepr(set(), "set()")
+ self.assertGdbRepr(set(['a']), "{'a'}")
+ # PYTHONHASHSEED is need to get the exact frozenset item order
+ if not sys.flags.ignore_environment:
+ self.assertGdbRepr(set(['a', 'b']), "{'a', 'b'}")
+ self.assertGdbRepr(set([4, 5, 6]), "{4, 5, 6}")
# Ensure that we handle sets containing the "dummy" key value,
# which happens on deletion:
@@ -379,9 +375,12 @@ id(s)''')
'Verify the pretty-printing of frozensets'
if (gdb_major_version, gdb_minor_version) < (7, 3):
self.skipTest("pretty-printing of frozensets needs gdb 7.3 or later")
- self.assertGdbRepr(frozenset(), 'frozenset()')
- self.assertGdbRepr(frozenset(['a', 'b']), "frozenset({'a', 'b'})")
- self.assertGdbRepr(frozenset([4, 5, 6]), "frozenset({4, 5, 6})")
+ self.assertGdbRepr(frozenset(), "frozenset()")
+ self.assertGdbRepr(frozenset(['a']), "frozenset({'a'})")
+ # PYTHONHASHSEED is need to get the exact frozenset item order
+ if not sys.flags.ignore_environment:
+ self.assertGdbRepr(frozenset(['a', 'b']), "frozenset({'a', 'b'})")
+ self.assertGdbRepr(frozenset([4, 5, 6]), "frozenset({4, 5, 6})")
def test_exceptions(self):
# Test a RuntimeError
@@ -510,6 +509,10 @@ id(foo)''')
def test_builtins_help(self):
'Ensure that the new-style class _Helper in site.py can be handled'
+
+ if sys.flags.no_site:
+ self.skipTest("need site module, but -S option was used")
+
# (this was the issue causing tracebacks in
# http://bugs.python.org/issue8032#msg100537 )
gdb_repr, gdb_output = self.get_gdb_repr('id(__builtins__.help)', import_site=True)