From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KKrqM6TvVWGIXQAAWB0awg (envelope-from ) for ; Thu, 30 Sep 2021 13:11:00 -0400 Received: by simark.ca (Postfix, from userid 112) id D24931EE28; Thu, 30 Sep 2021 13:11:00 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.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 0D3061EDF7 for ; Thu, 30 Sep 2021 13:11:00 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A6A6E3858C39 for ; Thu, 30 Sep 2021 17:10:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A6A6E3858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1633021859; bh=L4gDtr3NDaC+k0XLM1RgVoKcLgpj/MD+dL8iXonZFuk=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=WhKo4hMTrA7sGX9mpH9Pwqd5ptopbKOYFIHWxl2C2IFkbzcQ0GsZFj7RjxWYquXsk agFl0lZNAI45S4K8TnUjtfCWxohMvvGvEkPrfHf1HJuqSN73b6gQw1GwUvrwnA5dlw Nof/14rEIkkEnWsFr0AUuNPfOv+DVHMhRfCD8kM0= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 085623857C53 for ; Thu, 30 Sep 2021 17:09:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 085623857C53 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (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 4166C22564 for ; Thu, 30 Sep 2021 17:09:50 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (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 imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2E6E913AF5 for ; Thu, 30 Sep 2021 17:09:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id XY0NCl7vVWExWwAAMHmgww (envelope-from ) for ; Thu, 30 Sep 2021 17:09:50 +0000 Date: Thu, 30 Sep 2021 19:09:48 +0200 To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Check compilation result in gdb.base/structs.exp Message-ID: <20210930170947.GA25116@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: , 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 test-case gdb.base/structs.exp with target board unix/-bad, I get: ... gdb compile failed, gcc: error: unrecognized command line option '-bad' UNTESTED: gdb.base/structs.exp: failed to prepare ERROR: tcl error sourcing src/gdb/testsuite/gdb.base/structs.exp. ERROR: can't read "use_gdb_stub": no such variable ... Fix this by checking the compilation result. Fix the resulting DUPLICATEs using with_test_prefix. Tested on x86_64-linux. Committed to trunk. Thanks, - Tom [gdb/testsuite] Check compilation result in gdb.base/structs.exp --- gdb/testsuite/gdb.base/structs.exp | 204 ++++++++++++------------------------- 1 file changed, 63 insertions(+), 141 deletions(-) diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp index fcdde93cdd0..ae847f85a50 100644 --- a/gdb/testsuite/gdb.base/structs.exp +++ b/gdb/testsuite/gdb.base/structs.exp @@ -71,12 +71,10 @@ proc start_structs_test { types } { } # Make certain that the output is consistent - with_test_prefix "types=$types" { - gdb_test_no_output "set print sevenbit-strings" - gdb_test_no_output "set print address off" - gdb_test_no_output "set width 0" - gdb_test_no_output "set print elements 300" - } + gdb_test_no_output "set print sevenbit-strings" + gdb_test_no_output "set print address off" + gdb_test_no_output "set width 0" + gdb_test_no_output "set print elements 300" # Advance to main if { ![runto_main] } then { @@ -484,33 +482,43 @@ proc test_struct_returns { n } { # Test every single char struct from 1..17 in size. This is what the # original "structs" test was doing. -start_structs_test { tc } -test_struct_calls 1 -test_struct_calls 2 -test_struct_calls 3 -test_struct_calls 4 -test_struct_calls 5 -test_struct_calls 6 -test_struct_calls 7 -test_struct_calls 8 -test_struct_calls 9 -test_struct_calls 10 -test_struct_calls 11 -test_struct_calls 12 -test_struct_calls 13 -test_struct_calls 14 -test_struct_calls 15 -test_struct_calls 16 -test_struct_calls 17 -test_struct_returns 1 -test_struct_returns 2 -test_struct_returns 3 -test_struct_returns 4 -test_struct_returns 5 -test_struct_returns 6 -test_struct_returns 7 -test_struct_returns 8 +proc test { types c r } { + with_test_prefix types=[join $types "-"] { + if { [start_structs_test $types] } { + return + } + + if { [llength $c] == 0 } { + # Done. + } elseif { [llength $c] == 1 } { + test_struct_calls [lindex $c 0] + } elseif { [llength $c] == 2 } { + set low_c [lindex $c 0] + set high_c [lindex $c 1] + for {set i $low_c} {$i <= $high_c} {incr i} { + test_struct_calls $i + } + } else { + error "invalid list length" + } + + if { [llength $r] == 0 } { + # Done. + } elseif { [llength $r] == 1 } { + test_struct_returns [lindex $r 0] + } elseif { [llength $r] == 2 } { + set low_r [lindex $r 0] + set high_r [lindex $r 1] + for {set i $low_r} {$i <= $high_r} {incr i} { + test_struct_returns $i + } + } else { + error "invalid list length" + } + } +} +test { tc } {1 17} {1 8} # Let the fun begin. @@ -527,165 +535,79 @@ test_struct_returns 8 # naturally aligned. Padding being added where needed. # Approx size: 2, 4, ... -start_structs_test { ts } -test_struct_calls 1 -test_struct_calls 2 -test_struct_calls 3 -test_struct_calls 4 -test_struct_calls 5 -test_struct_returns 1 -test_struct_returns 2 -test_struct_returns 3 -test_struct_returns 4 +test { ts } {1 5} {1 4} # Approx size: 4, 8, ... -start_structs_test { ti } -test_struct_calls 1 -test_struct_calls 2 -test_struct_calls 3 -test_struct_returns 1 -test_struct_returns 2 +test { ti } {1 3} {1 2} # Approx size: 4, 8, ... -start_structs_test { tl } -test_struct_calls 1 -test_struct_calls 2 -test_struct_calls 3 -test_struct_returns 1 -test_struct_returns 2 +test { tl } {1 3} {1 2} # Approx size: 8, 16, ... -start_structs_test { tll } -test_struct_calls 1 -test_struct_calls 2 -test_struct_returns 1 +test { tll } {1 2} {1} if { !$skip_float_test } { # Approx size: 4, 8, ... - start_structs_test { tf } - test_struct_calls 1 - test_struct_calls 2 - test_struct_calls 3 - test_struct_returns 1 - test_struct_returns 2 + test { tf } {1 3} {1 2} # Approx size: 8, 16, ... - start_structs_test { td } - test_struct_calls 1 - test_struct_calls 2 - test_struct_returns 1 + test { td } {1 2} {1} # Approx size: 16, 32, ... - start_structs_test { tld } - test_struct_calls 1 - test_struct_calls 2 - test_struct_returns 1 + test { tld } {1 2} {1} } # Approx size: 2+1=3, 4, ... -start_structs_test { ts tc } -test_struct_calls 2 -test_struct_calls 3 -test_struct_calls 4 -test_struct_calls 5 -test_struct_calls 6 -test_struct_calls 7 -test_struct_calls 8 -test_struct_returns 2 +test { ts tc } {2 8} {2} # Approx size: 4+1=5, 6, ... -start_structs_test { ti tc } -test_struct_calls 2 -test_struct_calls 3 -test_struct_calls 4 -test_struct_calls 5 -test_struct_calls 6 -test_struct_returns 2 +test { ti tc } {2 6} {2} # Approx size: 4+1=5, 6, ... -start_structs_test { tl tc } -test_struct_calls 2 -test_struct_calls 3 -test_struct_calls 4 -test_struct_calls 5 -test_struct_calls 6 -test_struct_returns 2 +test { tl tc } {2 6} {2} # Approx size: 8+1=9, 10, ... -start_structs_test { tll tc } -test_struct_calls 2 +test { tll tc } {2} {} if { !$skip_float_test } { # Approx size: 4+1=5, 6, ... - start_structs_test { tf tc } - test_struct_calls 2 - test_struct_calls 3 - test_struct_calls 4 - test_struct_calls 5 - test_struct_calls 6 - test_struct_returns 2 + test { tf tc } {2 6} {2} # Approx size: 8+1=9, 10, ... - start_structs_test { td tc } - test_struct_calls 2 + test { td tc } {2} {} # Approx size: 16+1=17, 18, ... - start_structs_test { tld tc } - test_struct_calls 2 + test { tld tc } {2} {} } # Approx size: (1+1)+2=4, 6, ... -start_structs_test { tc ts } -test_struct_calls 2 -test_struct_calls 3 -test_struct_calls 4 -test_struct_calls 5 -test_struct_calls 6 -test_struct_returns 2 +test { tc ts } {2 6} {2} # Approx size: (1+3)+4=8, 12, ... -start_structs_test { tc ti } -test_struct_calls 2 -test_struct_calls 3 -test_struct_calls 4 -test_struct_returns 2 +test { tc ti } {2 4} {2} # Approx size: (1+3)+4=8, 12, ... -start_structs_test { tc tl } -test_struct_calls 2 -test_struct_calls 3 -test_struct_calls 4 -test_struct_returns 2 +test { tc tl } {2 4} {2} # Approx size: (1+7)+8=16, 24, ... -start_structs_test { tc tll } -test_struct_calls 2 +test { tc tll } {2} {} if { !$skip_float_test } { # Approx size: (1+3)+4=8, 12, ... - start_structs_test { tc tf } - test_struct_calls 2 - test_struct_calls 3 - test_struct_calls 4 + test { tc tf } {2 4} {} # Approx size: (1+7)+8=16, 24, ... - start_structs_test { tc td } - test_struct_calls 2 + test { tc td } {2} {} # Approx size: (1+15)+16=32, 48, ... - start_structs_test { tc tld } - test_struct_calls 2 + test { tc tld } {2} {} # Some float combinations # Approx size: 8+4=12, 16, ... - start_structs_test { td tf } - test_struct_calls 2 - test_struct_returns 2 + test { td tf } {2} {2} # Approx size: (4+4)+8=16, 32, ... - start_structs_test { tf td } - test_struct_calls 2 - test_struct_returns 2 + test { tf td } {2} {2} } return 0