Commit b73b50c9 by Janis Johnson Committed by Janis Johnson

scanasm.exp (object-size): Move argument processing earlier to report errors…

scanasm.exp (object-size): Move argument processing earlier to report errors before verifying that the...

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

From-SVN: r175223
parent 83a8cbda
2011-06-20 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.
2011-06-20 Jason Merrill <jason@redhat.com> 2011-06-20 Jason Merrill <jason@redhat.com>
PR c++/47080 PR c++/47080
......
...@@ -350,11 +350,35 @@ proc object-size { args } { ...@@ -350,11 +350,35 @@ proc object-size { args } {
upvar 2 name testcase upvar 2 name testcase
set testcase [lindex $testcase 0] 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" 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 output [remote_exec host "$size" "$output_file"]
set status [lindex $output 0] set status [lindex $output 0]
if { $status != 0 } { if { $status != 0 } {
error "object-size: $size failed" verbose -log "$testcase object-size: $size failed"
unresolved "$testcase object-size $what $cmp $with"
return return
} }
...@@ -363,37 +387,21 @@ proc object-size { args } { ...@@ -363,37 +387,21 @@ proc object-size { args } {
set line0 [lindex $lines 0] set line0 [lindex $lines 0]
if ![regexp {^\s*text\s+data\s+bss\s+dec\s+hex\s+filename\s*$} $line0] { 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 return
} }
set line1 [lindex $lines 1] set line1 [lindex $lines 1]
if ![regexp {^\s*\d+\s+\d+\s+\d+\s+\d+\s+[\da-fA-F]+\s+} $line1] { 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 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] set actual [lindex $line1 $where]
verbose -log "$what size is $actual" 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] { if [expr $actual $cmp $with] {
pass "$testcase object-size $what $cmp $with" pass "$testcase object-size $what $cmp $with"
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment