public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "manu at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug testsuite/25241] DejaGNU does not distinguish between errors and warnings
Date: Tue, 30 Jan 2007 20:36:00 -0000	[thread overview]
Message-ID: <20070130203550.27988.qmail@sourceware.org> (raw)
In-Reply-To: <bug-25241-1000@http.gcc.gnu.org/bugzilla/>



------- Comment #4 from manu at gcc dot gnu dot org  2007-01-30 20:35 -------
I have the following patch. Framework tests work. However, this patch will make
a lot of tests to fail because:

* Many tests are using the wrong dg-warning or dg-error directive.
* Many tests add an explicit "warning:" or "error:" to workaround this bug.
* Many tests match several warning/error messages with a single
dg-warning/dg-error directive.

So what we want to do? Fix the testcases or do nothing?


Index: gcc/testsuite/gcc.test-framework/dg-error-exp-F.c
===================================================================
--- gcc/testsuite/gcc.test-framework/dg-error-exp-F.c   (revision 0)
+++ gcc/testsuite/gcc.test-framework/dg-error-exp-F.c   (revision 0)
@@ -0,0 +1,11 @@
+/* Test the tester; previously part of gcc.misc-tests/dg-9.c.  */
+/* { dg-prms-id 42 } */
+/* { dg-options "-Wall" } */
+
+f ()
+{      /* { dg-error "return type" "warning test" } */
+}      /* { dg-error "control reaches end" "warning test" } */
+
+main (int argc, char *argv[])
+{              /* { dg-error "return type" "warning test" } */
+}              /* { dg-error "control reaches end" "warning test" } */
Index: gcc/testsuite/gcc.test-framework/dg-warning-exp-F.c
===================================================================
--- gcc/testsuite/gcc.test-framework/dg-warning-exp-F.c (revision 0)
+++ gcc/testsuite/gcc.test-framework/dg-warning-exp-F.c (revision 0)
@@ -0,0 +1,10 @@
+/* Test the tester; previously part of gcc.misc-tests/dg-9.c.  */
+/* { dg-prms-id 42 } */
+/* { dg-options "-Wall" } */
+
+int main (int argc, char *argv[])
+{
+  +;  /* { dg-warning "expected expression" "error test" } */
+  return 0;
+}
+
Index: gcc/testsuite/gcc.test-framework/README
===================================================================
--- gcc/testsuite/gcc.test-framework/README     (revision 121027)
+++ gcc/testsuite/gcc.test-framework/README     (working copy)
@@ -19,7 +19,7 @@ To run these tests:
 To check the results:

     TF=${SRC}/gcc/testsuite/gcc.test-framework
-    awk -f ${TF}/test-framework.awk gcc/testsuite/gcc.sum
+    awk -f ${TF}/test-framework.awk gcc/testsuite/gcc/gcc.sum


 The awk script prints unexpected results followed by the number of tests
 that passed and failed.
Index: gcc/testsuite/lib/gfortran-dg.exp
===================================================================
--- gcc/testsuite/lib/gfortran-dg.exp   (revision 121027)
+++ gcc/testsuite/lib/gfortran-dg.exp   (working copy)
@@ -107,3 +107,14 @@ proc gfortran-dg-runtest { testcases def
        }
     }
 }
+
+
+if { [info procs gfortran-saved-dg-warning] == [list] } {
+    rename dg-warning gfortran-saved-dg-warning
+    rename saved-dg-warning dg-warning
+}
+
+if { [info procs gfortran-saved-dg-error] == [list] } {
+    rename dg-error gfortran-saved-dg-error
+    rename saved-dg-error dg-error
+}
Index: gcc/testsuite/lib/gcc-dg.exp
===================================================================
--- gcc/testsuite/lib/gcc-dg.exp        (revision 121027)
+++ gcc/testsuite/lib/gcc-dg.exp        (working copy)
@@ -540,4 +540,78 @@ if { [info procs saved-dg-test] == [list
     }
 }

