From patchwork Wed Feb 5 09:17:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1233726 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=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-518934-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=AGLBUDMN; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48CGFB6hnpz9s3x for ; Wed, 5 Feb 2020 20:18:06 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:to:references:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=ZDylcG67TQPb9aEZA 28DCXzKD7WMPX1Rn/IiH7AjFue8+XW3OI+4/UmbuOcB1Bi+ZD/d2u+tYequZzMN7 z5/4wbSZKlZ805c369nQOXr49Hb7VB4QNA1Re5KFdyyc1ie8KmkFm7JWlrkpWuzv BYn8waNJ06DBQ6DDKGcpu59NTo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:from:to:references:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=6/4hsTPe9dNx6ZYdctDTjUT S8eY=; b=AGLBUDMNLQV94x7Uvcz1MqWyZJ6FHWpHouo/htw27aC88o2TieTmekF 468XBKgA4KEo24E4VUtZx4K/oq0/K3e9/Ijw90cum/2N8F3L3nT68P24RMEcYtBf eWWHVNJmkQZKCxiO+PrWcQg2aWS863Lwi2B7aqGL1pFOdCwEeBGg= Received: (qmail 3914 invoked by alias); 5 Feb 2020 09:17:54 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 3819 invoked by uid 89); 5 Feb 2020 09:17:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.6 required=5.0 tests=AWL, BAYES_00, GARBLED_SUBJECT, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_PASS autolearn=ham version=3.3.1 spammy=H*f:sk:855cab2, gcsec1c, thoroughly, UD:gcsec-1.c X-HELO: esa3.mentor.iphmx.com Received: from esa3.mentor.iphmx.com (HELO esa3.mentor.iphmx.com) (68.232.137.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Feb 2020 09:17:51 +0000 IronPort-SDR: b7ujfKWibUVbtE0LZQ6jfoisC9wAIyvH6VPyW5mtkl7fYjWhLPX8M9t8LGwVH5dR9Hrtfj57cC D+ipV5m9bWmkFAQGYcJv1XDJ/3LMDKuNvKN1BwwvzojlL0kUphkzlShPPrTpHPH5xeOtlPAJqK iuvjTgvkcyhsUFlgRhpzB1tYEF5HQaXsB1h+Mx4jcouK5H6MeOx44aE8jD6nwoas2kS4sJOJep hOF6el85J6p8pValOqrq0OHfHvgejcOrwXiGG5dgZnDIQqe4ijyyNNyWRYrMLwyEArfqD8Lamo H7w= Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 05 Feb 2020 01:17:49 -0800 IronPort-SDR: r49aY0BDPvExLZzjhA8nd8Hiv9kjVyfwHCUIBCfI+sGm3Bs7zraQms5LUy9NMkXNZgWqSZP+BM xxmwbiR97VrA== Subject: =?utf-8?q?=5BPatch=5D=5BTestsuite=5D_=E2=80=93_More_fixes_for_re?= =?utf-8?q?mote_execution=3A_check=5Fgc=5Fsections=5Favailable=2C_?= =?utf-8?b?4oCm?= From: Tobias Burnus To: gcc-patches , Rainer Orth , Mike Stump , Jakub Jelinek References: <855cab27-5e33-dce0-3560-3b223b7e8b1a@codesourcery.com> Message-ID: Date: Wed, 5 Feb 2020 10:17:43 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <855cab27-5e33-dce0-3560-3b223b7e8b1a@codesourcery.com> X-IsSubscribed: yes Still pending: libgomp-Testsuite patch https://gcc.gnu.org/ml/gcc-patches/2020-02/msg00207.html This is the same fix – but for gcc/testsuite/. To illustrate the problem again. Using remote testing (here: modified target_compile, but DejaGNU's default_target_compile is likewise), and using check_gc_sections_available, I get the following result without the fix: call_remote download -print-prog-name=ld -print-prog-name=ld Invoking the compiler as powerpc64le-none-linux-gnu-gcc … /scratch/…/default/gcc.d/-print-prog-name=ld … UNSUPPORTED: gcc.dg/special/gcsec-1.c Which obvious fails both for uploading the flag as file and for compiling the flag as filename. WITH the patch, I get the expected: Invoking the compiler as powerpc64le-none-linux-gnu-gcc … -fdiagnostics-urls=never -print-prog-name=ld -I . … PASS: gcc.dg/special/gcsec-1.c (test for excess errors) PASS: gcc.dg/special/gcsec-1.c execution test I tested the attached patch for check_gc_sections_available thoroughly – esp. via RUNTESTFLAGS="-v -v -v -v -v special.exp=gcsec-1.c" w/ and w/o remote but also using, intermittently, some debugging "puts". I also fixed check_effective_target_gld, check_effective_target_gas, check_runtime, check_multi_dir, but tested them only lightly. (The first two are unused, the others are only used by mips and arm.) Regarding the '{ }' see below – or in the linked other patch. Without, only one argument is actually passed. OK for the trunk? Tobias On 2/4/20 4:49 PM, Tobias Burnus wrote: > DejaGNU uses in lib/target.exp's >    proc default_target_compile {source destfile type options} > uses the following. > > When running locally, $source is simply used > as argument. However, when run remotely, it is tried to be uploaded > on the remote host – and otherwise skipped. That's fine if the > argument is an actual file – but not if it is a flag. > > Hence, flags should be passed as $options not as $source. > Quoting now from DejaGNU's default_target_compile#: > >     set sources "" >     if {[isremote host]} { >         foreach x $source { >             set file [remote_download host $x] >             if { $file eq "" } { >                 warning "Unable to download $x to host." >                 return "Unable to download $x to host." >             } else { >                 append sources " $file" >             } >         } >     } else { >         set sources $source >     } > >  * * * > > FIRST, I think that affects the following calls, but I have not > checked. — I assume that moving it from the first to the last > argument should work and fix the "isremote" issue. > > gcc/testsuite/gcc.target/arm/multilib.exp:    set gcc_output > [${tool}_target_compile "--print-multi-directory $gcc_opts" "" "none" ""] > gcc/testsuite/lib/target-supports.exp:    set gcc_output > [${tool}_target_compile "-v" "" "none" ""] > gcc/testsuite/lib/target-supports.exp:  set gcc_ld [lindex > [${tool}_target_compile "-print-prog-name=ld" "" "none" ""] 0] > gcc/testsuite/lib/target-supports.exp:  set gcc_as [lindex > [${tool}_target_compile "-print-prog-name=as" "" "none" ""] 0] > gcc/testsuite/lib/target-supports.exp:  set gcc_ld [lindex > [${tool}_target_compile "-print-prog-name=ld" "" "none" ""] 0] > > TODO: One should probably change this. > > > SECONDLY: I hit a very similar issue in libgomp, which I actually did > debug. > > In check_effective_target_offload_target_nvptx, one has something > similar, namely: >   set gcc_output [libgomp_target_compile "-v $options" "" "none" ""] > This currently tries (w/o success) to upload the flags to the remote > host and then > fails as the required "-v" flag fails (i.e. no input). > > However, using "-v" as options argument does not work as seemingly > only additional_flags= > arguments are passed on. Additionally, if one does not only want to > pass on the first > argument, curly braces are needed. > > PATCH: The attached patch does this – and have successfully tested it > both with local > runs and with remote runs. (RUNTESTFLAGS="-v -v -v" did help a lot for > studying the > behavior in both cases.) > > OK for the trunk? > > Cheers, > > Tobias gcc/testsuite/ * gcc.target/arm/multilib.exp (multilib_config): Pass flags to …_target_compile as (additional_flags=) option and not as source filename to make it work with remote execution. * lib/target-supports.exp (check_runtime, check_gc_sections_available, check_effective_target_gas, check_effective_target_gld): Likewise. diff --git a/gcc/testsuite/gcc.target/arm/multilib.exp b/gcc/testsuite/gcc.target/arm/multilib.exp index 67d00266f6b..60b9edeebd0 100644 --- a/gcc/testsuite/gcc.target/arm/multilib.exp +++ b/gcc/testsuite/gcc.target/arm/multilib.exp @@ -40,7 +40,7 @@ proc multilib_config {profile} { proc check_multi_dir { gcc_opts multi_dir } { global tool - set gcc_output [${tool}_target_compile "--print-multi-directory $gcc_opts" "" "none" ""] + set gcc_output [${tool}_target_compile "" "" "none" "{additional_flags=--print-multi-directory $gcc_opts}"] if { [string match "$multi_dir\n" $gcc_output] } { pass "multilibdir $gcc_opts $multi_dir" } else { diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 5377d7b11cb..5a18dbd85ea 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -260,7 +260,7 @@ proc check_runtime {prop args} { proc check_configured_with { pattern } { global tool - set gcc_output [${tool}_target_compile "-v" "" "none" ""] + set gcc_output [${tool}_target_compile "" "" "none" "additional_flags=-v"] if { [ regexp "Configured with: \[^\n\]*$pattern" $gcc_output ] } { verbose "Matched: $pattern" 2 return 1 @@ -504,7 +504,7 @@ proc check_gc_sections_available { } { } # Check if the ld used by gcc supports --gc-sections. - set gcc_ld [lindex [${tool}_target_compile "-print-prog-name=ld" "" "none" ""] 0] + set gcc_ld [lindex [${tool}_target_compile "" "" "none" "additional_flags=-print-prog-name=ld"] 0] set ld_output [remote_exec host "$gcc_ld" "--help"] if { [ string first "--gc-sections" $ld_output ] >= 0 } { return 1 @@ -8566,7 +8566,7 @@ proc check_effective_target_gas { } { if {![info exists use_gas_saved]} { # Check if the as used by gcc is GNU as. - set gcc_as [lindex [${tool}_target_compile "-print-prog-name=as" "" "none" ""] 0] + set gcc_as [lindex [${tool}_target_compile "" "" "none" "additional_flags=-print-prog-name=as"] 0] # Provide /dev/null as input, otherwise gas times out reading from # stdin. set status [remote_exec host "$gcc_as" "-v /dev/null"] @@ -8588,7 +8588,7 @@ proc check_effective_target_gld { } { if {![info exists use_gld_saved]} { # Check if the ld used by gcc is GNU ld. - set gcc_ld [lindex [${tool}_target_compile "-print-prog-name=ld" "" "none" ""] 0] + set gcc_ld [lindex [${tool}_target_compile "" "" "none" "additional_flags=-print-prog-name=ld"] 0] set status [remote_exec host "$gcc_ld" "--version"] set ld_output [lindex $status 1] if { [ string first "GNU" $ld_output ] >= 0 } {