public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: Prune compilation messages for modules tests
@ 2024-08-18 22:28 Hans-Peter Nilsson
  2024-08-26 23:29 ` Ping: " Hans-Peter Nilsson
  2024-08-31 21:41 ` Mike Stump
  0 siblings, 2 replies; 3+ messages in thread
From: Hans-Peter Nilsson @ 2024-08-18 22:28 UTC (permalink / raw)
  To: gcc-patches

As noticed when verifying the dejagnu fix.  Tested cris-elf
with a new newlib that arranges to emit the mentioned
warning, with/without the update in dejagnu to handle the
miniscule "in".  Ok to commit?

-- >8 --
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.
---
 gcc/testsuite/g++.dg/modules/modules.exp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
index 3e8df9b89309..e6bf28d8b1a0 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 {
-- 
2.30.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Ping: [PATCH] testsuite: Prune compilation messages for modules tests
  2024-08-18 22:28 [PATCH] testsuite: Prune compilation messages for modules tests Hans-Peter Nilsson
@ 2024-08-26 23:29 ` Hans-Peter Nilsson
  2024-08-31 21:41 ` Mike Stump
  1 sibling, 0 replies; 3+ messages in thread
From: Hans-Peter Nilsson @ 2024-08-26 23:29 UTC (permalink / raw)
  To: gcc-patches

Ping...

> From: Hans-Peter Nilsson <hp@axis.com>
> Date: Mon, 19 Aug 2024 00:28:30 +0200
> 
> As noticed when verifying the dejagnu fix.  Tested cris-elf
> with a new newlib that arranges to emit the mentioned
> warning, with/without the update in dejagnu to handle the
> miniscule "in".  Ok to commit?
> 
> -- >8 --
> 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.
> ---
>  gcc/testsuite/g++.dg/modules/modules.exp | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/gcc/testsuite/g++.dg/modules/modules.exp b/gcc/testsuite/g++.dg/modules/modules.exp
> index 3e8df9b89309..e6bf28d8b1a0 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 {
> -- 
> 2.30.2
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] testsuite: Prune compilation messages for modules tests
  2024-08-18 22:28 [PATCH] testsuite: Prune compilation messages for modules tests Hans-Peter Nilsson
  2024-08-26 23:29 ` Ping: " Hans-Peter Nilsson
@ 2024-08-31 21:41 ` Mike Stump
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Stump @ 2024-08-31 21:41 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: gcc-patches

On Aug 18, 2024, at 3:28 PM, Hans-Peter Nilsson <hp@axis.com> wrote:
> 
> As noticed when verifying the dejagnu fix.  Tested cris-elf
> with a new newlib that arranges to emit the mentioned
> warning, with/without the update in dejagnu to handle the
> miniscule "in".  Ok to commit?

Ok.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-31 21:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-18 22:28 [PATCH] testsuite: Prune compilation messages for modules tests Hans-Peter Nilsson
2024-08-26 23:29 ` Ping: " Hans-Peter Nilsson
2024-08-31 21:41 ` Mike Stump

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).