This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA/testsuite] Regexp-escape command in capture_command_output
- From: Sergio Durigan Junior <sergiodj at redhat dot com>
- To: Keith Seitz <keiths at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 11 Jun 2015 16:13:30 -0400
- Subject: Re: [RFA/testsuite] Regexp-escape command in capture_command_output
- Authentication-results: sourceware.org; auth=none
- References: <20150519221428 dot 769 dot 46872 dot stgit at valrhona dot uglyboxes dot com> <555BB8E7 dot 4010906 at redhat dot com> <87twuevz8b dot fsf at redhat dot com> <5579EB36 dot 9010500 at redhat dot com>
On Thursday, June 11 2015, Keith Seitz wrote:
> On 06/11/2015 12:09 PM, Sergio Durigan Junior wrote:
>>>> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
>>>> index 73e55e3..fe7dd60 100644
>>>> --- a/gdb/testsuite/lib/gdb.exp
>>>> +++ b/gdb/testsuite/lib/gdb.exp
>>>> @@ -5185,7 +5185,7 @@ proc capture_command_output { command prefix } {
>>>>
>>>> set output_string ""
>>>> gdb_test_multiple "$command" "capture_command_output for $command" {
>>>> - -re "${command}\[\r\n\]+${prefix}(.*)\[\r\n\]+$gdb_prompt $" {
>>>> + -re "[string_to_regexp ${command}]\[\r\n\]+${prefix}(.*)\[\r\n\]+$gdb_prompt $" {
>>>> set output_string $expect_out(1,string)
>>
>> The patch looks correct, but shouldn't we convert ${prefix} to regexp as
>> well?
>
> Actually, no, we shouldn't. Prefix is supposed to be a regexp that
> expect can grok. Much of the test suite already relies on this; in
> gdb.base/completion.exp:
>
> set regs_output [capture_command_output "mt print registers" \
> ".*Name.*Nr.*Rel.*Offset.*Size.*Type.\[^\n\]*\n"]
Aha, this is definitely not clear in the function comments. Would it be
possible to explicitly mention this there?
Thanks!
--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/