From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4IcRE8MzmV/AXwAAWB0awg (envelope-from ) for ; Wed, 28 Oct 2020 05:02:59 -0400 Received: by simark.ca (Postfix, from userid 112) id 4BF5D1EFC1; Wed, 28 Oct 2020 05:02:59 -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.0 required=5.0 tests=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 811761E58D for ; Wed, 28 Oct 2020 05:02:58 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 453B13858005; Wed, 28 Oct 2020 09:02:58 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id E7B753858005 for ; Wed, 28 Oct 2020 09:02:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E7B753858005 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7494FB910 for ; Wed, 28 Oct 2020 09:02:53 +0000 (UTC) Date: Wed, 28 Oct 2020 10:02:51 +0100 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix gdb.cp/nsalias.exp with -readnow Message-ID: <20201028090250.GA23100@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-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: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Hi, When running test-case gdb.cp/nsalias.exp with target board readnow, we get: ... FAIL: gdb.cp/nsalias.exp: complaint for too many recursively imported \ declarations ... The complaint is not detected, because: - the complaint is triggered during the file command instead of during "print N100::x" - the "set complaints 1" is not effective because it's issued after the file command Fix the FAIL by setting the complaints limit earlier, and detecting the complaint also during the file command. Tested on x86_64-linux. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix gdb.cp/nsalias.exp with -readnow gdb/testsuite/ChangeLog: 2020-10-28 Tom de Vries * lib/gdb.exp (gdb_file_cmd): Set gdb_file_cmd_msg. * gdb.cp/nsalias.exp: Set complaints limit before file cmd. Expect complaint during file command for -readnow. --- gdb/testsuite/gdb.cp/nsalias.exp | 20 ++++++++++++++++---- gdb/testsuite/lib/gdb.exp | 14 ++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/gdb/testsuite/gdb.cp/nsalias.exp b/gdb/testsuite/gdb.cp/nsalias.exp index 892e5e268d..a7163dc5f1 100644 --- a/gdb/testsuite/gdb.cp/nsalias.exp +++ b/gdb/testsuite/gdb.cp/nsalias.exp @@ -314,9 +314,21 @@ if {[gdb_compile [list ${binfile}1.o ${binfile}3.o] \ return -1 } -clean_restart ${testfile}-r +clean_restart +# Set complaints before loading the file. Otherwise the complaint won't +# trigger for -readnow. gdb_test_no_output "set complaints 1" -gdb_test "print N100::x" \ - ".* has too many recursively imported declarations.*" \ - "complaint for too many recursively imported declarations" + +gdb_load [standard_output_file ${testfile}-r] + +set readnow_p [readnow] + +set test "complaint for too many recursively imported declarations" +set re ".* has too many recursively imported declarations.*" +if { $readnow_p } { + global gdb_file_cmd_msg + gdb_assert {[regexp $re $gdb_file_cmd_msg]} $test +} else { + gdb_test "print N100::x" $re $test +} diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 8b00ee0f54..ef96209b0d 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1803,6 +1803,9 @@ proc default_gdb_exit {} { # compiled in # fail file was not loaded # +# This procedure also set the global variable GDB_FILE_CMD_MSG to the +# output of the file command in case of success. +# # I tried returning this information as part of the return value, # but ran into a mess because of the many re-implementations of # gdb_load in config/*.exp. @@ -1820,7 +1823,7 @@ proc gdb_file_cmd { arg } { # Set whether debug info was found. # Default to "fail". - global gdb_file_cmd_debug_info + global gdb_file_cmd_debug_info gdb_file_cmd_msg set gdb_file_cmd_debug_info "fail" if [is_remote host] { @@ -1850,18 +1853,21 @@ proc gdb_file_cmd { arg } { set new_symbol_table 0 set basename [file tail $arg] gdb_expect 120 { - -re "Reading symbols from.*LZMA support was disabled.*$gdb_prompt $" { + -re "(Reading symbols from.*LZMA support was disabled.*$gdb_prompt $)" { verbose "\t\tLoaded $arg into $GDB; .gnu_debugdata found but no LZMA available" + set gdb_file_cmd_msg $expect_out(1,string) set gdb_file_cmd_debug_info "lzma" return 0 } - -re "Reading symbols from.*no debugging symbols found.*$gdb_prompt $" { + -re "(Reading symbols from.*no debugging symbols found.*$gdb_prompt $)" { verbose "\t\tLoaded $arg into $GDB with no debugging symbols" + set gdb_file_cmd_msg $expect_out(1,string) set gdb_file_cmd_debug_info "nodebug" return 0 } - -re "Reading symbols from.*$gdb_prompt $" { + -re "(Reading symbols from.*$gdb_prompt $)" { verbose "\t\tLoaded $arg into $GDB" + set gdb_file_cmd_msg $expect_out(1,string) set gdb_file_cmd_debug_info "debug" return 0 }