public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [testsuite, commited] scandump.exp, handle non-existent dump file
@ 2008-05-21  0:09 Janis Johnson
  2008-05-21  8:25 ` Richard Guenther
  0 siblings, 1 reply; 3+ messages in thread
From: Janis Johnson @ 2008-05-21  0:09 UTC (permalink / raw)
  To: gcc-patches

An attempt in a test to scan a dump file that doesn't exist results in
an ugly ERROR message in the .sum file.  Handle non-existent dump files
and instead report that checks that depend on it are UNRESOLVED.
Tested on powerpc64-linux with -m32/-m64, checked in on trunk.

2008-05-20  Janis Johnson  <janis187@us.ibm.com>

	* lib/scandump.exp (scan-dump): Handle non-existent dump file.
	(scan-dump-times): Ditto.
	(scan-dump-not): Ditto.
	(scan-dump-dem): Ditto.
	(scan-dump-dem-not): Ditto.

Index: gcc/testsuite/lib/scandump.exp
===================================================================
--- gcc/testsuite/lib/scandump.exp	(revision 135322)
+++ gcc/testsuite/lib/scandump.exp	(working copy)
@@ -49,18 +49,23 @@ proc scan-dump { args } {
     # A cleaner solution would require a new DejaGnu release.
     upvar 3 name testcase
 
+    set suf [dump-suffix [lindex $args 2]]
+    set testname "$testcase scan-[lindex $args 0]-dump $suf \"[lindex $args 1]\""
     set src [file tail [lindex $testcase 0]]
-    set output_file "[glob $src.[lindex $args 2]]"
+    set output_file "[glob -nocomplain $src.[lindex $args 2]]"
+    if { $output_file == "" } {
+	fail "$testname: dump file does not exist"
+	return
+    }
 
     set fd [open $output_file r]
     set text [read $fd]
     close $fd
 
-    set suf [dump-suffix [lindex $args 2]]
     if [regexp -- [lindex $args 1] $text] {
-	pass "$testcase scan-[lindex $args 0]-dump $suf \"[lindex $args 1]\""
+	pass "$testname"
     } else {
-	fail "$testcase scan-[lindex $args 0]-dump $suf \"[lindex $args 1]\""
+	fail "$testname"
     }
 }
 
@@ -86,18 +91,23 @@ proc scan-dump-times { args } {
     # A cleaner solution would require a new DejaGnu release.
     upvar 3 name testcase
 
+    set suf [dump-suffix [lindex $args 3]]
+    set testname "$testcase scan-[lindex $args 0]-dump-times $suf \"[lindex $args 1]\" [lindex $args 2]"
     set src [file tail [lindex $testcase 0]]
-    set output_file "[glob $src.[lindex $args 3]]"
+    set output_file "[glob -nocomplain $src.[lindex $args 3]]"
+    if { $output_file == "" } {
+	fail "$testname: dump file does not exist"
+	return
+    }
 
     set fd [open $output_file r]
     set text [read $fd]
     close $fd
 
-    set suf [dump-suffix [lindex $args 3]]
     if { [llength [regexp -inline -all -- [lindex $args 1] $text]] == [lindex $args 2]} {
-        pass "$testcase scan-[lindex $args 0]-dump-times $suf \"[lindex $args 1]\" [lindex $args 2]"
+        pass "$testname"
     } else {
-        fail "$testcase scan-[lindex $args 0]-dump-times $suf \"[lindex $args 1]\" [lindex $args 2]"
+        fail "$testname"
     }
 }
 
@@ -122,18 +132,24 @@ proc scan-dump-not { args } {
     # it still stores the filename of the testcase in a local variable "name".
     # A cleaner solution would require a new DejaGnu release.
     upvar 3 name testcase
+
+    set suf [dump-suffix [lindex $args 2]]
+    set testname "$testcase scan-[lindex $args 0]-dump-not $suf \"[lindex $args 1]\""
     set src [file tail [lindex $testcase 0]]
-    set output_file "[glob $src.[lindex $args 2]]"
+    set output_file "[glob -nocomplain $src.[lindex $args 2]]"
+    if { $output_file == "" } {
+	fail "$testname: dump file does not exist"
+	return
+    }
 
     set fd [open $output_file r]
     set text [read $fd]
     close $fd
 
-    set suf [dump-suffix [lindex $args 2]]
     if ![regexp -- [lindex $args 1] $text] {
-	pass "$testcase scan-[lindex $args 0]-dump-not $suf \"[lindex $args 1]\""
+	pass "$testname"
     } else {
-	fail "$testcase scan-[lindex $args 0]-dump-not $suf \"[lindex $args 1]\""
+	fail "$testname"
     }
 }
 
@@ -168,18 +184,23 @@ proc scan-dump-dem { args } {
     }
 
     upvar 3 name testcase
+    set suf [dump-suffix [lindex $args 2]]
+    set testname "$testcase scan-[lindex $args 0]-dump-dem $suf \"[lindex $args 1]\""
     set src [file tail [lindex $testcase 0]]
-    set output_file "[glob $src.[lindex $args 2]]"
+    set output_file "[glob -nocomplain $src.[lindex $args 2]]"
+    if { $output_file == "" } {
+	fail "$testname: dump file does not exist"
+	return
+    }
 
     set fd [open "| $cxxfilt < $output_file" r]
     set text [read $fd]
     close $fd
 
-    set suf [dump-suffix [lindex $args 2]]
     if [regexp -- [lindex $args 1] $text] {
-	pass "$testcase scan-[lindex $args 0]-dump-dem $suf \"[lindex $args 1]\""
+	pass "$testname"
     } else {
-	fail "$testcase scan-[lindex $args 0]-dump-dem $suf \"[lindex $args 1]\""
+	fail "$testname"
     }
 }
 
@@ -213,17 +234,23 @@ proc scan-dump-dem-not { args } {
     }
 
     upvar 3 name testcase
+
+    set suf [dump-suffix [lindex $args 2]]
+    set testname "$testcase scan-[lindex $args 0]-dump-dem-not $suf \"[lindex $args 1]\""
     set src [file tail [lindex $testcase 0]]
-    set output_file "[glob $src.[lindex $args 2]]"
+    set output_file "[glob -nocomplain $src.[lindex $args 2]]"
+    if { $output_file == "" } {
+	fail "$testname: dump file does not exist"
+	return
+    }
 
     set fd [open "| $cxxfilt < $output_file" r]
     set text [read $fd]
     close $fd
 
-    set suf [dump-suffix [lindex $args 2]]
     if ![regexp -- [lindex $args 1] $text] {
-	pass "$testcase scan-[lindex $args 0]-dump-dem-not $suf \"[lindex $args 1]\""
+	pass "$testname"
     } else {
-	fail "$testcase scan-[lindex $args 0]-dump-dem-not $suf \"[lindex $args 1]\""
+	fail "$testname"
     }
 }


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

* Re: [testsuite, commited] scandump.exp, handle non-existent dump file
  2008-05-21  0:09 [testsuite, commited] scandump.exp, handle non-existent dump file Janis Johnson
@ 2008-05-21  8:25 ` Richard Guenther
  2008-05-21 17:34   ` Janis Johnson
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Guenther @ 2008-05-21  8:25 UTC (permalink / raw)
  To: janis187; +Cc: gcc-patches

On Wed, May 21, 2008 at 1:38 AM, Janis Johnson <janis187@us.ibm.com> wrote:
> An attempt in a test to scan a dump file that doesn't exist results in
> an ugly ERROR message in the .sum file.  Handle non-existent dump files
> and instead report that checks that depend on it are UNRESOLVED.
> Tested on powerpc64-linux with -m32/-m64, checked in on trunk.

Shouldn't it instead FAIL?  As in if I have a typo in the dump file name, or as
if I test for vectorization but there are no loops in the function?

Richard.

> 2008-05-20  Janis Johnson  <janis187@us.ibm.com>
>
>        * lib/scandump.exp (scan-dump): Handle non-existent dump file.
>        (scan-dump-times): Ditto.
>        (scan-dump-not): Ditto.
>        (scan-dump-dem): Ditto.
>        (scan-dump-dem-not): Ditto.
>
> Index: gcc/testsuite/lib/scandump.exp
> ===================================================================
> --- gcc/testsuite/lib/scandump.exp      (revision 135322)
> +++ gcc/testsuite/lib/scandump.exp      (working copy)
> @@ -49,18 +49,23 @@ proc scan-dump { args } {
>     # A cleaner solution would require a new DejaGnu release.
>     upvar 3 name testcase
>
> +    set suf [dump-suffix [lindex $args 2]]
> +    set testname "$testcase scan-[lindex $args 0]-dump $suf \"[lindex $args 1]\""
>     set src [file tail [lindex $testcase 0]]
> -    set output_file "[glob $src.[lindex $args 2]]"
> +    set output_file "[glob -nocomplain $src.[lindex $args 2]]"
> +    if { $output_file == "" } {
> +       fail "$testname: dump file does not exist"
> +       return
> +    }
>
>     set fd [open $output_file r]
>     set text [read $fd]
>     close $fd
>
> -    set suf [dump-suffix [lindex $args 2]]
>     if [regexp -- [lindex $args 1] $text] {
> -       pass "$testcase scan-[lindex $args 0]-dump $suf \"[lindex $args 1]\""
> +       pass "$testname"
>     } else {
> -       fail "$testcase scan-[lindex $args 0]-dump $suf \"[lindex $args 1]\""
> +       fail "$testname"
>     }
>  }
>
> @@ -86,18 +91,23 @@ proc scan-dump-times { args } {
>     # A cleaner solution would require a new DejaGnu release.
>     upvar 3 name testcase
>
> +    set suf [dump-suffix [lindex $args 3]]
> +    set testname "$testcase scan-[lindex $args 0]-dump-times $suf \"[lindex $args 1]\" [lindex $args 2]"
>     set src [file tail [lindex $testcase 0]]
> -    set output_file "[glob $src.[lindex $args 3]]"
> +    set output_file "[glob -nocomplain $src.[lindex $args 3]]"
> +    if { $output_file == "" } {
> +       fail "$testname: dump file does not exist"
> +       return
> +    }
>
>     set fd [open $output_file r]
>     set text [read $fd]
>     close $fd
>
> -    set suf [dump-suffix [lindex $args 3]]
>     if { [llength [regexp -inline -all -- [lindex $args 1] $text]] == [lindex $args 2]} {
> -        pass "$testcase scan-[lindex $args 0]-dump-times $suf \"[lindex $args 1]\" [lindex $args 2]"
> +        pass "$testname"
>     } else {
> -        fail "$testcase scan-[lindex $args 0]-dump-times $suf \"[lindex $args 1]\" [lindex $args 2]"
> +        fail "$testname"
>     }
>  }
>
> @@ -122,18 +132,24 @@ proc scan-dump-not { args } {
>     # it still stores the filename of the testcase in a local variable "name".
>     # A cleaner solution would require a new DejaGnu release.
>     upvar 3 name testcase
> +
> +    set suf [dump-suffix [lindex $args 2]]
> +    set testname "$testcase scan-[lindex $args 0]-dump-not $suf \"[lindex $args 1]\""
>     set src [file tail [lindex $testcase 0]]
> -    set output_file "[glob $src.[lindex $args 2]]"
> +    set output_file "[glob -nocomplain $src.[lindex $args 2]]"
> +    if { $output_file == "" } {
> +       fail "$testname: dump file does not exist"
> +       return
> +    }
>
>     set fd [open $output_file r]
>     set text [read $fd]
>     close $fd
>
> -    set suf [dump-suffix [lindex $args 2]]
>     if ![regexp -- [lindex $args 1] $text] {
> -       pass "$testcase scan-[lindex $args 0]-dump-not $suf \"[lindex $args 1]\""
> +       pass "$testname"
>     } else {
> -       fail "$testcase scan-[lindex $args 0]-dump-not $suf \"[lindex $args 1]\""
> +       fail "$testname"
>     }
>  }
>
> @@ -168,18 +184,23 @@ proc scan-dump-dem { args } {
>     }
>
>     upvar 3 name testcase
> +    set suf [dump-suffix [lindex $args 2]]
> +    set testname "$testcase scan-[lindex $args 0]-dump-dem $suf \"[lindex $args 1]\""
>     set src [file tail [lindex $testcase 0]]
> -    set output_file "[glob $src.[lindex $args 2]]"
> +    set output_file "[glob -nocomplain $src.[lindex $args 2]]"
> +    if { $output_file == "" } {
> +       fail "$testname: dump file does not exist"
> +       return
> +    }
>
>     set fd [open "| $cxxfilt < $output_file" r]
>     set text [read $fd]
>     close $fd
>
> -    set suf [dump-suffix [lindex $args 2]]
>     if [regexp -- [lindex $args 1] $text] {
> -       pass "$testcase scan-[lindex $args 0]-dump-dem $suf \"[lindex $args 1]\""
> +       pass "$testname"
>     } else {
> -       fail "$testcase scan-[lindex $args 0]-dump-dem $suf \"[lindex $args 1]\""
> +       fail "$testname"
>     }
>  }
>
> @@ -213,17 +234,23 @@ proc scan-dump-dem-not { args } {
>     }
>
>     upvar 3 name testcase
> +
> +    set suf [dump-suffix [lindex $args 2]]
> +    set testname "$testcase scan-[lindex $args 0]-dump-dem-not $suf \"[lindex $args 1]\""
>     set src [file tail [lindex $testcase 0]]
> -    set output_file "[glob $src.[lindex $args 2]]"
> +    set output_file "[glob -nocomplain $src.[lindex $args 2]]"
> +    if { $output_file == "" } {
> +       fail "$testname: dump file does not exist"
> +       return
> +    }
>
>     set fd [open "| $cxxfilt < $output_file" r]
>     set text [read $fd]
>     close $fd
>
> -    set suf [dump-suffix [lindex $args 2]]
>     if ![regexp -- [lindex $args 1] $text] {
> -       pass "$testcase scan-[lindex $args 0]-dump-dem-not $suf \"[lindex $args 1]\""
> +       pass "$testname"
>     } else {
> -       fail "$testcase scan-[lindex $args 0]-dump-dem-not $suf \"[lindex $args 1]\""
> +       fail "$testname"
>     }
>  }
>
>
>

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

* Re: [testsuite, commited] scandump.exp, handle non-existent dump  file
  2008-05-21  8:25 ` Richard Guenther
