]> xenbits.xensource.com Git - people/royger/osstest.git/commitdiff
ts-depriv-audit-qemu: Leaked substeps are `blocked', and then script is fail
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 6 Jul 2018 11:08:33 +0000 (12:08 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 9 Jul 2018 10:47:06 +0000 (11:47 +0100)
If thus script crash in some non-substep-specific operation, the
substeps may have been created (and thus be in the db as `running').
Leaving them like this is not allowed: it is treated by sg-run-job,
and by the archaeologists as an internal error.

If this happens, what we want is for the script as a whole to be
`fail', and for the failing tests to be `blocked'.  The former will
spot if this crash is a regression.  The latter will avoid treating
the substeps themselves as regressions.

Reported-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
ts-depriv-audit-qemu

index 81bd5c023b1717cfca7e60c5c732890087942958..5d0935009f399508d6544e38505e47ddc157f257 100755 (executable)
@@ -118,10 +118,21 @@ sub audit_fish () {
     foreach my $cl (sort keys %classes) {
        substep_finish("/$cl", $classes{$cl} || 'pass');
        # (if there are no fds of this class, maybe they were all closed)
+       $classes{$cl} = 'reported';
     }
     logm("audit complete...");
 }
 
+END {
+    foreach my $cl (sort keys %classes) {
+       my $st = $classes{$cl};
+       next if $st eq 'reported';
+       logm("substep not reported, at exit: $cl, $st");
+       substep_finish("/$cl", 'blocked');
+       $? = -1; # in case we were trying to succeed
+    }
+}    
+
 #----- administrivia, main program, etc. -----
 
 sub mode_create () {