From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id v9bcNWv7PmG+GwAAWB0awg (envelope-from ) for ; Mon, 13 Sep 2021 03:19:07 -0400 Received: by simark.ca (Postfix, from userid 112) id BAD891EE24; Mon, 13 Sep 2021 03:19:06 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 01C531EE18 for ; Mon, 13 Sep 2021 03:18:49 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E44223858039 for ; Mon, 13 Sep 2021 07:18:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E44223858039 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1631517528; bh=Iu4P6ju0Y8sfey87RrkoVdbQ5S3oIcfX75x7+q7XtvM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=XQ/N/7qh8CBSU8c2xNosknS7uJEfj0mQB8SLNzsHKIyYta+QpLzlreLgxQEwioI3u 9ol8JkftDeEoGuh6D346UUVdEvAX5Mtl1jFprlbRwV/jDnzujhFuu1Ir98RF5Om7Yu 8zK+SC3TCTPjBnbNiKn4WgoUfIwogXr2wdE/fD1U= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id AF4203858D35 for ; Mon, 13 Sep 2021 07:18:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AF4203858D35 Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A922E21F92 for ; Mon, 13 Sep 2021 07:18:29 +0000 (UTC) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 8EB93132AB for ; Mon, 13 Sep 2021 07:18:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id WjweIUX7PmGdfAAAGKfGzw (envelope-from ) for ; Mon, 13 Sep 2021 07:18:29 +0000 Date: Mon, 13 Sep 2021 09:18:28 +0200 To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix test name in gdb.base/batch-exit-status.exp Message-ID: <20210913071826.GA3402@delia.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, When running gdb.base/batch-exit-status.exp I noticed that the test name contains a newline: ... PASS: gdb.base/batch-exit-status.exp: : No such file or directory\.^M : No such file or directory\.: [lindex $result 2] == 0 ... The mistake is that I passed an output regexp argument to a parameter interpreted as testname prefix. Fix this by passing a testname prefix instead. Add support for checking output, to be able to handle the output regexp argument. Tested on x86_64-linux. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix test name in gdb.base/batch-exit-status.exp --- gdb/testsuite/gdb.base/batch-exit-status.exp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/gdb.base/batch-exit-status.exp b/gdb/testsuite/gdb.base/batch-exit-status.exp index 9a080196bd6..520083f7989 100644 --- a/gdb/testsuite/gdb.base/batch-exit-status.exp +++ b/gdb/testsuite/gdb.base/batch-exit-status.exp @@ -20,7 +20,7 @@ standard_testfile set good_commands "$srcdir/$subdir/batch-exit-status.good-commands" set bad_commands "$srcdir/$subdir/batch-exit-status.bad-commands" -proc _test_exit_status {expect_status cmdline_opts} { +proc _test_exit_status {expect_status cmdline_opts {re ""}} { global gdb_spawn_id gdb_exit @@ -29,7 +29,16 @@ proc _test_exit_status {expect_status cmdline_opts} { return } + set has_re [expr ![string equal $re ""]] + if { ! $has_re } { + set re "\$FOOBAR^" + } + set re_matched 0 gdb_test_multiple "" "run til exit" { + -re $re { + set re_matched 1 + exp_continue + } eof { set result [wait -i $gdb_spawn_id] verbose $result @@ -41,15 +50,18 @@ proc _test_exit_status {expect_status cmdline_opts} { clear_gdb_spawn_id } } + if { $has_re } { + gdb_assert { $re_matched } "output matched" + } } -proc test_exit_status {expect_status cmdline_opts prefix} { +proc test_exit_status {expect_status cmdline_opts prefix args} { if { $prefix == "" } { set prefix $cmdline_opts } with_test_prefix $prefix { - _test_exit_status $expect_status $cmdline_opts + _test_exit_status $expect_status $cmdline_opts {*}$args } } @@ -77,6 +89,8 @@ test_exit_status 1 "-batch -x $good_commands -x $bad_commands" \ test_exit_status 1 "-batch -x $good_commands -ex \"set not-a-thing 4\"" \ "-batch -x good-commands -ex \"set not-a-thing 4\"" -set no_such_re ": No such file or directory\\." -test_exit_status 1 "-batch \"\"" $no_such_re -test_exit_status 1 "-batch \"\" \"\"" [multi_line $no_such_re $no_such_re] +set test "No such file or directory" +set no_such_re ": $test\\." +test_exit_status 1 "-batch \"\"" "1x: $test" ^[multi_line $no_such_re ""]$ +test_exit_status 1 "-batch \"\" \"\"" "2x: $test" \ + ^[multi_line $no_such_re $no_such_re ""]$