set prog [remote_download host $prog]
if { $prog == "" } {
error "download failed"
- return -1;
+ return -1
}
}
set sim "env $testcase_env $sim"
}
- send_log "$sim $always_opts $SIMFLAGS $sim_opts $prog $prog_opts\n"
+ if { [board_info target sim,protocol] == "sid" } {
+ set cmd ""
+ set sim_opts "$sim_opts -e \"set cpu-loader file [list ${prog}]\""
+ } else {
+ set cmd "$prog"
+ }
+
+ send_log "$sim $always_opts $SIMFLAGS $sim_opts $cmd $prog_opts\n"
if { "$redir" == "" } {
- remote_spawn host "$sim $always_opts $SIMFLAGS $sim_opts $prog $prog_opts"
+ remote_spawn host "$sim $always_opts $SIMFLAGS $sim_opts $cmd $prog_opts"
} else {
- remote_spawn host "$sim $always_opts $SIMFLAGS $sim_opts $prog $prog_opts $redir" writeonly
+ remote_spawn host "$sim $always_opts $SIMFLAGS $sim_opts $cmd $prog_opts $redir" writeonly
}
set result [remote_wait host $testcase_timeout]
# as[(mach-list)]: <assembler options>
# ld[(mach-list)]: <linker options>
# sim[(mach-list)]: <simulator options>
+# progopts: <arguments to the program being simulated>
# 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>
+# kfail: <PRMS> <target-triplets-where-test-fails>
# If `output' is not specified, the program must output "pass" if !xerror or
# "fail" if xerror.
# The parens in "optname()" are optional if the specification is for all machs.
+# Multiple "output", "xfail" and "kfail" options concatenate.
+# The xfail and kfail arguments are space-separated target triplets and PRIDs.
+# There must be a PRMS (bug report ID) specified for kfail, while it's
+# optional for xfail.
proc run_sim_test { name requested_machs } {
global subdir srcdir
global SIMFLAGS
global opts
global cpu_option
+ global global_as_options
+ global global_ld_options
+ global global_sim_options
if [string match "*/*" $name] {
set file $name
# Clear default options
set opts(as) ""
set opts(ld) ""
+ set opts(progopts) ""
set opts(sim) ""
set opts(output) ""
set opts(mach) ""
set opts(timeout) ""
set opts(xerror) "no"
+ set opts(xfail) ""
+ set opts(kfail) ""
+
+ if ![info exists global_as_options] {
+ set global_as_options ""
+ }
+ if ![info exists global_ld_options] {
+ set global_ld_options ""
+ }
+ if ![info exists global_sim_options] {
+ set global_sim_options ""
+ }
# Clear any machine specific options specified in a previous test case
foreach m $requested_machs {
unresolved $subdir/$name
return
}
+ # Multiple "output" specifications concatenate, they don't override.
+ if { $opt_name == "output" } {
+ set opt_val "$opts(output)$opt_val"
+ }
+ # Similar with "xfail" and "kfail", but arguments are space-separated.
+ if { $opt_name == "xfail" || $opt_name == "kfail" } {
+ set opt_val "$opts($opt_name) $opt_val"
+ }
+
foreach m $opt_machs {
set opts($opt_name,$m) $opt_val
}
verbose -log "Testing $name on machine $mach."
+ # Time to setup xfailures and kfailures.
+ if { "$opts(xfail)" != "" } {
+ verbose -log "xfail: $opts(xfail)"
+ # Using eval to make $opts(xfail) appear as individual
+ # arguments.
+ eval setup_xfail $opts(xfail)
+ }
+ if { "$opts(kfail)" != "" } {
+ verbose -log "kfail: $opts(kfail)"
+ eval setup_kfail $opts(kfail)
+ }
+
if ![info exists opts(as,$mach)] {
set opts(as,$mach) $opts(as)
}
if [info exists cpu_option] {
set as_options "$as_options $cpu_option=$mach"
}
- set comp_output [target_assemble $sourcefile ${name}.o "$as_options"]
+ set comp_output [target_assemble $sourcefile ${name}.o "$as_options $global_as_options"]
if ![string match "" $comp_output] {
verbose -log "$comp_output" 3
set opts(ld,$mach) $opts(ld)
}
- set comp_output [target_link ${name}.o ${name}.x "$opts(ld,$mach)"]
+ set comp_output [target_link ${name}.o ${name}.x "$opts(ld,$mach) $global_ld_options"]
if ![string match "" $comp_output] {
verbose -log "$comp_output" 3
set options "$options timeout=$opts(timeout)"
}
- set result [sim_run ${name}.x "$opts(sim,$mach)" "" "" "$options"]
+ set result [sim_run ${name}.x "$opts(sim,$mach) $global_sim_options" "$opts(progopts)" "" "$options"]
set status [lindex $result 0]
set output [lindex $result 1]
if { "$opts(xerror)" == "no" } {
if [string match $opts(output) $output] {
pass "$mach $testname"
+ file delete ${name}.o ${name}.x
} else {
verbose -log "output: $output" 3
verbose -log "pattern: $opts(output)" 3
} else {
if [string match $opts(output) $output] {
pass "$mach $testname"
+ file delete ${name}.o ${name}.x
} else {
verbose -log "output: $output" 3
verbose -log "pattern: $opts(output)" 3
# whitespace is ignored anywhere except within the options list;
# option names are alphabetic only
set pat "^#${ws}(\[a-zA-Z\]*)\\(?(\[^):\]*)\\)?$ws:${ws}(.*)$ws\$"
- # Allow comment as first line of file.
- set firstline 1
+ # Allow arbitrary lines until the first option is seen.
+ set seen_opt 0
while { [gets $f line] != -1 } {
set line [string trim $line]
# Whitespace here is space-tab.
if [regexp $pat $line xxx opt_name opt_machs opt_val] {
# match!
lappend opt_array [list $opt_name $opt_machs $opt_val]
+ set seen_opt 1
} else {
- if { ! $firstline } {
+ if { $seen_opt } {
break
}
}
- set firstline 0
}
close $f
return $opt_array