diff mbox series

[OSSTEST,44/82] sg-run-job: New @ iffail tag for prep tasks

Message ID 20201007180024.7932-45-iwj@xenproject.org (mailing list archive)
State New, archived
Headers show
Series Reuse test hosts | expand

Commit Message

Ian Jackson Oct. 7, 2020, 5:59 p.m. UTC
From: Ian Jackson <ian.jackson@eu.citrix.com>

Currently no users sites, so no functional change.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 sg-run-job | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/sg-run-job b/sg-run-job
index 3f44cae7..a074cd42 100755
--- a/sg-run-job
+++ b/sg-run-job
@@ -223,12 +223,15 @@  proc recipe-flag {flagname {def 0}} {
 #
 #  IFFAIL can be
 #
-#           [-][!].
-#           [-][!]STATUS
+#           [@][-][!].
+#           [@][-][!]STATUS
 #
 #       where STATUS is the job/step status to be used if the step
 #       status is not as expected, and the special meanings are:
 #
+#           @      Only for per-host-ts: prefix each ident with @
+#                  to run this script only if the host is `prep'
+#                  and not if it is `ready'.
 #           -      for run-ts; suprresses exception on failure.
 #                  for per-host-ts; suppresses consequences of failure.
 #           !      Run this even if the job is being truncated.
@@ -452,8 +455,11 @@  proc reap-ts {reap {wantstatus pass}} {
 
 proc per-host-ts {iffail ident script args} {
     global ok truncate need_xen_hosts flight jobinfo
+
+    set isprep [lindex {{} @} [regsub {^\@} $iffail {} iffail]]
  
-    if {![iffail-check $iffail {$ok && !$truncate} iffail_status]} return
+    if {![iffail-check $iffail {$ok && !$truncate} iffail_status]} \
+	return
 
     set awaitl {}
     foreach host $need_xen_hosts {
@@ -461,7 +467,7 @@  proc per-host-ts {iffail ident script args} {
 	if {[string compare $host host]} {
 	    lappend hostargs +! $host
 	}
-	lappend hostargs + $host
+	lappend hostargs + $isprep$host
         lappend awaitl [eval spawn-ts $iffail $ident $script $hostargs $args]
     }