From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22767 invoked by alias); 16 Aug 2018 15:54:46 -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 22758 invoked by uid 89); 16 Aug 2018 15:54:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=shot, commands.exp, UD:commands.exp, commandsexp X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Aug 2018 15:54:44 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C390D7788C; Thu, 16 Aug 2018 15:54:42 +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 309AB2166BA0; Thu, 16 Aug 2018 15:54:42 +0000 (UTC) Subject: Re: [RFA 2/2] Modify gdb.base/commands.exp to test multi breakpoint command setting/clearing. To: Philippe Waroquiers , gdb-patches@sourceware.org References: <20180802212613.29813-1-philippe.waroquiers@skynet.be> <20180802212613.29813-3-philippe.waroquiers@skynet.be> From: Pedro Alves Message-ID: <73cfa6d6-b0e4-77bd-6221-bd824e03338a@redhat.com> Date: Thu, 16 Aug 2018 15:54:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180802212613.29813-3-philippe.waroquiers@skynet.be> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-08/txt/msg00398.txt.bz2 Hi Philippe, On 08/02/2018 10:26 PM, Philippe Waroquiers wrote: > gdb/testsuite/ChangeLog > 2018-08-02 Philippe Waroquiers > > * gdb.base/commands.exp: Test multi breakpoints setting > and clearing. > --- > gdb/testsuite/gdb.base/commands.exp | 44 +++++++++++++++++++++++++++++ > 1 file changed, 44 insertions(+) > > diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp > index 259b89b803..57d9348244 100644 > --- a/gdb/testsuite/gdb.base/commands.exp > +++ b/gdb/testsuite/gdb.base/commands.exp > @@ -281,6 +281,49 @@ proc_with_prefix breakpoint_command_test {} { > gdb_test "print value" " = 5" > } > > +# Test clearing the commands of several breakpoints with one single "end". > +# As this test uses breakpoint numbers, we better run it first to ensure > +# the breakpoint numbers are not changing if other tests are added/changed > +# so that breakpoint numbers are also changed. The "are not changing" here gave me pause. I think you meant "do not change". I'd suggest: # Test clearing the commands of several breakpoints with one single "end". # As this test hardcodes breakpoint numbers, we better run it first to ensure # the breakpoint numbers remain stable, as other tests can also create # breakpoints. But, I think you could simply remove this requirement. You can for example get the first breakpoint number with: gdb_test "break factorial" "Breakpoint.*at.*" set bpnum [get_integer_valueof "\$bpnum" 0] Or in a single shot: set bpnum 0 gdb_test_multiple "break main" "set breakpoint on main" { -re "Breakpoint ($decimal) at .*$gdb_prompt $" { set bpnum $expect_out(1,string) } } > +proc_with_prefix run_me_first_breakpoint_clear_command_test {} { > + # The below creates breakpoint nr 1. > + runto_or_return factorial > + > + set any "\[^\r\n\]*" > + delete_breakpoints > + gdb_test "break factorial" "Breakpoint.*at.*" > + gdb_test "break main" "Breakpoint.*at.*" > + gdb_test \ > + [multi_line_input \ > + {commands 2 3} \ > + { print 1234321} \ > + {end}] \ > + "End with.*" \ > + "commands" > + gdb_test "info breakpoints" \ > + [multi_line \ > + "${any}What${any}" \ > + "${any}in factorial${any}" \ > + "${any}print 1234321${any}" \ > + "${any}in main${any}" \ > + "${any}print 1234321${any}" \ > + ] \ > + "check print 1234321 is there." No period at end of test name. While at it, "check" is redundant, since all tests are checks. > + gdb_test \ > + [multi_line_input \ > + {commands 2 3} \ > + {end}] \ > + "End with.*" \ > + "commands" > + gdb_test "info breakpoints" \ > + [multi_line \ > + "${any}What${any}" \ > + "${any}in factorial${any}" \ > + "${any}in main${any}" \ > + ] \ > + "check print 1234321 is not there anymore." Ditto. Also, you have a duplicated test name above: the "commands" tests: https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Make_sure_test_messages_are_unique > + } > + > # Test a simple user defined command (with arguments) > proc_with_prefix user_defined_command_test {} { > global valnum_re > @@ -1125,6 +1168,7 @@ proc_with_prefix backslash_in_multi_line_command_test {} { > gdb_test "print 1" "" "run command" > } > > +run_me_first_breakpoint_clear_command_test > gdbvar_simple_if_test > gdbvar_simple_while_test > gdbvar_complex_if_while_test > Thanks, Pedro Alves