From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2152) id 7BD2F395BC63; Wed, 16 Nov 2022 17:19:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BD2F395BC63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668619197; bh=0SBV5AKcYxh7hFG++WyZMsPfpU/Gqk7DWMqH4BUDp/k=; h=From:To:Subject:Date:From; b=yc/H1tNTxLmXl3gHn7dy3eNigKcAa2tbAuRllYW4SQGrLzs+A/2EiWmQhPZE0SPgi cjbOzpZ3gLMGD7EDGExwx2VFnIPMfMa/bMTZ9G+QJ5BjC+zRlmAdxOpafA5C+do2S0 +RkRbFUMLRTZw2JNvFVvY2QgoNvjV7QTWoEPcgr4= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Hans-Peter Nilsson To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4103] testsuite: Fix mistransformed gcov X-Act-Checkin: gcc X-Git-Author: Hans-Peter Nilsson X-Git-Refname: refs/heads/master X-Git-Oldrev: 246bbdaa5f536b7a199dda9860c473137f40d622 X-Git-Newrev: e91d51457532da6c2179b23359435f06d89488e7 Message-Id: <20221116171957.7BD2F395BC63@sourceware.org> Date: Wed, 16 Nov 2022 17:19:57 +0000 (GMT) List-Id: https://gcc.gnu.org/g:e91d51457532da6c2179b23359435f06d89488e7 commit r13-4103-ge91d51457532da6c2179b23359435f06d89488e7 Author: Hans-Peter Nilsson Date: Tue Nov 15 21:11:54 2022 +0100 testsuite: Fix mistransformed gcov In commit r13-2619-g34b9a03353d3fd, [transform] was applied to all invocations of gcov, for both out-of-tree and in-tree testing. For in-tree cross builds, this means gcov was called as "/path/to/gccobj/gcc/target-tuple-gcov" gcov-pr94029.c which is incorrect, as it's there "/path/to/gccobj/gcc/gcov" until it's installed. This caused a testsuite failure, like: Running /x/gcc/gcc/testsuite/gcc.misc-tests/gcov.exp ... FAIL: gcc.misc-tests/gcov-pr94029.c gcov failed: spawn failed To avoid cumbersome conditionals, use a dedicated new helper function. gcc/testsuite: * lib/gcc-dg.exp (gcc-transform-out-of-tree): New proc. * g++.dg/gcov/gcov.exp, gcc.misc-tests/gcov.exp: Call gcc-transform-out-of-tree instead of transform. Diff: --- gcc/testsuite/g++.dg/gcov/gcov.exp | 4 ++-- gcc/testsuite/gcc.misc-tests/gcov.exp | 4 ++-- gcc/testsuite/lib/gcc-dg.exp | 13 +++++++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gcc/testsuite/g++.dg/gcov/gcov.exp b/gcc/testsuite/g++.dg/gcov/gcov.exp index 04e7a016486..def827de3c7 100644 --- a/gcc/testsuite/g++.dg/gcov/gcov.exp +++ b/gcc/testsuite/g++.dg/gcov/gcov.exp @@ -24,9 +24,9 @@ global GXX_UNDER_TEST # Find gcov in the same directory as $GXX_UNDER_TEST. if { ![is_remote host] && [string match "*/*" [lindex $GXX_UNDER_TEST 0]] } { - set GCOV [file dirname [lindex $GXX_UNDER_TEST 0]]/[transform gcov] + set GCOV [file dirname [lindex $GXX_UNDER_TEST 0]]/[gcc-transform-out-of-tree gcov] } else { - set GCOV [transform gcov] + set GCOV [gcc-transform-out-of-tree gcov] } # Initialize harness. diff --git a/gcc/testsuite/gcc.misc-tests/gcov.exp b/gcc/testsuite/gcc.misc-tests/gcov.exp index b8e9661aa53..bc8e2c9958b 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov.exp +++ b/gcc/testsuite/gcc.misc-tests/gcov.exp @@ -24,9 +24,9 @@ global GCC_UNDER_TEST # For now find gcov in the same directory as $GCC_UNDER_TEST. if { ![is_remote host] && [string match "*/*" [lindex $GCC_UNDER_TEST 0]] } { - set GCOV [file dirname [lindex $GCC_UNDER_TEST 0]]/[transform gcov] + set GCOV [file dirname [lindex $GCC_UNDER_TEST 0]]/[gcc-transform-out-of-tree gcov] } else { - set GCOV [transform gcov] + set GCOV [gcc-transform-out-of-tree gcov] } # Initialize harness. diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 23ec038f41e..0129b113630 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -1429,5 +1429,18 @@ proc scan-symbol-not { args } { } } +# Transform a tool-name to its canonical-target-name by "transform" +# (which may return the original name for native targets) but only if +# testing out-of-tree. When in-tree, the tool is expected to be found +# by its original name, typically with some build-directory prefix +# prepended by the caller. +proc gcc-transform-out-of-tree { args } { + global TESTING_IN_BUILD_TREE + if { [info exists TESTING_IN_BUILD_TREE] } { + return $args; + } + return [transform $args] +} + set additional_prunes "" set dg_runtest_extra_prunes ""