From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98912 invoked by alias); 19 Sep 2019 13:40:58 -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 98903 invoked by uid 89); 19 Sep 2019 13:40:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:2026, five X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Sep 2019 13:40:56 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A3194ADCF for ; Thu, 19 Sep 2019 13:40:54 +0000 (UTC) Date: Thu, 19 Sep 2019 13:40:00 -0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Don't use FOOBAR pattern in gdb_test Message-ID: <20190919134051.GA15061@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg00366.txt.bz2 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? 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.