Bug 30612 (duplicated) - Testsuite cannot detect duplicated error/warning messages
Summary: Testsuite cannot detect duplicated error/warning messages
Status: NEW
Alias: duplicated
Product: gcc
Classification: Unclassified
Component: testsuite (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 28656 37933
  Show dependency treegraph
 
Reported: 2007-01-27 16:56 UTC by Manuel López-Ibáñez
Modified: 2019-01-16 18:03 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-04-17 12:56:11


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel López-Ibáñez 2007-01-27 16:56:38 UTC
We have seen several regressions and PRs with respect to this. It is possible to workaround this by using:

/* { dg-bogus "message.*message" } */
/* { dg-warning "message" "" { target *-*-* } 1 } */

However, the test must be alone in one file. Otherwise, strange things may happen.

This is obviously very cumbersome and not practical in the long run.
Comment 1 Iain Sandoe 2010-04-17 12:19:08 UTC
It seems that 
/* { dg-warning "xxxx" "" } */  
Is eating all lines where xxxx occurs together with the line on which the warning is declared.
Otherwise, we'd get an excess errors (which would be perfectly fine as a way of detecting this).

you can't even do this:
line-with-dup-warning  // { dg-warning "match-text" "" }	
// { dg-warning "match-text" "" { target *-*-* } last-line-no }	

Comment 2 Manuel López-Ibáñez 2010-04-17 12:56:11 UTC
The reason is the regexp that dejagnu uses to match the output /usr/share/dejagnu/dg.exp

 # Remove all error messages for the line [lindex $i 0]
        # in the source file.  If we find any, success!
        set line [lindex $i 0]
        set pattern [lindex $i 2]
        set comment [lindex $i 3]
        #send_user "Before:\n$comp_output\n"
        if {[regsub -all "(^|\n)(\[^\n\]+$line\[^\n\]*($pattern)\[^\n\]*\n?)+" $comp_output "\n" comp_output]} {
            set comp_output [string trimleft $comp_output]
            set ok pass
            set uhoh fail
        } else {
            set ok fail
            set uhoh pass
        }


It would be nice if this were configurable or if we could override it.
Comment 3 Iain Sandoe 2010-04-19 16:19:15 UTC
(In reply to comment #2)
> The reason is the regexp that dejagnu uses to match the output
> /usr/share/dejagnu/dg.exp
...
> It would be nice if this were configurable or if we could override it.

yeah - I've just found another gotcha
I want to test for 
warning: foo 
but not
warning: foo bar.

I can't do that with:
/* { dg-warning "foo" ... 
/* { dg-bogus "bar" "" { target ... 

is there another way?

Comment 4 Manuel López-Ibáñez 2010-04-19 17:42:14 UTC
Subject: Re:  Testsuite cannot detect duplicated 
	error/warning messages

>
> is there another way?

In this case, I think this will work:

/* { dg-bogus "foo bar" } */ /* { dg-warning "foo" } */

no?

Cheers,

Manuel.
Comment 5 Iain Sandoe 2010-04-19 18:26:38 UTC
(In reply to comment #4)
> Subject: Re:  Testsuite cannot detect duplicated 
>         error/warning messages

> In this case, I think this will work:
> 
> /* { dg-bogus "foo bar" } */ /* { dg-warning "foo" } */
>
> no?

well, apparently not ; with two comments on one line I get a dg error.
If I put them on consecutive lines..
In the case that both tests pass - all is OK.
in the case that the dg-bogus test fails the second test also fails - I guess dg-bogus eats output lines like warning does.