This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] completer test [was Re: [RFC] Cleanup for make_source_files_completion_list]
- From: Pedro Alves <palves at redhat dot com>
- To: Keith Seitz <keiths at redhat dot com>
- Cc: Sergio Durigan Junior <sergiodj at redhat dot com>, "gdb-patches at sourceware dot org ml" <gdb-patches at sourceware dot org>
- Date: Thu, 16 May 2013 10:19:09 +0100
- Subject: Re: [RFA] completer test [was Re: [RFC] Cleanup for make_source_files_completion_list]
- References: <51895A2F dot 8000504 at redhat dot com> <CADPb22Sj_5Bp+FhoQYk_9vR5c1D3fXsw4gLFu7v+jmDNSaOPFg at mail dot gmail dot com> <5191340B dot 60100 at redhat dot com> <519156F5 dot 5090000 at redhat dot com> <5193C786 dot 4000207 at redhat dot com> <5193E2DC dot 5000200 at redhat dot com> <m3r4h7kh4p dot fsf at redhat dot com> <51941E85 dot 8010104 at redhat dot com>
On 05/16/2013 12:47 AM, Keith Seitz wrote:
> On 05/15/2013 03:33 PM, Sergio Durigan Junior wrote:
>> Wouldn't it be better to use the "complete" command? Here is what I see
>> when I use it:
>>
>> (gdb) complete break filesy
>> break filesym
>> break filesym.c
>
> Is that necessarily "better" than testing what a user would actually type? I don't know. gdb.base/completion.exp uses both forms.
Yeah. Testing just "complete" doesn't cover everything
necessary. See thread around:
http://sourceware.org/ml/gdb-patches/2011-05/msg00032.html
"complete" is useful for frontends, so it's good to test it too.
An idea would be to have a mechanism (procedure, whatever) in (or used by)
completion.exp that given an input string and the expected completions
exercises both "complete" and "\t" with a single call. E.g.,:
test_completion "break filesy" { "break" "break filesym.c" }
Probably, the completion.exp tests already test the specifics of gdb<->readline
interaction that only the \t code paths trigger, independent of specific
completer, so for testing specific completers it's probably fine to just
go with using the simpler "complete" way only. If we had the mechanism
suggested above, then we wouldn't have to think about considering whether
all bases are covered though. We'd just always use it. :-)
This patch seems to involve testing sort of actual completion mechanics,
so it looks like a specific case where testing (at least) the \t variant
is good.
> This is the first I've heard of send_gdb being deprecated. As far as I can tell, there is no other way to directly test completion this way. I do see, though, that completion.exp uses gdb_test_multiple instead of gdb_expect... If it truly is deprecated, I would expect send_gdb to be made "private" in some way. [deprecated_send_gdb?] Or at least mentioned in lib/gdb.exp.
Yeah. Testing completion is one of the cases that need to use it.
If we had a higher level mechanism/procedure that simplified \t completion
testing, we could hide those send_gdb calls though. :-)
> If there is a preference for one or the other [or an actual policy], I will certainly make necessary changes.
>
> I'm using a similar test strategy for my explicit completion tests, which I am about to submit...
Please use gdb_test_multiple. See e.g., how completion.exp itself
simplified much when converted to it:
http://sourceware.org/ml/gdb-patches/2011-05/msg00063.html
--
Pedro Alves