From 66d0be855a9ca97a0698f46ebb861c64b018d359 Mon Sep 17 00:00:00 2001 From: Janis Johnson Date: Tue, 20 May 2008 23:29:56 +0000 Subject: [PATCH] scandump.exp (scan-dump): Handle non-existent dump file. * 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. From-SVN: r135690 --- gcc/testsuite/ChangeLog | 6 +++ gcc/testsuite/lib/scandump.exp | 67 ++++++++++++++++++++++++---------- 2 files changed, 53 insertions(+), 20 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 532eb7d67a6..ab4b65a5b69 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2008-05-20 Janis Johnson + * 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. + * obj-c++.dg/bitfield-1.mm: XFAIL for ICE; move dg-options after other test directives; use dg-prune-output instead of dg-excess-errors for possible message to ignore; adjust line numbers for messages. diff --git a/gcc/testsuite/lib/scandump.exp b/gcc/testsuite/lib/scandump.exp index 9dde9004837..373052b4566 100644 --- a/gcc/testsuite/lib/scandump.exp +++ b/gcc/testsuite/lib/scandump.exp @@ -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" } } -- 2.30.2