From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26244 invoked by alias); 24 Oct 2018 17:18:59 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 26230 invoked by uid 89); 24 Oct 2018 17:18:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS autolearn=no version=3.3.2 spammy=Waroquiers, waroquiers, Philippe X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 24 Oct 2018 17:18:57 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D0DDA3097026; Wed, 24 Oct 2018 17:18:56 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 142D9601A1; Wed, 24 Oct 2018 17:18:55 +0000 (UTC) Subject: Re: [RFAv3 5/5] Add a test case for info args|functions|locals|variables [-q] [-t TYPEREGEXP] [NAMEREGEXP] To: Philippe Waroquiers , gdb-patches@sourceware.org References: <20180923214209.985-1-philippe.waroquiers@skynet.be> <20180923214209.985-6-philippe.waroquiers@skynet.be> <0f46cdb0-4c14-2d1b-9f5f-410b32c0915d@redhat.com> <1540332309.12106.10.camel@skynet.be> From: Pedro Alves Message-ID: <05ab8c60-a6ce-238c-576e-41e6c255dea4@redhat.com> Date: Wed, 24 Oct 2018 17:18:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1540332309.12106.10.camel@skynet.be> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-10/txt/msg00554.txt.bz2 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