diff options
author | Christophe Lyon <christophe.lyon@linaro.org> | 2025-04-01 16:22:10 +0000 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@linaro.org> | 2025-04-22 10:13:51 +0000 |
commit | dd3dfa3790f22bfcee20d869aefea5886f94346b (patch) | |
tree | 517640b1675b2051264b89a772390cc32937bbdc | |
parent | b7fb18dcf79476aa30ed2ad6cc2eaeab1f266107 (diff) | |
download | gcc-dd3dfa3790f22bfcee20d869aefea5886f94346b.zip gcc-dd3dfa3790f22bfcee20d869aefea5886f94346b.tar.gz gcc-dd3dfa3790f22bfcee20d869aefea5886f94346b.tar.bz2 |
testsuite: Add support for GCOV_UNDER_TEST
After commit r15-8947-g8ed2d5d219e999, which added new tests using
gcov, the CI noticed failures because it was calling 'gcov' instead of
$target-gcov.
This is because the CI scripts override GXX_UNDER_TEST, but still run
the testsuite in-tree, and gcc-transform-out-of-tree only depends on
TESTING_IN_BUILD_TREE but the definition of GCOV uses GCC_UNDER_TEST,
GXX_UNDER_TEST or GDC_UNDER_TEST (assuming their default values when
TESTING_IN_BUILD_TREE).
To handle such a case, this patch adds support for a new variable,
GCOV_UNDER_TEST, which overrides the current behavior if defined, and
has an effect similar to overriding GCC_UNDER_TEST etc...
Unfortunately, the change needs to be duplicated in several places,
which use either GCC_UNDER_TEST, GXX_UNDER_TEST or GDC_UNDER_TEST.
Tested g++.dg/gcov/gcov.exp and now g++.dg/gcov/gcov-22.C passes
(calling <installdir>/bin/$target-gcov as instructed by the CI
scripts). No change observed on gcc.misc-tests/gcov.exp, and I could
not test gdc.dg/gcov.exp and gnat.dg/gcov/gcov.exp.
gcc/testsuite/ChangeLog:
* g++.dg/gcov/gcov.exp: Handle GCOV_UNDER_TEST.
* gcc.misc-tests/gcov.exp: Likewise.
* gdc.dg/gcov.exp: Likewise.
* gnat.dg/gcov/gcov.exp: Likewise.
-rw-r--r-- | gcc/testsuite/g++.dg/gcov/gcov.exp | 15 | ||||
-rw-r--r-- | gcc/testsuite/gcc.misc-tests/gcov.exp | 15 | ||||
-rw-r--r-- | gcc/testsuite/gdc.dg/gcov.exp | 15 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/gcov/gcov.exp | 15 |
4 files changed, 44 insertions, 16 deletions
diff --git a/gcc/testsuite/g++.dg/gcov/gcov.exp b/gcc/testsuite/g++.dg/gcov/gcov.exp index 50f60c4..04c7c95 100644 --- a/gcc/testsuite/g++.dg/gcov/gcov.exp +++ b/gcc/testsuite/g++.dg/gcov/gcov.exp @@ -21,12 +21,19 @@ load_lib g++-dg.exp load_lib gcov.exp global GXX_UNDER_TEST +global GCOV_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]]/[gcc-transform-out-of-tree gcov] +# Find gcov in the same directory as $GXX_UNDER_TEST, unless +# GCOV_UNDER_TEST is defined. + +if ![info exists GCOV_UNDER_TEST] { + if { ![is_remote host] && [string match "*/*" [lindex $GXX_UNDER_TEST 0]] } { + set GCOV [file dirname [lindex $GXX_UNDER_TEST 0]]/[gcc-transform-out-of-tree gcov] + } else { + set GCOV [gcc-transform-out-of-tree gcov] + } } else { - set GCOV [gcc-transform-out-of-tree gcov] + set GCOV $GCOV_UNDER_TEST } # Initialize harness. diff --git a/gcc/testsuite/gcc.misc-tests/gcov.exp b/gcc/testsuite/gcc.misc-tests/gcov.exp index c8f20e1..4d427c8 100644 --- a/gcc/testsuite/gcc.misc-tests/gcov.exp +++ b/gcc/testsuite/gcc.misc-tests/gcov.exp @@ -21,12 +21,19 @@ load_lib gcc-dg.exp load_lib gcov.exp global GCC_UNDER_TEST +global GCOV_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]]/[gcc-transform-out-of-tree gcov] +# For now find gcov in the same directory as $GCC_UNDER_TEST, unless +# GCOV_UNDER_TEST is defined. + +if ![info exists GCOV_UNDER_TEST] { + if { ![is_remote host] && [string match "*/*" [lindex $GCC_UNDER_TEST 0]] } { + set GCOV [file dirname [lindex $GCC_UNDER_TEST 0]]/[gcc-transform-out-of-tree gcov] + } else { + set GCOV [gcc-transform-out-of-tree gcov] + } } else { - set GCOV [gcc-transform-out-of-tree gcov] + set GCOV $GCOV_UNDER_TEST } # Initialize harness. diff --git a/gcc/testsuite/gdc.dg/gcov.exp b/gcc/testsuite/gdc.dg/gcov.exp index a65d000..3f0234e 100644 --- a/gcc/testsuite/gdc.dg/gcov.exp +++ b/gcc/testsuite/gdc.dg/gcov.exp @@ -21,12 +21,19 @@ load_lib gdc-dg.exp load_lib gcov.exp global GDC_UNDER_TEST +global GCOV_UNDER_TEST -# For now find gcov in the same directory as $GDC_UNDER_TEST. -if { ![is_remote host] && [string match "*/*" [lindex $GDC_UNDER_TEST 0]] } { - set GCOV [file dirname [lindex $GDC_UNDER_TEST 0]]/[gcc-transform-out-of-tree gcov] +# For now find gcov in the same directory as $GDC_UNDER_TEST, unless +# GCOV_UNDER_TEST is defined. + +if ![info exists GCOV_UNDER_TEST] { + if { ![is_remote host] && [string match "*/*" [lindex $GDC_UNDER_TEST 0]] } { + set GCOV [file dirname [lindex $GDC_UNDER_TEST 0]]/[gcc-transform-out-of-tree gcov] + } else { + set GCOV [gcc-transform-out-of-tree gcov] + } } else { - set GCOV [gcc-transform-out-of-tree gcov] + set GCOV $GCOV_UNDER_TEST } # Initialize harness. diff --git a/gcc/testsuite/gnat.dg/gcov/gcov.exp b/gcc/testsuite/gnat.dg/gcov/gcov.exp index 4fa887d..031914a 100644 --- a/gcc/testsuite/gnat.dg/gcov/gcov.exp +++ b/gcc/testsuite/gnat.dg/gcov/gcov.exp @@ -21,12 +21,19 @@ load_lib gnat-dg.exp load_lib gcov.exp global GCC_UNDER_TEST +global GCOV_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]]/gcov +# For now find gcov in the same directory as $GCC_UNDER_TEST, unless +# GCOV_UNDER_TEST is defined. + +if ![info exists GCOV_UNDER_TEST] { + if { ![is_remote host] && [string match "*/*" [lindex $GCC_UNDER_TEST 0]] } { + set GCOV [file dirname [lindex $GCC_UNDER_TEST 0]]/gcov + } else { + set GCOV gcov + } } else { - set GCOV gcov + set GCOV $GCOV_UNDER_TEST } # Initialize harness. |