From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92329 invoked by alias); 19 Sep 2019 16:41:01 -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 92321 invoked by uid 89); 19 Sep 2019 16:41:01 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=five X-HELO: mail-qk1-f194.google.com Received: from mail-qk1-f194.google.com (HELO mail-qk1-f194.google.com) (209.85.222.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Sep 2019 16:41:00 +0000 Received: by mail-qk1-f194.google.com with SMTP id f16so4027599qkl.9 for ; Thu, 19 Sep 2019 09:40:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mTSoScYfh11HJ8HPGaHKJbAcrGSno9ht7GPD3KDnH5g=; b=FtLISDGXOFvoq1Uj3veYXz8kzBiX+ymyzZel2LtTI/pyjao0pyjIFboYSEqGhCyKrw lD/r27rZKKEwPbUmrOQ7X8RGJOydGGA2FwRwrRr/el/5p4dbgRFsquMlhi8QVpMXJvEu DI5o8OgFc8jM49B/qJlIficqwF/cWVPbdkhaJ7R/3jVCxXsLwFQTZIk/HLigpwKmSWvn CJZM/mmhvB+WqLDJNO5ze++I9p6zPzMnW7x6cF3X+Zkn17cpRAmkR36pQ/Parp54d4fe cwb7trinvrKf9aE2n06mK9stTMczQioKcu2vlMfF+YW6ctNqX8N9eHu6rD6uX/od7fK7 zb1A== Return-Path: Received: from localhost ([172.110.70.5]) by smtp.gmail.com with ESMTPSA id z12sm5371035qkg.97.2019.09.19.09.40.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2019 09:40:56 -0700 (PDT) Date: Thu, 19 Sep 2019 16:41:00 -0000 From: Andrew Burgess To: Tom de Vries Cc: gdb-patches@sourceware.org Subject: Re: [PATCH][gdb/testsuite] Don't use FOOBAR pattern in gdb_test Message-ID: <20190919164055.GD4962@embecosm.com> References: <20190919134051.GA15061@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190919134051.GA15061@delia> X-Fortune: Man who sleep in beer keg wake up sticky. X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] User-Agent: Mutt/1.9.2 (2017-12-15) X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg00370.txt.bz2 * Tom de Vries [2019-09-19 15:40:53 +0200]: > Hi, > > If gdb_test is used with fewer than five arguments, then the question_string > defaults to "^FOOBAR$": > ... > if [llength $args]==5 { > set question_string [lindex $args 3] > set response_string [lindex $args 4] > } else { > set question_string "^FOOBAR$" > } > ... > > This can however match "FOOBAR", so perhaps "\$FOOBAR^" would have been a > better choice. > > Eliminate the FOOBAR pattern from gdb_test by instead of defining a default > regexp, conditionally appending the regexp matching to a user_code variable. > > Tested on x86_64-linux. > > OK for trunk? Looks good to me, a nice clean up. Thanks, Andrew > > Thanks, > - Tom > > [gdb/testsuite] Don't use FOOBAR pattern in gdb_test > > gdb/testsuite/ChangeLog: > > 2019-09-19 Tom de Vries > > * lib/gdb.exp (gdb_test): Eliminate "^FOOBAR$" pattern. > > --- > gdb/testsuite/lib/gdb.exp | 28 ++++++++++++++++------------ > 1 file changed, 16 insertions(+), 12 deletions(-) > > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index acbeb01376..3a1f053cf8 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -1083,24 +1083,28 @@ proc gdb_test { args } { > set command [lindex $args 0] > set pattern [lindex $args 1] > > - if [llength $args]==5 { > - set question_string [lindex $args 3] > - set response_string [lindex $args 4] > - } else { > - set question_string "^FOOBAR$" > - } > - > - return [gdb_test_multiple $command $message { > + set user_code {} > + lappend user_code { > -re "\[\r\n\]*(?:$pattern)\[\r\n\]+$gdb_prompt $" { > if ![string match "" $message] then { > pass "$message" > } > } > - -re "(${question_string})$" { > - send_gdb "$response_string\n" > - exp_continue > + } > + > + if { [llength $args] == 5 } { > + set question_string [lindex $args 3] > + set response_string [lindex $args 4] > + lappend user_code { > + -re "(${question_string})$" { > + send_gdb "$response_string\n" > + exp_continue > + } > } > - }] > + } > + > + set user_code [join $user_code] > + return [gdb_test_multiple $command $message $user_code] > } > > # Return 1 if version MAJOR.MINOR is at least AT_LEAST_MAJOR.AT_LEAST_MINOR.