Patchwork [testsuite] scan-assembler variants to use 'unresolved' for missing file

login
register
mail settings
Submitter Janis Johnson
Date June 20, 2011, 8:34 p.m.
Message ID <4DFFAEC0.6080106@codesourcery.com>
Download mbox | patch
Permalink /patch/101202/
State New
Headers show

Comments

Janis Johnson - June 20, 2011, 8:34 p.m.
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  <janisoj@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.
Mike Stump - June 26, 2011, 12:05 a.m.
On Jun 20, 2011, at 1:34 PM, Janis Johnson wrote:
> 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?

Ok.  Ok for 4.6.  Please watch for any fall out, don't expect any, but...

Patch

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 {