eval [list run-ts . $testid + ts-repeat-test $reps +] $args
}
+proc iffail-check {iffail okexpr iffail_status_var} {
+ # iffail is as passed to spawn-ts, per-host-ts, run-ts, etc.
+ # iffail-check checks for any leading ! (which means "always run")
+ # if none is present, $okexpr is evaluated
+ # iffail-check sets caller's $iffail_status_var with the actual
+ # status to use if the step fails (replacing `.' with `fail')
+ # iffail-check then returns 1 if the step should be run
+ # (either because ! or because $okexpr) or 0 otherwise
+ global ok
+ upvar 1 $iffail_status_var iffail_status
+
+ if {[regexp {^!?\.$} $iffail]} {
+ regsub {\.$} $iffail fail iffail
+ }
+ if {![regsub {^!} $iffail {} iffail_status]} {
+ if {![uplevel 1 [list expr $okexpr]]} { return 0 }
+ }
+ return 1
+}
+
proc spawn-ts {iffail testid args} {
global flight c jobinfo reap_details env
return {}
}
- if {![string compare . $iffail]} { set iffail fail }
+ iffail-check $iffail 1 iffail_status
set real_args {}
set adding 1
regsub {\(\*\)$} $testid ($stepno) testid
set detstr "$flight.$jobinfo(job) $ts $real_args"
- set details [list $flight $jobinfo(job) $stepno $detstr $iffail]
+ set details [list $flight $jobinfo(job) $stepno $detstr $iffail_status]
jobdb::logputs stdout "starting $detstr $testid"
jobdb::spawn-step-commit $flight $jobinfo(job) $stepno $testid
proc per-host-ts {iffail ident script args} {
global ok need_xen_hosts flight jobinfo
-
- if {![regsub {^!} $iffail {} iffail]} {
- if {!$ok} return
- }
- if {![string compare . $iffail]} { set iffail fail }
+
+ if {![iffail-check $iffail {$ok} iffail_status]} return
set awaitl {}
foreach host $need_xen_hosts {
}
if {$failed} {
- setstatus $iffail
+ setstatus $iffail_status
}
}