Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>,
	gdb-patches@sourceware.org
Subject: Re: [RFAv3 5/5] Add a test case for info args|functions|locals|variables [-q] [-t TYPEREGEXP] [NAMEREGEXP]
Date: Wed, 24 Oct 2018 17:18:00 -0000	[thread overview]
Message-ID: <05ab8c60-a6ce-238c-576e-41e6c255dea4@redhat.com> (raw)
In-Reply-To: <1540332309.12106.10.camel@skynet.be>

On 10/23/2018 11:05 PM, Philippe Waroquiers wrote:
> On Mon, 2018-10-22 at 15:18 +0100, Pedro Alves wrote:
>> On 09/23/2018 10:42 PM, Philippe Waroquiers wrote:
> 
>>> +############# test 'info args' in function setup.
>>> +
>>> +gdb_test "frame 1" ".* in setup .*" "set frame 1 for info args"
>>> +
>>> +# test name regexp matching all
>>> +foreach_with_prefix cmd {
>>> +    "info args"
>>> +    "info args arg_"
>>> +    "info args g"
>>> +    "info args -- .*" } {
>>> +    gdb_test $cmd \
>>> +	[multi_line \
>>> +	     "arg_c = 100 'd'" \
>>> +	     "arg_i = 3" \
>>> +	     "arg_j = 4" \
>>> +	    ] \
>>> +	"info args"
>>> +}
>>> +
>>> +# test name regexp or type regexp matching some
>>> +foreach_with_prefix cmd {
>>> +    "info args -t int"
>>> +    "info args arg_[ij]"} {
>>> +    gdb_test $cmd \
>>> +	[multi_line \
>>> +	     "arg_i = 3" \
>>> +	     "arg_j = 4" \
>>> +	    ] \
>>> +	"info args"
>>> +}
>>
>> Duplicate test names.  
>>
>> Consider sing  with_test_prefix to wrap groups of tests.
> 
> Doing
>   make check RUNTESTFLAGS="gdb.base/info_qt.exp"
>   cat gdb/testsuite/gdb.sum | grep "PASS" | sort | uniq -c | sort -n
> shows only unique test names (thanks to foreach_with_prefix I think).
> 

Ah, sorry, wasn't thinking / missed the foreach_with_prefix.

> Is the 'with_test_prefix' aimed at removing duplication ?
> Or is it to have 4 groups wrapping together all the tests of
>    'info var'
>    'info local'
>    'info functions'
>    'info args'
> ?
Yeah, it was kind of both.

You could use it to group parts of the testcase, like,
where you had:

 ############# test 'info args' in function setup.

You could wrap the related tests with with_test_prefix:

 # Test 'info args' in function setup.
 with_test_prefix "'info args' func setup" {
   ....

Then you don't need to add "for info args" "for info locals", etc.
to specific test names.


Also, with:

 # Test name regexp matching all.
 foreach_with_prefix cmd {
    "info args"
    "info args arg_"
    "info args g"
    "info args -- .*" } {
    gdb_test $cmd \
	[multi_line \
	     "arg_c = 100 'd'" \
	     "arg_i = 3" \
	     "arg_j = 4" \
	    ] \
	"info args"
 }

I take it you end up getting output like:

 cmd=info args: info args
 cmd=info args arg_: info args
 cmd=info args g: info args
 cmd=info args -- .*: info args

But if you wrote it like this instead:

 # Test name regexp matching all.
 with_test_prefix "name regexp matching all" {
   foreach cmd {
    "info args"
    "info args arg_"
    "info args g"
    "info args -- .*" } {
    gdb_test $cmd \
	[multi_line \
	     "arg_c = 100 'd'" \
	     "arg_i = 3" \
	     "arg_j = 4" \
	    ]
  }
 }

You'd get:

 name regexp matching all: info args
 name regexp matching all: info args arg_
 name regexp matching all: info args g
 name regexp matching all: info args -- .*

Which I'd think results in clearer grouping in the gdb.sum file?

Thanks,
Pedro Alves


  reply	other threads:[~2018-10-24 17:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-23 21:42 [RFAv3 0/5] info [args|functions|locals|variables] " Philippe Waroquiers
2018-09-23 21:42 ` [RFAv3 5/5] Add a test case for info args|functions|locals|variables " Philippe Waroquiers
2018-10-22 14:19   ` Pedro Alves
2018-10-23 22:05     ` Philippe Waroquiers
2018-10-24 17:18       ` Pedro Alves [this message]
2018-09-23 21:42 ` [RFAv3 1/5] New cli-utils.h/.c function extract_info_print_args Philippe Waroquiers
2018-10-22 14:16   ` Pedro Alves
2018-10-23 21:59     ` Philippe Waroquiers
2018-10-24 17:03       ` Pedro Alves
2018-09-23 21:42 ` [RFAv3 3/5] Document changes to info [args|functions|locals|variables] Philippe Waroquiers
2018-09-24  7:03   ` Eli Zaretskii
2018-10-22 14:17   ` Pedro Alves
2018-09-23 21:42 ` [RFAv3 4/5] Announce changes in NEWS " Philippe Waroquiers
2018-09-24  6:59   ` Eli Zaretskii
2018-09-23 21:42 ` [RFAv3 2/5] Add [-q] [-t TYPEREGEXP] [NAMEREGEXP] args " Philippe Waroquiers
2018-10-22 14:16   ` Pedro Alves
2018-10-02 18:17 ` [RFAv3 0/5] info [args|functions|locals|variables] [-q] [-t TYPEREGEXP] [NAMEREGEXP] Philippe Waroquiers
2018-10-11 19:56 ` PING^2 " Philippe Waroquiers
2018-10-18 19:37 ` PING^3 " Philippe Waroquiers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=05ab8c60-a6ce-238c-576e-41e6c255dea4@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=philippe.waroquiers@skynet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox