This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] testsuite: Error on trailing newlines [Re: [obv] testsuite: gdb.cp/ref-types.exp: Excessive newline]


> It now generates some:
> Running ./gdb.cp/ref-types.exp ...
> ERROR: tcl error sourcing ./gdb.cp/ref-types.exp.
> ERROR: gdb_test_multiple: "print value of UI" used trailing newline
>     while executing
> "error "gdb_test_multiple: \"$message\" used trailing newline""
>     invoked from within
> "if [string match "*\[\r\n\]" $command] {

Thanks for doing that.

I think it's a step in the right direction.  I did double-check the
implementation of gdb_test_multiple and it showed that the \n is added
there (so should never be added by the caller), and that a trailing
\n would cause the function to send an empty command.

The problem is that we are probably removing the ability of using that
function to test repeat/non-repeat commands.  But I think that this is
the exception rather than the norm, and I suggest we use...

        send_gdb "\n"
        gdb_test/gdb_test_multiple "" [...]

... when we want to send empty commands.

> OK to check-in?  There may be regressions for testcases not tested on this
> platform.

I think that's fine, it's easy to fix.

> 	* gdb.base/commands.exp (add printf tbreak command): Remove trailing
> 	newline.
> 	* gdb.gdb/complaints.exp (empty non-verbose non-noisy clear)
> 	(empty verbose non-noisy clear, empty verbose noisy clear)
> 	(empty non-verbose noisy clear): Likewise.

This part is definitely OK (you've treated them as obvious so far).
So let's commit them now.

> 	* lib/gdb.exp (gdb_test_multiple): Error on trailing newlines.

This part is OK as far as I am concerned, but let's hold off on it
for a couple of days, to see if others have any comment about it.
I'd like to take this opportunity to adjust the error message a bit
to make it clearer that it's the command that has a trailing new-line,
not the message. Something like this, maybe?

    Invalid trailing newline in \"$message\" test

? I don't mind the gdb_test_multiple in the error message if you think
it makes a difference, but I can see how it can confuse people who are
not familiar with the testsuite infrastructure if the test was written
using gdb_test...

-- 
Joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]