Hi, [I've CC'd the gcc ML.]
When a test fails with 'excess errors', there's often only one actual error (an excess "(error|warning|note):") and it'd be nice to not have to dig in the .log files to fish that out. Trying the naive... --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -330,6 +330,14 @@ proc gcc-dg-test-1 { target_compile prog do_what extra_tool_flags } { xpass "$name (internal compiler error)" } + # If we have just one '(error|warning|sorry):' line, inline it rather + # than showing 'excess errors'. + set inline_output_r [regexp -all -line -- "(error|warning|sorry):.*" $comp_output inline_output] + if { $inline_output_r == 1 } then { + upvar 2 name name + fail "$name ($inline_output)" + } ... unfortunately isn't enough for many cases (for the same reason), because on the GCC side, we have many testcases with e.g. /* { dg-warning "foo" "" { *-*-* } */ to XFAIL on various targets, and gcc-dg-test-1 is run AFAICT before all such XFAIL markers and so on are processed. As far as I can see, there's no appropriate hook or place where we can do something like the above where XFAILs are taken into account. Do we need a new hook on the DejaGnu side in dg-test which gets called around: # Don't do this if we're testing an interpreter. # FIXME: why? if { ${dg-interpreter-batch-mode} == 0 } { # Catch excess errors (new bugs or incomplete testcases). if {${dg-excess-errors-flag}} { setup_xfail "*-*-*" } if {$comp_output ne ""} { fail "$name (test for excess errors)" send_log "Excess errors:\n$comp_output\n" } else { pass "$name (test for excess errors)" } } or is there a way of achieving this that I'm missing? On the GCC side, I've filed https://gcc.gnu.org/PR121701 for this. thanks, sam