From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 3ii0FBirOGFbWQAAWB0awg (envelope-from ) for ; Wed, 08 Sep 2021 08:22:48 -0400 Received: by simark.ca (Postfix, from userid 112) id 42C381EE22; Wed, 8 Sep 2021 08:22:48 -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.4 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 0B6BE1ECEB for ; Wed, 8 Sep 2021 08:22:47 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7317E385803B for ; Wed, 8 Sep 2021 12:22:46 +0000 (GMT) Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by sourceware.org (Postfix) with ESMTPS id E5E343858414 for ; Wed, 8 Sep 2021 12:22:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E5E343858414 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-pj1-x102f.google.com with SMTP id c6so1547387pjv.1 for ; Wed, 08 Sep 2021 05:22:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=12jBcgl+mc99sU83znvPzsts+bHHXIb5vmHdGBjLhg8=; b=WVX63PNS5OilGOgJ8oCO22It9J7nh0EZnmTq5TIrxbDbQtSpH2rBa766HxIA+GixJB yu/XcbffCizDY9ZAeEVUrTAechl4UPl+XFvSfMYXlcE/5zVsPqy1PCAFKZBImL082htU PRdjrFnBtljRbnHwKBwK10Z2W0cNZOEYS3sibNaa0Vjt5oxQB16u7gdO+453JASLV35f L8uQ6ZAbv0wGF69PTUQOqgMxy72fa5noaaKGuDe0n131qy8gnag1cLLtWvTD3kZuYMNP SJCgYMwLYKXc49wQQ4umOdPVsDaZnN629FNjVdMGh54h+g5rIhFpfsZB8DjNf7j57HNR brag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=12jBcgl+mc99sU83znvPzsts+bHHXIb5vmHdGBjLhg8=; b=ftoc5CrT4jbw+KKyC8OBtoeO6xl5PROJi3MSgQiRBCRUl5eXg9aLYtrsA0rkeEX52S dJTFw8svLScePKK/98POSOf+lZowWyyRKwPfrG0BDHjl+o2vAkJ2xmSWly8BRtve3EdW CzDZFAROiaxfzxTTktnkK7pRQt7G992qZc8+20LkXbIzlXa7x0Vd7TWaHlVqL76NENUZ mdM9n5sF4yxLbvNjqzqvRfdzntCEbFhV86OrTAnB7AYMS1RYGm32PpD+WSqrXG1yzDHJ awvxojXl67ZTCz1yD7HIZGkNAekrVoJKv9GgAqPDjOeRDI9g7ycI0lv06lfyHBdipYAk TU/Q== X-Gm-Message-State: AOAM533XmBS34h/bf6MaGBH0hsGcMtuTdpUPGaNjuTJI7VLasiSmMH0H IIws601OwPyBgrgMWLygkK6WIacUoPgv X-Google-Smtp-Source: ABdhPJxQDe6eDUzkwvj150VkNDMVeZgqQI5fKK7l9j8CSky/HGJPY/wUIsbrR1lzCKL7JNfpQ/5uHw== X-Received: by 2002:a17:90a:a087:: with SMTP id r7mr3987271pjp.84.1631103753914; Wed, 08 Sep 2021 05:22:33 -0700 (PDT) Received: from takamaka.home ([184.69.131.86]) by smtp.gmail.com with ESMTPSA id q21sm2680918pgk.71.2021.09.08.05.22.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Sep 2021 05:22:33 -0700 (PDT) Received: by takamaka.home (Postfix, from userid 1000) id 465948340E; Wed, 8 Sep 2021 05:22:32 -0700 (PDT) Date: Wed, 8 Sep 2021 05:22:32 -0700 From: Joel Brobecker To: Tom de Vries Subject: Re: [PATCH][gdb/testsuite] Handle unrecognized command line option in gdb_compile_test Message-ID: <20210908122232.GE9184@adacore.com> References: <20210908112058.GA15665@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210908112058.GA15665@delia> 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: , Cc: Tom Tromey , Joel Brobecker , gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" > 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]" 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. > 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 -- Joel