testsuite: Fix mistransformed gcov
commite91d51457532da6c2179b23359435f06d89488e7
authorHans-Peter Nilsson <hp@axis.com>
Tue, 15 Nov 2022 20:11:54 +0000 (15 21:11 +0100)
committerHans-Peter Nilsson <hp@bitrange.com>
Wed, 16 Nov 2022 17:19:17 +0000 (16 18:19 +0100)
tree261ba7e78acb6f3158119e5497e62fd578171f67
parent246bbdaa5f536b7a199dda9860c473137f40d622
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.
gcc/testsuite/g++.dg/gcov/gcov.exp
gcc/testsuite/gcc.misc-tests/gcov.exp
gcc/testsuite/lib/gcc-dg.exp