+if { [info procs saved-dg-warning] == [list] } {
+    rename dg-warning saved-dg-warning
+
+    proc dg-warning { args } {
+       upvar dg-messages messages
+
+       if { [llength $args] > 5 } {
+           error "[lindex $args 0]: too many arguments"
+           return
+       }
+
+       set xfail ""
+       if { [llength $args] >= 4 } {
+           switch [dg-process-target [lindex $args 3]] {
+               "F" { set xfail "X" }
+               "P" { set xfail "" }
+               "N" {
+                   # If we get "N", this warning doesn't apply to us so ignore
it.
+                   return
+               }
+           }
+       }
+
+       if { [llength $args] >= 5 } {
+           switch [lindex $args 4] {
+               "." { set line [dg-format-linenum [lindex $args 0]] }
+               "0" { set line "" }
+               "default" { set line [dg-format-linenum [lindex $args 4]] }
+           }
+       } else {
+           set line [dg-format-linenum [lindex $args 0]]
+       }
+
+       lappend messages [list $line "${xfail}WARNING" [concat
"\[wW\]arning:\[^\n\]*" [lindex $args 1]] [lindex $args 2]]
+    }
+}
+
+if { [info procs saved-dg-error] == [list] } {
+    rename dg-error saved-dg-error
+
+    proc dg-error { args } {
+       upvar dg-messages messages
+
+       if { [llength $args] > 5 } {
+           error "[lindex $args 0]: too many arguments"
+           return
+       }
+
+       set xfail ""
+       if { [llength $args] >= 4 } {
+           switch [dg-process-target [lindex $args 3]] {
+               "F" { set xfail "X" }
+               "P" { set xfail "" }
+               "N" {
+                   # If we get "N", this error doesn't apply to us so ignore
it.
+                   return
+               }
+           }
+       }
+
+       if { [llength $args] >= 5 } {
+           switch [lindex $args 4] {
+               "." { set line [dg-format-linenum [lindex $args 0]] }
+               "0" { set line "" }
+               "default" { set line [dg-format-linenum [lindex $args 4]] }
+           }
+       } else {
+           set line [dg-format-linenum [lindex $args 0]]
+       }
+
+       lappend messages [list $line "${xfail}ERROR" [concat
"\[eE\]rror:\[^\n\]*" [lindex $args 1]] [lindex $args 2]]
+    }
+}
+
 set additional_prunes ""


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25241


  parent reply	other threads:[~2007-01-30 20:36 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-03 10:12 [Bug testsuite/25241] New: " gdr at gcc dot gnu dot org
2005-12-03 16:39 ` [Bug testsuite/25241] " pinskia at gcc dot gnu dot org
2006-11-27 22:12 ` janis at gcc dot gnu dot org
2007-01-27 16:49 ` manu at gcc dot gnu dot org
2007-01-30 20:36 ` manu at gcc dot gnu dot org [this message]
2007-01-30 21:02 ` joseph at codesourcery dot com
2007-01-30 21:10 ` manu at gcc dot gnu dot org
2007-01-30 22:14 ` joseph at codesourcery dot com
2007-01-31  2:04 ` janis at gcc dot gnu dot org
2007-01-31  2:28 ` manu at gcc dot gnu dot org
2007-01-31  6:44 ` gdr at cs dot tamu dot edu
2007-01-31 17:34 ` janis at gcc dot gnu dot org
2007-01-31 18:11 ` manu at gcc dot gnu dot org
2007-01-31 18:34 ` janis at gcc dot gnu dot org
2007-01-31 19:11 ` joseph at codesourcery dot com
2007-01-31 21:15 ` gdr at cs dot tamu dot edu
2007-01-31 22:24 ` manu at gcc dot gnu dot org
2007-02-02 12:17 ` manu at gcc dot gnu dot org
2007-02-02 13:14 ` manu at gcc dot gnu dot org
2007-02-03  1:29 ` janis at gcc dot gnu dot org
2007-02-03 22:58 ` janis at gcc dot gnu dot org
2007-02-28  0:31 ` manu at gcc dot gnu dot org
2007-02-28  9:57 ` manu at gcc dot gnu dot org
2007-03-01 21:36 ` manu at gcc dot gnu dot org
2007-03-01 22:54 ` janis at gcc dot gnu dot org
2007-03-01 23:25 ` manu at gcc dot gnu dot org
2007-03-13  0:29 ` manu at gcc dot gnu dot org
2007-03-13  0:34 ` janis at gcc dot gnu dot org
2007-03-13  0:44 ` manu at gcc dot gnu dot org
2007-03-13  0:49 ` manu at gcc dot gnu dot org
2007-03-22 22:37 ` manu at gcc dot gnu dot org
2007-03-23 20:51 ` janis at gcc dot gnu dot org
2007-03-23 21:15 ` janis at gcc dot gnu dot org
2007-03-23 21:52 ` manu at gcc dot gnu dot org
2007-03-23 22:00 ` manu at gcc dot gnu dot org
2007-03-23 22:06 ` manu at gcc dot gnu dot org
2007-03-23 22:13 ` manu at gcc dot gnu dot org
2007-03-23 22:49 ` janis at gcc dot gnu dot org
2007-03-23 23:52 ` janis at gcc dot gnu dot org
2007-03-24  0:28 ` manu at gcc dot gnu dot org
2007-03-24 11:10 ` manu at gcc dot gnu dot org
2007-03-24 17:55 ` manu at gcc dot gnu dot org
2007-03-26 19:49 ` manu at gcc dot gnu dot org
2007-03-29  0:12 ` janis at gcc dot gnu dot org
2007-03-30 11:25 ` manu at gcc dot gnu dot org
2007-03-30 20:14 ` manu at gcc dot gnu dot org
2007-05-15  0:35 ` janis at gcc dot gnu dot org
2007-05-15 15:16 ` manu at gcc dot gnu dot org
2007-05-15 18:30 ` janis at gcc dot gnu dot org
2007-05-17  1:52 ` manu at gcc dot gnu dot org
2007-06-04 21:12 ` manu at gcc dot gnu dot org
2007-06-05 22:30 ` manu at gcc dot gnu dot org
2007-06-06 20:49 ` manu at gcc dot gnu dot org
2007-06-07 21:02 ` manu at gcc dot gnu dot org
2007-06-30 13:03 ` manu at gcc dot gnu dot org
2007-06-30 13:07 ` manu at gcc dot gnu dot org
2007-07-08 14:50 ` manu at gcc dot gnu dot org
2007-07-10  9:17 ` manu at gcc dot gnu dot org
2007-07-12 22:58 ` manu at gcc dot gnu dot org
2007-07-12 23:05 ` manu at gcc dot gnu dot org
2008-08-22 20:10 ` [Bug testsuite/25241] [C++] " janis at gcc dot gnu dot org
2008-08-26 18:30 ` janis at gcc dot gnu dot org
2008-09-17  0:09 ` janis at gcc dot gnu dot org
2008-09-17 23:25 ` janis at gcc dot gnu dot org
2008-09-18 22:32 ` janis at gcc dot gnu dot org
2008-12-28 22:19 ` reichelt at gcc dot gnu dot org
2009-01-06 17:51 ` janis at gcc dot gnu dot org
2009-01-10 22:37 ` reichelt at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070130203550.27988.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).