diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-06-21 21:58:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-21 21:58:53 (GMT) |
commit | adcdb1e4f5eb3c63e4e40242737be9c00a26764c (patch) | |
tree | 6e4d48b8a9deba6cef83e4a8870e49e36fe9330c | |
parent | c421c66a58a6caae30f0679d7e61411418e67cec (diff) | |
download | cpython-adcdb1e4f5eb3c63e4e40242737be9c00a26764c.zip cpython-adcdb1e4f5eb3c63e4e40242737be9c00a26764c.tar.gz cpython-adcdb1e4f5eb3c63e4e40242737be9c00a26764c.tar.bz2 |
bpo-37362: test_gdb now ignores stderr (GH-14287) (GH-14297)
test_gdb no longer fails if it gets an "unexpected" message on
stderr: it now ignores stderr. The purpose of test_gdb is to test
that python-gdb.py commands work as expected, not to test gdb.
(cherry picked from commit e56a123fd0acaa295a28b98d2e46d956b97d1263)
-rw-r--r-- | Lib/test/test_gdb.py | 47 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Tests/2019-06-21-15-47-33.bpo-37362.D3xppx.rst | 3 |
2 files changed, 16 insertions, 34 deletions
diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py index 335e48a..b96acc0 100644 --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -215,43 +215,22 @@ class DebuggerTests(unittest.TestCase): elif script: args += [script] - # print args - # print ' '.join(args) - # Use "args" to invoke gdb, capturing stdout, stderr: out, err = run_gdb(*args, PYTHONHASHSEED='0') - errlines = err.splitlines() - unexpected_errlines = [] - - # Ignore some benign messages on stderr. - ignore_patterns = ( - 'Function "%s" not defined.' % breakpoint, - 'Do you need "set solib-search-path" or ' - '"set sysroot"?', - # 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 - # bpo34007: Sometimes some versions of the shared libraries that - # are part of the traceback are compiled in optimised mode and the - # Program Counter (PC) is not present, not allowing gdb to walk the - # frames back. When this happens, the Python bindings of gdb raise - # an exception, making the test impossible to succeed. - if "PC not saved" in line: - raise unittest.SkipTest("gdb cannot walk the frame object" - " because the Program Counter is" - " not present") - if not line.startswith(ignore_patterns): - unexpected_errlines.append(line) - - # Ensure no unexpected error messages: - self.assertEqual(unexpected_errlines, []) + for line in err.splitlines(): + print >>sys.stderr, line + + # bpo-34007: Sometimes some versions of the shared libraries that + # are part of the traceback are compiled in optimised mode and the + # Program Counter (PC) is not present, not allowing gdb to walk the + # frames back. When this happens, the Python bindings of gdb raise + # an exception, making the test impossible to succeed. + if "PC not saved" in err: + raise unittest.SkipTest("gdb cannot walk the frame object" + " because the Program Counter is" + " not present") + return out def get_gdb_repr(self, source, diff --git a/Misc/NEWS.d/next/Tests/2019-06-21-15-47-33.bpo-37362.D3xppx.rst b/Misc/NEWS.d/next/Tests/2019-06-21-15-47-33.bpo-37362.D3xppx.rst new file mode 100644 index 0000000..43fdc10 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2019-06-21-15-47-33.bpo-37362.D3xppx.rst @@ -0,0 +1,3 @@ +test_gdb no longer fails if it gets an "unexpected" message on stderr: it now +ignores stderr. The purpose of test_gdb is to test that python-gdb.py commands +work as expected, not to test gdb. |