From patchwork Tue Jun 21 05:44:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1645843 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=Bk+mcksF; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LRwTX4K3lz9sGD for ; Tue, 21 Jun 2022 15:45:20 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D457F387085B for ; Tue, 21 Jun 2022 05:45:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D457F387085B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1655790317; bh=s12KC9vX40T1MuKxJ8ETqiTkCAa6sHGERq0UV8uKIOo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Bk+mcksFhNG1uFvJsIcmna+H5UjRqjbCZ9Nwuh77Es85QSOHAxhL/V0g5r2Uko5A9 RHpRilelRuImtNKgdju9D/kkyL8+cavDhUROdKr7CkwDz+a6tXke6I8VxghyvhdNcx 8LHMVxKynG2Vq5cVbii3bUP+wpGRcE0HU27xSCug= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rock.gnat.com (rock.gnat.com [205.232.38.15]) by sourceware.org (Postfix) with ESMTPS id BE9ED384144C for ; Tue, 21 Jun 2022 05:44:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BE9ED384144C Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 737431160D9; Tue, 21 Jun 2022 01:44:57 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ezcXXOXGIPcy; Tue, 21 Jun 2022 01:44:57 -0400 (EDT) Received: from free.home (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id 110C21160D8; Tue, 21 Jun 2022 01:44:56 -0400 (EDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 25L5iQ7g693002 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Jun 2022 02:44:27 -0300 To: gcc-patches@gcc.gnu.org Subject: [PATCH] testsuite: outputs.exp: test for skip_atsave more thoroughly Organization: Free thinker, does not speak for AdaCore Date: Tue, 21 Jun 2022 02:44:26 -0300 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Alexandre Oliva via Gcc-patches From: Alexandre Oliva Reply-To: Alexandre Oliva Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" The presence of -I or -L flags in link command lines changes the driver's, and thus the linker's behavior, WRT naming files with command-line options. With such flags, the driver creates .args.0 and .args.1 files, whereas without them it's the linker (collect2, really) that creates .ld1_args. I've hit some fails on a target system that doesn't have -I or -L flags in the board config file, but it does add some of them implicitly with configured-in driver self specs. Alas, the test in outputs.exp doesn't catch that, so we proceed to run rather than skip_atsave tests. I've reworked the outest procedure to allow dry runs and to return would-have-been pass/fail results as lists, so we can now test whether certain files are created and use that to configure the actual test runs. Regstrapped on x86_64-linux-gnu, also tested with a cross to aarch64-rtems6. Ok to install? for gcc/testsuite/ChangeLog * gcc.misc-tests/outputs.exp (outest): Introduce quiet mode, create and return lists of passes and fails. Use it to catch skip_atsave cases where -L flags are implicitly added by driver self specs. --- gcc/testsuite/gcc.misc-tests/outputs.exp | 49 ++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/gcc.misc-tests/outputs.exp b/gcc/testsuite/gcc.misc-tests/outputs.exp index afae735e92d76..a63ce66693b97 100644 --- a/gcc/testsuite/gcc.misc-tests/outputs.exp +++ b/gcc/testsuite/gcc.misc-tests/outputs.exp @@ -116,8 +116,23 @@ if [info exists env(MAKEFLAGS)] { # it weren't for # https://core.tcl-lang.org/tcl/tktview?name=5bbd044812), but .{i,s,o} # and .[iso] will pass even if only the .o is present. + +# Return a list containing two lists, the first naming the passes, the +# second naming the fails. If test ends with a question mark, the +# test is taken as a preparatory test or cleanup, and no pass or fail +# results will be logged, though the lists will still be built and +# returned. array unset outests * proc outest { test sources opts dirs outputs } { + if { [string index $test end] == "?" } { + set quiet 1 + } else { + set quiet 0 + } + + set passes {} + set fails {} + global b srcdir subdir global outests @@ -182,15 +197,15 @@ proc outest { test sources opts dirs outputs } { set o "$og" } if { [file exists $d$o] } then { - pass "$test: $d$o" + lappend passes "$d$o" file delete $d$o } else { set ogl [glob -nocomplain -path $d -- $o] if { $ogl != {} } { - pass "$test: $d$o" + lappend passes "$d$o" file delete $ogl } else { - fail "$test: $d$o" + lappend fails "$d$o" } } } @@ -219,17 +234,27 @@ proc outest { test sources opts dirs outputs } { } if { [llength $outb] == 0 } then { - pass "$test: extra" + lappend passes "extra" } else { - fail "$test: extra\n$outb" + lappend fails "extra\n$outb" } if { [string equal "$gcc_output" ""] } then { - pass "$test: std out" + lappend passes "std out" } else { - fail "$test: std out\n$gcc_output" + lappend fails "std out\n$gcc_output" } + if !$quiet { + foreach p $passes { + pass "$test: $p" + } + foreach f $fails { + fail "$test: $f" + } + } + + return [list $passes $fails] } set sing {-0.c} @@ -279,6 +304,16 @@ if { "$aout" != "" } then { set oaout "-o $aout" } +# Sometimes the -I or -L flags that cause the compiler driver to save +# .args.[01], instead of leaving it for the linker to save .ld1_args, +# is hiding in driver self specs. +if !$skip_atsave { + set atsave_test_out [outest "$b-skip-atsave?" $sing "@/dev/null -o $b.exe -save-temps" {} {{.args.1}}] + if { [lindex [lindex $atsave_test_out 0] 0] == "$b.args.1" } { + set skip_atsave 1 + } +} + # Driver-chosen outputs. outest "$b-1 asm default 1" $sing "-S" {} {{-0.s}} outest "$b-2 asm default 2" $mult "-S" {} {{-1.s -2.s}}