# timeout=val - set the timeout to val for this run
#
# The result is a list of two elements.
-# The first is one of pass/fail/etc.
+# The first is the program's exit status (0/1/etc...).
# The second is the program's output.
#
# This is different than the sim_load routine provided by
remote_file host delete $prog
}
- # ??? Not sure the test for pass/fail is right.
- # We just care that the simulator ran correctly, not whether the simulated
- # program return 0 or non-zero from `main'.
- set status fail
- if { $return_code == 0 } {
- set status pass
- }
-
- return [list $status $output]
+ return [list $return_code $output]
}
# Run testcase NAME.
# cc[(mach-list)]: <compiler options>
# sim[(mach-list)]: <simulator options>
# progopts: <arguments to the program being simulated>
+# status: program exit status to treat as "pass"
# output: program output pattern to match with string-match
# xerror: program is expected to return with a "failure" exit code
# xfail: <PRMS-opt> <target-triplets-where-test-fails>
set opts(cc) ""
set opts(progopts) ""
set opts(sim) ""
+ set opts(status) "0"
set opts(output) ""
set opts(mach) ""
set opts(timeout) ""
}
set result [sim_run ${name}.x "$opts(sim,$mach) $global_sim_options" "$opts(progopts)" "" "$options"]
- set status [lindex $result 0]
+ set return_code [lindex $result 0]
set output [lindex $result 1]
+ set status fail
+ if { $return_code == $opts(status) } {
+ set status pass
+ }
+
if { "$status" == "pass" } {
if { "$opts(xerror)" == "no" } {
if [string match $opts(output) $output] {
pass "$mach $testname"
file delete ${name}.o ${name}.x
} else {
+ verbose -log "status: $return_code" 3
verbose -log "output: $output" 3
verbose -log "pattern: $opts(output)" 3
fail "$mach $testname (execution)"
pass "$mach $testname"
file delete ${name}.o ${name}.x
} else {
+ verbose -log "status: $return_code" 3
verbose -log "output: $output" 3
verbose -log "pattern: $opts(output)" 3
fail "$mach $testname (execution)"
set result [sim_run $dest "$opts(sim,$mach)" "$opts(progoptions)" \
"" "$opts(simenv)"]
- set status [lindex $result 0]
+ set return_code [lindex $result 0]
set output [lindex $result 1]
+ set status fail
+ if { $return_code == 0 } {
+ set status pass
+ }
+
if { "$status" == "pass" } {
if { "$opts(xerror)" == "no" } {
if [string match $opts(output) $output] {