diff mbox

[testsuite] dg-final object-size: fail if file does not exist

Message ID 4DFA9F25.2030701@codesourcery.com
State New
Headers show

Commit Message

Janis Johnson June 17, 2011, 12:26 a.m. UTC
On 06/16/2011 04:18 PM, Joseph S. Myers wrote:
> On Thu, 16 Jun 2011, Janis Johnson wrote:
> 
>> Currently there are several possible causes for failure in object-size.
>> Some are errors in the test itself, like the wrong number of arguments,
>> but some others could be UNRESOLVED instead of ERROR, such as the "size"
>> command failing or producing unexpected output.  Can the UNRESOLVED line
>> include additional information about the reason for the failure, or
>> should the reason just be in a message in the log file?
> 
> My view is that reasons should be separately in the log file; there should 
> be a fixed set of test names, each of which may be PASS, FAIL, UNRESOLVED 
> etc. in a particular test run.  (I know the code reporting ICEs in test 
> names doesn't conform to this; properly that should have separate "test 
> for internal compiler error" test names rather than modifying the name of 
> a failing test if it has an ICE.)

This new fix to object-size, used within dg-final, continues to report
static test errors as ERROR, but reports problems detected at runtime
as UNRESOLVED, writing the reason to the log file.  I'm confident that
a missing object file should make the test UNRESOLVED, not as sure about
problems with the size command on a particular target.

With this change the message from object-size is the same for pass/fail/
unresolved.

OK for trunk?

Janis
2011-06-16  Janis Johnson  <janisjo@codesourcery.com>

	* lib/scanasm.exp (object-size): Move argument processing earlier
	to report errors before verifying that the file exists.  Report
	problems detected at runtime as unresolved instead of error and
	report their reasons to the log file.

Comments

Mike Stump June 18, 2011, 2:21 p.m. UTC | #1
On Jun 16, 2011, at 5:26 PM, Janis Johnson wrote:
> This new fix to object-size, used within dg-final, continues to report
> static test errors as ERROR, but reports problems detected at runtime
> as UNRESOLVED, writing the reason to the log file.  I'm confident that
> a missing object file should make the test UNRESOLVED, not as sure about
> problems with the size command on a particular target.
> 
> With this change the message from object-size is the same for pass/fail/
> unresolved.
> 
> OK for trunk?

Ok.
diff mbox

Patch

Index: lib/scanasm.exp
===================================================================
--- lib/scanasm.exp	(revision 175083)
+++ lib/scanasm.exp	(working copy)
@@ -350,11 +350,35 @@ 
 
     upvar 2 name testcase
     set testcase [lindex $testcase 0]
+
+    set what [lindex $args 0]
+    set where [lsearch { text data bss total } $what]
+    if { $where == -1 } {
+        error "object-size: illegal argument: $what"
+        return
+    }
+    set cmp [lindex $args 1]
+    if { [lsearch { < > <= >= == != } $cmp] == -1 } {
+        error "object-size: illegal argument: $cmp"
+        return
+    }
+    set with [lindex $args 2]
+    if ![string is integer $with ] {
+        error "object-size: illegal argument: $with"
+        return
+    }
+
     set output_file "[file rootname [file tail $testcase]].o"
+    if ![file_on_host exists $output_file] {
+	verbose -log "$testcase: $output_file does not exist"
+	unresolved "$testcase object-size $what $cmp $with"
+	return
+    }
     set output [remote_exec host "$size" "$output_file"]
     set status [lindex $output 0]
     if { $status != 0 } {
-        error "object-size: $size failed"
+        verbose -log "$testcase object-size: $size failed"
+        unresolved "$testcase object-size $what $cmp $with"
         return
     }
 
@@ -363,37 +387,21 @@ 
 
     set line0 [lindex $lines 0]
     if ![regexp {^\s*text\s+data\s+bss\s+dec\s+hex\s+filename\s*$} $line0] {
-        error "object-size: $size did not produce expected first line: $line0"
+        verbose -log "$testcase object-size: $size did not produce expected first line: $line0"
+        unresolved "$testcase object-size $what $cmp $with"
         return
     }
 
     set line1 [lindex $lines 1]
     if ![regexp {^\s*\d+\s+\d+\s+\d+\s+\d+\s+[\da-fA-F]+\s+} $line1] {
-        error "object-size: $size did not produce expected second line: $line1"
+        verbose -log "$testcase object-size: $size did not produce expected second line: $line1"
+        unresolved "$testcase object-size $what $cmp $with"
         return
     }
 
-    set what [lindex $args 0]
-    set where [lsearch { text data bss total } $what]
-    if { $where == -1 } {
-        error "object-size: illegal argument: $what"
-        return
-    }
     set actual [lindex $line1 $where]
     verbose -log "$what size is $actual"
 
-    set cmp [lindex $args 1]
-    if { [lsearch { < > <= >= == != } $cmp] == -1 } {
-        error "object-size: illegal argument: $cmp"
-        return
-    }
-
-    set with [lindex $args 2]
-    if ![string is integer $with ] {
-        error "object-size: illegal argument: $with"
-        return
-    }
-
     if [expr $actual $cmp $with] {
 	pass "$testcase object-size $what $cmp $with"
     } else {