From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id sY2nIJ2+OGFLXQAAWB0awg (envelope-from ) for ; Wed, 08 Sep 2021 09:46:05 -0400 Received: by simark.ca (Postfix, from userid 112) id 740CB1EE22; Wed, 8 Sep 2021 09:46:05 -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.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,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 15D0F1ECEB for ; Wed, 8 Sep 2021 09:46:03 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 38CE43857C74 for ; Wed, 8 Sep 2021 13:46:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38CE43857C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1631108762; bh=pk0r+YzOfuEFh0HS1CA25eF4qLjT7JziFPyuZxvjO5o=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ivdjQ9M/224jpzOHlWEbmVnOycWJUzx52CMeU4A0lapCMjee3b6OeW7nml68R3pCn LlExXeXGOYwu3S0qZfI3BqUCDyomiXy4ema+6LVePbTgjfbGx9VOhfox1o3T/FyWQn 59t/v1HnZkd7npsdz+2URWhRV2Z3w0HO+nlV5sJc= Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 4B79F385842C for ; Wed, 8 Sep 2021 13:45:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4B79F385842C 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 7A6052229A; Wed, 8 Sep 2021 13:45:41 +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 546B013A8B; Wed, 8 Sep 2021 13:45:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id mODuEoW+OGFuKQAAGKfGzw (envelope-from ); Wed, 08 Sep 2021 13:45:41 +0000 Subject: Re: [PATCH][gdb/testsuite] Handle unrecognized command line option in gdb_compile_test To: Joel Brobecker References: <20210908112058.GA15665@delia> <20210908122232.GE9184@adacore.com> Message-ID: Date: Wed, 8 Sep 2021 15:45:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210908122232.GE9184@adacore.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 , gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 9/8/21 2:22 PM, Joel Brobecker wrote: >> 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. > > For the last part, I suggest we remain consistent with what we do when > building programs in other languages. Looking at gdb_compile_test, > we have ... > > } else { > verbose -log "compilation failed: $output" 2 > fail "compilation [file tail $src]" > Right, that's what it says in gdb_compile_test. Using that proc however, is the exception, used only for ada and f77. Becoming consistent with other languages means to change that fail in gdb_compile_test to unsupported. Which is what this patch does. > In my opinion, it's better to generate a FAIL here, because a failure > to compile could come from an error in the testcase, rather than > an unsupported build. > [ To reiterate my earlier point, it's counter-pattern to generate a FAIL for something that's not a problem in the tool-under-test. So much counter-pattern that I had to resist the reflex to commit this as obvious. ] Indeed, there could be an error in the testcase. Also, there could be no error in the test-case. In the former case, having a FAIL instead of UNSUPPORTED could increase the change of noticing this, agreed. In the latter case, having a FAIL instead of UNSUPPORTED when testing an older compiler, is an annoyance which drowns out FAILs that do need attention. So, I'm not saying that noticing test-case errors causing compilation problem is not worthwhile. But I'm saying that turning the compilation errors into FAILs is the wrong solution. Thanks, - Tom >> 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 >