From patchwork Thu Feb 25 05:11:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Peter Nilsson X-Patchwork-Id: 1444148 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: 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=LX8cMji1; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DmLVs4xKdz9sBJ for ; Thu, 25 Feb 2021 16:11:47 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A5444385781F; Thu, 25 Feb 2021 05:11:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A5444385781F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1614229904; bh=UQvBoj88xehyXAhSOzW6/ljl4oR3fxop2X6mZL8R6x0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=LX8cMji1Mip3qD1Bc/zySQApEk1XE4Ws/6upoYq6Yi3JgXgwiU3xr53KKv7gUkpOA 964Br0o/igBur7p6dB/oT9LqkuF+EEhEOE0fe+FL3x1NTK/ukDChDTsw4xw8krWq4s KhYfK3YLXUDjDlORIzS0Ikhxr25Vd7TDnxnEBhAU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by sourceware.org (Postfix) with ESMTPS id B9BCC3857805 for ; Thu, 25 Feb 2021 05:11:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B9BCC3857805 To: , Subject: [PATCH] outputs.exp: skip @file -save-temps if target has -L or -I MIME-Version: 1.0 Message-ID: <20210225051139.69B62203B3@pchp3.se.axis.com> Date: Thu, 25 Feb 2021 06:11:39 +0100 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Hans-Peter Nilsson via Gcc-patches From: Hans-Peter Nilsson Reply-To: Hans-Peter Nilsson Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" The outputs.exp tests check what temporary files are created and left behind with e.g. -save-temps. Additional files are created in presence of @file option. Adding an -I or -L option causes *another* temporary file to appear. I take it that's deliberate, as there are tests for that behavior. For native testing, the default test-framework baseboard file unix.exp doesn't add any -I or -L options and all tests pass. For a newlib target however, you'll have a couple of -L options (see the nopts handling in outputs.exp), leading to (cris-elf with --target_board=cris-sim): Running /x/gcc/gcc/testsuite/gcc.misc-tests/outputs.exp ... FAIL: outputs exe savetmp namedb: extra outputs.args.1 FAIL: outputs exe savetmp named2: extra outputs.args.1 FAIL: outputs exe savetmp named2: extra outputs.args.3 FAIL: outputs lto sing unnamed: extra a.args.1 The failing tests are among the actual tests that check the behavior of @file, and are confused by the additional -L. Identify presence of -I or -L from the test framework and skip those tests. Tested cris-elf and x86_64-pc-linux-gnu. Ok to commit? gcc/testsuite: * gcc.misc-tests/outputs.exp: Skip @file -save-temps tests if target test-framework has -L or -I options. --- gcc/testsuite/gcc.misc-tests/outputs.exp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gcc/testsuite/gcc.misc-tests/outputs.exp b/gcc/testsuite/gcc.misc-tests/outputs.exp index 4d904bde31d5..ebd61448bfdd 100644 --- a/gcc/testsuite/gcc.misc-tests/outputs.exp +++ b/gcc/testsuite/gcc.misc-tests/outputs.exp @@ -57,10 +57,18 @@ set gld [check_effective_target_gld] # We do not compile to an executable, because that requires naming an output. set link_options "" set dest [target_info name] +set skip_atsave 0 foreach i { ldflags libs ldscript } { if {[board_info $dest exists $i]} { set opts [board_info $dest $i] set nopts [gcc_adjust_linker_flags_list $opts] + + # Options -I and -L affect the behavior of @files + # wrt. temporary files. Skip @file -save-temps tests if we + # have any of them in the board-flags. + if { [string match "* -\[LI\]*" " $nopts"]} { + set skip_atsave 1 + } foreach opt $nopts { append link_options " additional_flags=$opt" } @@ -298,10 +306,12 @@ outest "$b exe savetmp namedb" $sing "-o $b.exe -save-temps" {} {{--0.i --0.s -- outest "$b exe savetmp named2" $mult "-o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .exe}} # Additional files are created when an @file is used +if !$skip_atsave { outest "$b exe savetmp namedb" $sing "@/dev/null -o $b.exe -save-temps" {} {{--0.i --0.s --0.o .args.0 !!$gld .ld1_args !0 .exe}} outest "$b exe savetmp named2" $mult "@/dev/null -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o .args.0 !!$gld .ld1_args !0 .exe}} outest "$b exe savetmp named2" $mult "@/dev/null -I dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 !!$gld .ld1_args !0 .exe}} outest "$b exe savetmp named2" $mult "@/dev/null -I dummy -L dummy -o $b.exe -save-temps" {} {{--1.i --1.s --1.o --2.i --2.s --2.o -args.0 -args.1 .args.2 .args.3 !!$gld .ld1_args !0 .exe}} +} # Setting the main output to a dir selects it as the default aux&dump # location. @@ -657,8 +667,10 @@ outest "$b lto sing named" $sing "-o $b.exe -O2 -flto -fno-use-linker-plugin -fl outest "$b lto mult named" $mult "-o $b.exe -O2 -flto -fno-use-linker-plugin -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {} {{--1.c.???i.icf --1.c.???r.final --2.c.???i.icf --2.c.???r.final .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe}} outest "$b lto sing nameddir" $sing "-o dir/$b.exe -O2 -flto -fno-use-linker-plugin -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--0.c.???i.icf --0.c.???r.final .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe} {}} outest "$b lto mult nameddir" $mult "-o dir/$b.exe -O2 -flto -fno-use-linker-plugin -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage" {dir/} {{--1.c.???i.icf --1.c.???r.final --2.c.???i.icf --2.c.???r.final .wpa.???i.icf .ltrans0.ltrans.???r.final .ltrans0.ltrans.su .exe} {}} +if !$skip_atsave { outest "$b lto sing unnamed" $sing "@/dev/null -O2 -flto -fno-use-linker-plugin -flto-partition=one -fdump-ipa-icf-optimized -fdump-rtl-final -fstack-usage -save-temps $oaout" {} {{a--0.c.???i.icf a--0.c.???r.final a.wpa.???i.icf a.ltrans0.ltrans.???r.final a.ltrans0.ltrans.su a--0.o a--0.s a--0.i a.ltrans0.o a.ltrans.out a.ltrans0.ltrans.o a.ltrans0.ltrans_args a.args.0 a.ltrans0.ltrans.s a.wpa.args.0 a.lto_args a.ld1_args a.ltrans_args a.ltrans0.ltrans.args.0 a.ld_args $aout}} } +} # -dumpbase without -dumpdir. The trailing dumppfx dash after it is # combined with dumpbase turns into a period when passed to lto as