]> git.ipfire.org Git - thirdparty/gcc.git/commit
testsuite: Enable cross testing for gcov tests
authorJoseph Myers <josmyers@redhat.com>
Fri, 23 Jan 2026 21:14:31 +0000 (21:14 +0000)
committerJoseph Myers <josmyers@redhat.com>
Fri, 23 Jan 2026 21:14:31 +0000 (21:14 +0000)
commit39a93faab07ff64a9e828f487f231b013b6cdbdc
treedb0aa1ddd9f9ca509f42eb2143993d6f488fc9b9
parent73a4887ee47ae62c31ced15323fd927150db6294
testsuite: Enable cross testing for gcov tests

Tests of gcov are generally restricted to { target native }.  The
issue for these tests is the need to transfer .gcda files from the
target to the host before running gcov.  Implement that support and
remove the { target native } restrictions for these tests.

Note that by default code built to generate coverage data expects to
be able to write .gcda files to the same directory name in which the
compiler generated its output, so if that path cannot be created by
the tests on the target then they may still not work in a cross setup.
Other options involving -fprofile-dir are possible but involve their
own complications such as mangling of the .gcda file name (the
mangling logic would then need replicating in gcov.exp).  Copying
files from the target using such absolute directory paths is what
already happens with gcc.dg/tree-prof tests using profopt.exp (and
those already work in a cross configuration except for a few using
dg-additional-sources), so this change is effectively making the gcov
tests work more like the tree-prof ones.

