]> xenbits.xensource.com Git - people/aperard/osstest.git/commitdiff
Job truncation: sg-run-job support truncation by setting global `truncate'
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 15 Jul 2016 14:30:56 +0000 (15:30 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 18 Jul 2016 14:22:22 +0000 (15:22 +0100)
Arrange for a global variable `truncate' to be honoured.  It is
initialised to 0.  If it becomes 1 then:
 * spawn-ts does not spawn jobs any more (reap-ts reaps these non-jobs
   immediately), unless they are marked with ! in their iffail
 * per-host-ts does not try to spawn anything any more, likewise
   (strictly, we could leave checking truncate to spawn-ts, but this
   way is clearer).
 * These not-spawned jobs count as successful when reaped, unlike
   jobs not spawned due to the presence of `abort'.
 * At the end of the job, if things otherwise went OK, we set the
   status to `truncated' rather than `pass'.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
sg-run-job

index df917266c991cbdd982550688947602715f96fb9..b72c864475a4416e2de54088eda7a9cb38563816 100755 (executable)
@@ -39,10 +39,11 @@ proc per-host-finish {} {
 }
 
 proc run-job {job} {
-    global jobinfo builds flight ok need_xen_hosts anyfailed
+    global jobinfo builds flight ok truncate need_xen_hosts anyfailed
     global nested_layers_hosts
 
     set ok 1
+    set truncate 0
     set anyfailed 0
     jobdb::prepare $job
 
@@ -87,6 +88,11 @@ proc run-job {job} {
        run-ts  !broken capture-logs      ts-logs-capture + host
     }
 
+    if {$truncate} {
+       if {$ok} { setstatus truncated                                     }
+       set ok 0
+    }
+
     if {$ok} { setstatus pass                                             }
 
     if {$need_build_host && $ok} { jobdb::preserve-task 90 }
@@ -150,7 +156,7 @@ proc iffail-check {iffail okexpr iffail_status_var} {
 }
 
 proc spawn-ts {iffail testid args} {
-    global flight c jobinfo reap_details env
+    global flight c jobinfo reap_details env truncate
 
     if {[file exists abort]} {
         jobdb::logputs stdout \
@@ -159,7 +165,11 @@ proc spawn-ts {iffail testid args} {
         return {imm 0} ;# reap-ts will report failure
     }
 
-    iffail-check $iffail 1 iffail_status
+    if {![iffail-check $iffail {!$truncate} iffail_status]} {
+        jobdb::logputs stdout \
+            "truncating - not executing $flight.$jobinfo(job) $args"
+        return {imm 1} ;# reap-ts will report success
+    }
 
     set real_args {}
     set adding 1
@@ -251,9 +261,9 @@ proc reap-ts {reap} {
 #---------- per-host infrastructure (non-build tests only) ----------
 
 proc per-host-ts {iffail ident script args} {
-    global ok need_xen_hosts flight jobinfo
+    global ok truncate need_xen_hosts flight jobinfo
  
-    if {![iffail-check $iffail {$ok} iffail_status]} return
+    if {![iffail-check $iffail {$ok && !$truncate} iffail_status]} return
 
     set awaitl {}
     foreach host $need_xen_hosts {