]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: Fix mistransformed gcov
authorHans-Peter Nilsson <hp@axis.com>
Tue, 15 Nov 2022 20:11:54 +0000 (21:11 +0100)
committerHans-Peter Nilsson <hp@bitrange.com>
Wed, 16 Nov 2022 17:19:17 +0000 (18:19 +0100)
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

index 04e7a01648655e01a9fcafa87474ca086f6e4429..def827de3c74402afaada45ec20cbd712a0d61ee 100644 (file)
@@ -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.
index b8e9661aa537c2c10667d4380e40040564543095..bc8e2c9958bf6c85c737eba2fe3ff519823b2bee 100644 (file)
@@ -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.
index 23ec038f41eb9443c25ad6c14cb3aa69fc8dfcd7..0129b1136300cdcd238cb48153161692408d9691 100644 (file)
@@ -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 ""