Note also that [remote_file host absolute ...] may require appropriate
support in your host board file for the case of a remote host (this
isn't an operation DejaGnu knows about doing remotely by default).
The logic for determining .gcda paths does mean it's the absolute path
on host, not on build, that is relevant.

Tested for x86_64-pc-linux-gnu to make sure native testing isn't
broken, and with cross to aarch64-linux.

* g++.dg/gcov/gcov-1.C, g++.dg/gcov/gcov-10.C,
g++.dg/gcov/gcov-11.C, g++.dg/gcov/gcov-12.C,
g++.dg/gcov/gcov-13.C, g++.dg/gcov/gcov-14.C,
g++.dg/gcov/gcov-15.C, g++.dg/gcov/gcov-16.C,
g++.dg/gcov/gcov-17.C, g++.dg/gcov/gcov-18.C,
g++.dg/gcov/gcov-19.C, g++.dg/gcov/gcov-2.C,
g++.dg/gcov/gcov-20.C, g++.dg/gcov/gcov-21.C,
g++.dg/gcov/gcov-23.C, g++.dg/gcov/gcov-3.C, g++.dg/gcov/gcov-4.C,
g++.dg/gcov/gcov-5.C, g++.dg/gcov/gcov-7.C, g++.dg/gcov/gcov-8.C,
g++.dg/gcov/gcov-dump-1.C, g++.dg/gcov/gcov-dump-2.C,
g++.dg/gcov/gcov-threads-1.C, g++.dg/gcov/loop.C,
g++.dg/gcov/pr16855-priority.C, g++.dg/gcov/pr16855.C,
g++.dg/gcov/pr84548.C, g++.dg/gcov/pr86109.C,
g++.dg/gcov/pr88045.C, g++.dg/gcov/pr88263-2.C,
g++.dg/gcov/pr88263.C, g++.dg/gcov/pr97069.C,
g++.dg/gcov/pr98273.C, g++.dg/gcov/ternary.C,
gcc.misc-tests/gcov-1.c, gcc.misc-tests/gcov-10.c,
gcc.misc-tests/gcov-10b.c, gcc.misc-tests/gcov-11.c,
gcc.misc-tests/gcov-12.c, gcc.misc-tests/gcov-13.c,
gcc.misc-tests/gcov-14.c, gcc.misc-tests/gcov-15.c,
gcc.misc-tests/gcov-16.c, gcc.misc-tests/gcov-17.c,
gcc.misc-tests/gcov-18.c, gcc.misc-tests/gcov-19.c,
gcc.misc-tests/gcov-1a.c, gcc.misc-tests/gcov-2.c,
gcc.misc-tests/gcov-20.c, gcc.misc-tests/gcov-22.c,
gcc.misc-tests/gcov-24.c, gcc.misc-tests/gcov-25.c,
gcc.misc-tests/gcov-26.c, gcc.misc-tests/gcov-27.c,
gcc.misc-tests/gcov-28.c, gcc.misc-tests/gcov-29.c,
gcc.misc-tests/gcov-3.c, gcc.misc-tests/gcov-30.c,
gcc.misc-tests/gcov-33.c, gcc.misc-tests/gcov-34.c,
gcc.misc-tests/gcov-4.c, gcc.misc-tests/gcov-4b.c,
gcc.misc-tests/gcov-5b.c, gcc.misc-tests/gcov-6.c,
gcc.misc-tests/gcov-7.c, gcc.misc-tests/gcov-8.c,
gcc.misc-tests/gcov-9.c, gcc.misc-tests/gcov-pr83813.c,
gcc.misc-tests/gcov-pr84758.c, gcc.misc-tests/gcov-pr85217.c,
gcc.misc-tests/gcov-pr85332.c, gcc.misc-tests/gcov-pr85338.c,
gcc.misc-tests/gcov-pr85350.c, gcc.misc-tests/gcov-pr85372.c,
gcc.misc-tests/gcov-pr86536.c, gcc.misc-tests/gcov-pr90574-1.c,
gcc.misc-tests/gcov-pr90574-2.c, gdc.dg/gcov1.d,
gnat.dg/gcov/check.adb: Do not restrict to { target native }.
* lib/gcov.exp (transfer-gcda): New.
(clean-gcov-file): Delete .gcda file on target.
(run-gcov): Transfer .gcda files from target.
80 files changed:
gcc/testsuite/g++.dg/gcov/gcov-1.C
gcc/testsuite/g++.dg/gcov/gcov-10.C
gcc/testsuite/g++.dg/gcov/gcov-11.C
gcc/testsuite/g++.dg/gcov/gcov-12.C
gcc/testsuite/g++.dg/gcov/gcov-13.C
gcc/testsuite/g++.dg/gcov/gcov-14.C
gcc/testsuite/g++.dg/gcov/gcov-15.C
gcc/testsuite/g++.dg/gcov/gcov-16.C
gcc/testsuite/g++.dg/gcov/gcov-17.C
gcc/testsuite/g++.dg/gcov/gcov-18.C
gcc/testsuite/g++.dg/gcov/gcov-19.C
gcc/testsuite/g++.dg/gcov/gcov-2.C
gcc/testsuite/g++.dg/gcov/gcov-20.C
gcc/testsuite/g++.dg/gcov/gcov-21.C
gcc/testsuite/g++.dg/gcov/gcov-23.C
gcc/testsuite/g++.dg/gcov/gcov-3.C
gcc/testsuite/g++.dg/gcov/gcov-4.C
gcc/testsuite/g++.dg/gcov/gcov-5.C
gcc/testsuite/g++.dg/gcov/gcov-7.C
gcc/testsuite/g++.dg/gcov/gcov-8.C
gcc/testsuite/g++.dg/gcov/gcov-dump-1.C
gcc/testsuite/g++.dg/gcov/gcov-dump-2.C
gcc/testsuite/g++.dg/gcov/gcov-threads-1.C
gcc/testsuite/g++.dg/gcov/loop.C
gcc/testsuite/g++.dg/gcov/pr16855-priority.C
gcc/testsuite/g++.dg/gcov/pr16855.C
gcc/testsuite/g++.dg/gcov/pr84548.C
gcc/testsuite/g++.dg/gcov/pr86109.C
gcc/testsuite/g++.dg/gcov/pr88045.C
gcc/testsuite/g++.dg/gcov/pr88263-2.C
gcc/testsuite/g++.dg/gcov/pr88263.C
gcc/testsuite/g++.dg/gcov/pr97069.C
gcc/testsuite/g++.dg/gcov/pr98273.C
gcc/testsuite/g++.dg/gcov/ternary.C
gcc/testsuite/gcc.misc-tests/gcov-1.c
gcc/testsuite/gcc.misc-tests/gcov-10.c
gcc/testsuite/gcc.misc-tests/gcov-10b.c
gcc/testsuite/gcc.misc-tests/gcov-11.c
gcc/testsuite/gcc.misc-tests/gcov-12.c
gcc/testsuite/gcc.misc-tests/gcov-13.c
gcc/testsuite/gcc.misc-tests/gcov-14.c
gcc/testsuite/gcc.misc-tests/gcov-15.c
gcc/testsuite/gcc.misc-tests/gcov-16.c
gcc/testsuite/gcc.misc-tests/gcov-17.c
gcc/testsuite/gcc.misc-tests/gcov-18.c
gcc/testsuite/gcc.misc-tests/gcov-19.c
gcc/testsuite/gcc.misc-tests/gcov-1a.c
gcc/testsuite/gcc.misc-tests/gcov-2.c
gcc/testsuite/gcc.misc-tests/gcov-20.c
gcc/testsuite/gcc.misc-tests/gcov-22.c
gcc/testsuite/gcc.misc-tests/gcov-24.c
gcc/testsuite/gcc.misc-tests/gcov-25.c
gcc/testsuite/gcc.misc-tests/gcov-26.c
gcc/testsuite/gcc.misc-tests/gcov-27.c
gcc/testsuite/gcc.misc-tests/gcov-28.c
gcc/testsuite/gcc.misc-tests/gcov-29.c
gcc/testsuite/gcc.misc-tests/gcov-3.c
gcc/testsuite/gcc.misc-tests/gcov-30.c
gcc/testsuite/gcc.misc-tests/gcov-33.c
gcc/testsuite/gcc.misc-tests/gcov-34.c
gcc/testsuite/gcc.misc-tests/gcov-4.c
gcc/testsuite/gcc.misc-tests/gcov-4b.c
gcc/testsuite/gcc.misc-tests/gcov-5b.c
gcc/testsuite/gcc.misc-tests/gcov-6.c
gcc/testsuite/gcc.misc-tests/gcov-7.c
gcc/testsuite/gcc.misc-tests/gcov-8.c
gcc/testsuite/gcc.misc-tests/gcov-9.c
gcc/testsuite/gcc.misc-tests/gcov-pr83813.c
gcc/testsuite/gcc.misc-tests/gcov-pr84758.c
gcc/testsuite/gcc.misc-tests/gcov-pr85217.c
gcc/testsuite/gcc.misc-tests/gcov-pr85332.c
gcc/testsuite/gcc.misc-tests/gcov-pr85338.c
gcc/testsuite/gcc.misc-tests/gcov-pr85350.c
gcc/testsuite/gcc.misc-tests/gcov-pr85372.c
gcc/testsuite/gcc.misc-tests/gcov-pr86536.c
gcc/testsuite/gcc.misc-tests/gcov-pr90574-1.c
gcc/testsuite/gcc.misc-tests/gcov-pr90574-2.c
gcc/testsuite/gdc.dg/gcov1.d
gcc/testsuite/gnat.dg/gcov/check.adb
gcc/testsuite/lib/gcov.exp