Skip to contentSkip to conversation

ts-depriv-audit-qemu: Leaked substeps are `blocked', and then script is fail

PATCH In review Ian Jackson 3 participants 3 messages Jul 6, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ts-depriv-audit-qemu: Leaked substeps are `blocked', and then script is fail

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.

---
 ts-depriv-audit-qemu | 11 +++++++++++
 1 file changed, 11 insertions(+)
ts-depriv-audit-qemu +11 -0
index 81bd5c0..3c218d9 100755
@@ -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 () {
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 21 lines · Ian Jackson

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.

---
 ts-depriv-audit-qemu | 11 +++++++++++
 1 file changed, 11 insertions(+)
ts-depriv-audit-qemu +0 -0
index 81bd5c0..3c218d9 100755

ts-depriv-audit-qemu sub audit_fish () { · line 121

Quoted 4 lines
ts-depriv-audit-qemu +1 -0
@@ -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';

The case here is different than ...

ts-depriv-audit-qemu sub audit_fish () { · line 129

Quoted 8 lines
ts-depriv-audit-qemu +4 -0
     }
     logm("audit complete...");
 }
 
+END {
+    foreach my $cl (sort keys %classes) {
+	my $st = $classes{$cl};
+	next if $st eq 'REPORTED';

.. here. Is there something I'm missing or should it be the same?

Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw

Anthony PERARD writes ("Re: [OSSTEST PATCH] ts-depriv-audit-qemu: Leaked substeps are `blocked', and then script is fail"):

Quoted 10 lines · Ian Jackson

ts-depriv-audit-qemu sub audit_fish () { · line 121

Quoted 2 lines
ts-depriv-audit-qemu +1 -0
 	# (if there are no fds of this class, maybe they were all closed)
+	$classes{$cl} = 'reported';

The case here is different than ...

Quoted 4 lines
     }
     logm("audit complete...");

}

Quoted 6 lines

ts-depriv-audit-qemu sub audit_fish () { · line 129

Quoted 4 lines
ts-depriv-audit-qemu +4 -0
+END {
+    foreach my $cl (sort keys %classes) {
+	my $st = $classes{$cl};
+	next if $st eq 'REPORTED';

.. here. Is there something I'm missing or should it be the same?

Indeed, you have spotted a mistake. Thanks. As I said, I hadn't tested it. I have now and with that fixed, it seems to work. I'll push this to osstest pretest when the previous batch gets a pass.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel