aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2024-08-18 07:01:06 +0200
committerHans-Peter Nilsson <hp@bitrange.com>2024-09-01 02:27:56 +0200
commitf22788c7c01ebb4fefffc1162eb85ffb7a82c314 (patch)
treed6f45984b8a712d8b9b74213d139631f95a1b495
parent49fd9b33bd3d9b3466c8e55fe8d22df970ccf7b0 (diff)
downloadgcc-f22788c7c01ebb4fefffc1162eb85ffb7a82c314.zip
gcc-f22788c7c01ebb4fefffc1162eb85ffb7a82c314.tar.gz
gcc-f22788c7c01ebb4fefffc1162eb85ffb7a82c314.tar.bz2
testsuite: Prune compilation messages for modules tests
All testsuite compiler-calls pass default_target_compile in the dejagnu installation (typically /usr/share/dejagnu/target.exp) which also calls the dejagnu-installed prune_warnings. Normally, tests using the dg framework (most or all tests these days) compile and link by calling various wrappers that end up calling dg-test in the dejagnu installation, typically installed as /usr/share/dejagnu/dg.exp. That, besides the compiler call, also calls ${tool}-dg-prune (g++-dg-prune) on the messages, which in turn ends up calling prune_gcc_output in gcc/testsuite/lib/prune.exp. That gcc-specific "pruning" function handles more cases than the dejagnu prune_warnings, and also has updated patterns. But, module_do_it in modules.exp calls the lower-level ${tool}_target_compile "directly", i.e. g++_target_compile defined in gcc/testsuite/lib/g++.exp. That does not call ${tool}-dg-prune, meaning those test-cases miss the gcc-specific pruning. Noticed while testing a dejagnu update that handled the miniscule "in" in the warning (line-breaks added below besides the original one after "(void*)':") "/path/to/cris-elf/bin/ld: /gccobj/cris-elf/./libstdc++-v3/src/.libs/libstdc++.a(random.o): in function `std::(anonymous namespace)::__libc_getentropy(void*)': /gccsrc/libstdc++-v3/src/c++11/random.cc:183: warning: _getentropy is not implemented and will always fail" The line saying "in function" rather than "In function" (from the binutils linker since 2018) is pruned by prune_gcc_output. The prune_warnings in dejagnu-1.6.3 and earlier handles the second line separately. It's an unfortunate wart that neither consumes the delimiting line-break, leaving to the callers to prune residual empty lines. See prune_warnings in dejagnu (default_target_compile and dg-test) for those other line-break fixups, as alluded in the comment. * g++.dg/modules/modules.exp (module_do_it): Prune compilation messages.
-rw-r--r--gcc/testsuite/g++.dg/modules/modules.exp10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
index 3e8df9b..e6bf28d 100644
--- a/gcc/testsuite/g++.dg/modules/modules.exp
+++ b/gcc/testsuite/g++.dg/modules/modules.exp
@@ -205,9 +205,19 @@ proc module_do_it { do_what testcase std asm_list } {
if { !$ok } {
unresolved "$ident link"
} else {
+ global target_triplet
set out [${tool}_target_compile $asm_list \
$execname executable $options]
eval $xfail
+
+ # Do gcc-specific pruning.
+ set out [${tool}-dg-prune $target_triplet $out]
+ # Fix up remaining line-breaks similar to "regular" pruning
+ # calls. Otherwise, a multi-line message stripped e.g. one
+ # part by the default prune_warnings and one part part by the
+ # gcc prune_gcc_output will have a residual line-break.
+ regsub "^\[\r\n\]+" $out "" out
+
if { $out == "" } {
pass "$ident link"
} else {