From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id kkpNO7acOGHPVwAAWB0awg (envelope-from ) for ; Wed, 08 Sep 2021 07:21:26 -0400 Received: by simark.ca (Postfix, from userid 112) id DF91E1EE22; Wed, 8 Sep 2021 07:21:26 -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 F02541ECEB for ; Wed, 8 Sep 2021 07:21:25 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 073A238618BB for ; Wed, 8 Sep 2021 11:21:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 073A238618BB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1631100084; bh=6rMTacquuqNl5tIeuyZvoG6X4VMKe1FnjREyqo/CzBU=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=xt11p41GAdAnC+y1+LGN8OllZdlk93WFl3u2MqHOOEZxmxG9Yj6w/hoGrVBSuvziV SIyzjfqZVlGpfOIIGbn5ruJjXTovspe9CsWdxEIo/buJ3kZas5GQb3sg6NOCkyYpLD 5cFJ/s/Xdv2p5Q8HLTzUIJbFdRmASwH1Uxy9X4GY= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 4F61C3858414 for ; Wed, 8 Sep 2021 11:21:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4F61C3858414 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 813F3222A6; Wed, 8 Sep 2021 11:21:01 +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 6095913A73; Wed, 8 Sep 2021 11:21:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id jNXwFZ2cOGG5AgAAGKfGzw (envelope-from ); Wed, 08 Sep 2021 11:21:01 +0000 Date: Wed, 8 Sep 2021 13:20:59 +0200 To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Handle unrecognized command line option in gdb_compile_test Message-ID: <20210908112058.GA15665@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 Cc: Tom Tromey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, When running the gdb testsuite with gnatmake-4.8, I get many fails of the following form: ... gcc: error: unrecognized command line option '-fgnat-encodings=all'^M gnatmake: "gdb.ada/O2_float_param/foo.adb" compilation error^M compiler exited with status 1 compilation failed: gcc ... gdb.ada/O2_float_param/foo.adb gcc: error: unrecognized command line option '-fgnat-encodings=all' gnatmake: "gdb.ada/O2_float_param/foo.adb" compilation error FAIL: gdb.ada/O2_float_param.exp: scenario=all: compilation foo.adb ... Fix this by marking the test unsupported instead, such that we have: ... UNSUPPORTED: gdb.ada/O2_float_param.exp: scenario=all: compilation foo.adb \ (unsupported option '-fgnat-encodings=all') ... Also stop gdb_compile_test from doing pass/fail. The gdb testsuite is meant to test gdb, and a fail is meant to indicate a problem with gdb. A compiler failure means that the test is unsupported. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28318 Any comments? Thanks, - Tom [gdb/testsuite] Handle unrecognized command line option in gdb_compile_test --- gdb/testsuite/lib/gdb.exp | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index ff19760bac4..460b44c2160 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2201,22 +2201,33 @@ proc gdb_interact { } { # Examine the output of compilation to determine whether compilation # failed or not. If it failed determine whether it is due to missing -# compiler or due to compiler error. Report pass, fail or unsupported -# as appropriate +# compiler or due to compiler error. Report unsupported as appropriate. proc gdb_compile_test {src output} { + set msg "compilation [file tail $src]" + if { $output == "" } { - pass "compilation [file tail $src]" - } elseif { [regexp {^[a-zA-Z_0-9]+: Can't find [^ ]+\.$} $output] } { - unsupported "compilation [file tail $src]" - } elseif { [regexp {.*: command not found[\r|\n]*$} $output] } { - unsupported "compilation [file tail $src]" - } elseif { [regexp {.*: [^\r\n]*compiler not installed[^\r\n]*[\r|\n]*$} $output] } { - unsupported "compilation [file tail $src]" - } else { - verbose -log "compilation failed: $output" 2 - fail "compilation [file tail $src]" + return + } + + if { [regexp {^[a-zA-Z_0-9]+: Can't find [^ ]+\.$} $output] + || [regexp {.*: command not found[\r|\n]*$} $output] + || [regexp {.*: [^\r\n]*compiler not installed[^\r\n]*[\r|\n]*$} $output] } { + unsupported "$msg (missing compiler)" + return } + + set gcc_re ".*: error: unrecognized command line option " + set clang_re ".*: error: unsupported option " + if { [regexp "(?:$gcc_re|$clang_re)(\[^ \t;\r\n\]*)" $output dummy option] + && $option != "" } { + unsupported "$msg (unsupported option $option)" + return + } + + # Unclassified compilation failure, be more verbose. + verbose -log "compilation failed: $output" 2 + unsupported "$msg" } # Return a 1 for configurations for which we don't even want to try to