@ 2008-05-21 17:34   ` Janis Johnson
  0 siblings, 0 replies; 3+ messages in thread
From: Janis Johnson @ 2008-05-21 17:34 UTC (permalink / raw)
  To: Richard Guenther; +Cc: gcc-patches

On Wed, 2008-05-21 at 10:14 +0200, Richard Guenther wrote:
> On Wed, May 21, 2008 at 1:38 AM, Janis Johnson <janis187@us.ibm.com> wrote:
> > An attempt in a test to scan a dump file that doesn't exist results in
> > an ugly ERROR message in the .sum file.  Handle non-existent dump files
> > and instead report that checks that depend on it are UNRESOLVED.
> > Tested on powerpc64-linux with -m32/-m64, checked in on trunk.
> 
> Shouldn't it instead FAIL?  As in if I have a typo in the dump file name, or as
> if I test for vectorization but there are no loops in the function?

> > +    set output_file "[glob -nocomplain $src.[lindex $args 2]]"
> > +    if { $output_file == "" } {
> > +       fail "$testname: dump file does not exist"
> > +       return
> > +    }

I was wrong about the UNRESOLVED part.  A scandump check is now
reported as a failure when the dump file is missing.  The report
goes from this:

ERROR: gcc.dg/var-expand3.c: error executing dg-final: no files matched glob pattern "var-expand3.c.[0-9][0-9][0-9]r.loop2_unroll"
UNRESOLVED: gcc.dg/var-expand3.c: error executing dg-final: no files matched glob pattern "var-expand3.c.[0-9][0-9][0-9]r.loop2_unroll"

to this:

FAIL: gcc.dg/var-expand3.c scan-rtl-dump loop2_unroll "Expanding Accumulator": dump file does not exist

Janis

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

end of thread, other threads:[~2008-05-21 16:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-21  0:09 [testsuite, commited] scandump.exp, handle non-existent dump file Janis Johnson
2008-05-21  8:25 ` Richard Guenther
2008-05-21 17:34   ` Janis Johnson

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).