[issue8279] python-gdb PyListTests fail

Dave Malcolm report at bugs.python.org
Thu Apr 1 18:05:29 CEST 2010

Dave Malcolm <dmalcolm at redhat.com> added the comment:

Thanks for reviewing the gdb work.

I was mistakenly testing using:
   make ; ./python Lib/test/test_gdb.py

which led to path assumptions in the code.

I'm now testing with:
   make ; ./python Lib/test/regrtest.py -v test_gdb

I'm attaching a patch which uses test_support.findfile to locate the test script; the code now works when invoked using either of the above:

$ ./python Lib/test/regrtest.py test_gdb
1 test OK.
[39894 refs]

There was also some breakage of the PyListTests due to significant trailing whitespace within the multiline string containing the expected result.  The trailing whitespace was stripped in test_gdb.py.  I've rewritten these multiline string literals as adjacent single-line string literals, so that this significant whitespace is explicit.  (The output of each line has the line number, then four spaces, then the content of the line from the source file.  An empty source line thus has the number followed by four trailing spaces.)

I've also slightly changed the regex in get_gdb_repr() that carves up what GDB prints, since gdb can insert newlines and spaces in a somewhat arbitrary way, apparently based on the width of the tty that its stdout is connected to.  The tests were passing when run from a full-screen terminal, but some would fail if I resized the terminal to 80 columns (!).  I've tested the new code at both terminal sizes, and piping to "cat" (so that it's not at tty), and all tests now pass for all three cases.

keywords: +patch
Added file: http://bugs.python.org/file16723/fix-test_gdb_sample-path-and-whitespace-issues.patch

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list