Re: [PATCH] Fix test always passing in python/py-linetable.exp

Joel Brobecker
2014-11-27T08:29:04Z

> This fix makes sense to me. Escaping brackets are always a source of
> confusion in TCL. Thanks for doing that.
>
> > Moreover, both in Python 2.7 and Python 3.3 the numbers don't have the L
> > suffix, so now the test fails because of that. Anybody knows why they
> > were there in the first place? I just tested with Python 2.4 and there
> > are no Ls.
>
> Yeah, I don't know. My wild guess it that it was a thinko because of
> the test just above it:
>
> gdb_test "python list_lines()" \
> "L20 A $hex.*L21 A $hex.*L22 A $hex.*L24 A $hex.*L25 A $hex.*L40 A $hex.*L42 A $hex.*L44 A $hex.*L42 A $hex.*L46 A $hex.*" \
> "test linetable iterator addr"
>
> Phil?
>
> > gdb/testsuite/ChangeLog:
> >
> > * gdb.python/py-linetable.exp: Properly escape sorted(fset)
> > test expected output. Add parentheses for the call to print.
> > Remove L suffix from integers.
>
> Two spaces after periods.

Thanks, Sergio, for your review.

I agree that the escaping is OK.

Regarding the issue of the extra 'L' at the end, I think I understand
what happened: The initial patch was using PyLong_FromUnsignedLongLong
to create the line number which, as it name indicates, returns a
Python Long, hence the 'L'. but then, probably prompted by review,
Phil changed it to use gdb_py_object_from_longest which only uses
a long if the value does not fit in an 'int'. But because of the missing
escaping, the change in output was never noticed, and so the test
never got adjusted.

The patch is approved after applying Sergio's comments.

Thanks!
--
Joel