Variants of scan-assembler, used in the dg-final steps of a test, do
not check that the output file exists, so it's reported as an error.
With this patch, if the file is missing then the check is reported as
unresolved using the same message as for pass/fail, and the reason for
the unresolved test is reported in the log file.  This matches recent
changes for scan-dump and object-size.

OK for trunk, and later for 4.6?

Janis
2011-06-20  Janis Johnson  <jani...@codesourcery.com

        * lib/scanasm.exp (dg-scan, scan-assembler-times, scan-assembler-dem,
        scan-assembler-dem-not): For missing file, report unresolved with
        same message as for pass/fail, with reason reported in log file.

Index: lib/scanasm.exp
===================================================================
--- lib/scanasm.exp     (revision 175224)
+++ lib/scanasm.exp     (working copy)
@@ -50,16 +50,22 @@
        }
     }
 
+    set pattern [lindex $orig_args 0]
+    set printable_pattern [make_pattern_printable $pattern]
+
     if { [is_remote host] } {
        remote_upload host "$output_file"
     } 
+    set files [glob -nocomplain $output_file]
+    if { $files == "" } {
+       verbose -log "$testcase: output file does not exist"
+       unresolved "$testcase $name $printable_pattern"
+       return
+    }
     set fd [open $output_file r]
     set text [read $fd]
     close $fd
 
-    set pattern [lindex $orig_args 0]
-    set printable_pattern [make_pattern_printable $pattern]
-
     set match [regexp -- $pattern $text]
     if { $match == $positive } {
        pass "$testcase $name $printable_pattern"
@@ -202,15 +208,23 @@
     upvar 2 name testcase
     set testcase [lindex $testcase 0]
 
+    set pattern [lindex $args 0]
+    set pp_pattern [make_pattern_printable $pattern]
+
     # This must match the rule in gcc-dg.exp.
     set output_file "[file rootname [file tail $testcase]].s"
 
+    set files [glob -nocomplain $output_file]
+    if { $files == "" } {
+       verbose -log "$testcase: output file does not exist"
+       unresolved "$testcase scan-assembler-times $pp_pattern [lindex $args 1]"
+       return
+    }
+
     set fd [open $output_file r]
     set text [read $fd]
     close $fd
 
-    set pattern [lindex $args 0]
-    set pp_pattern [make_pattern_printable $pattern]
     if { [llength [regexp -inline -all -- $pattern $text]] == [lindex $args 
1]} {
        pass "$testcase scan-assembler-times $pp_pattern [lindex $args 1]"
     } else {
@@ -253,13 +267,20 @@
 
     upvar 2 name testcase
     set testcase [lindex $testcase 0]
+    set pattern [lindex $args 0]
+    set pp_pattern [make_pattern_printable $pattern]
     set output_file "[file rootname [file tail $testcase]].s"
 
+    set files [glob -nocomplain $output_file]
+    if { $files == "" } {
+       verbose -log "$testcase: output file does not exist"
+       unresolved "$testcase scan-assembler-dem $pp_pattern"
+       return
+    }
+
     set output [remote_exec host "$cxxfilt" "" "$output_file"]
     set text [lindex $output 1]
 
-    set pattern [lindex $args 0]
-    set pp_pattern [make_pattern_printable $pattern]
     if [regexp -- $pattern $text] {
        pass "$testcase scan-assembler-dem $pp_pattern"
     } else {
@@ -301,13 +322,20 @@
 
     upvar 2 name testcase
     set testcase [lindex $testcase 0]
+    set pattern [lindex $args 0]
+    set pp_pattern [make_pattern_printable $pattern]
     set output_file "[file rootname [file tail $testcase]].s"
 
+    set files [glob -nocomplain $output_file]
+    if { $files == "" } {
+       verbose -log "$testcase: output file does not exist"
+       unresolved "$testcase scan-assembler-dem-not $pp_pattern"
+       return
+    }
+
     set output [remote_exec host "$cxxfilt" "" "$output_file"]
     set text [lindex $output 1]
 
-    set pattern [lindex $args 0]
-    set pp_pattern [make_pattern_printable $pattern]
     if ![regexp -- $pattern $text] {
        pass "$testcase scan-assembler-dem-not $pp_pattern"
     } else {

Reply via email to