[Xen-devel] [OSSTEST PATCH 13/21] TestSupport: Make "broken" set the step state too

Ian Jackson posted 21 patches 6 years, 9 months ago
[Xen-devel] [OSSTEST PATCH 13/21] TestSupport: Make "broken" set the step state too
Posted by Ian Jackson 6 years, 9 months ago
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Osstest/TestSupport.pm | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index e218ff35..8e20244d 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -235,6 +235,17 @@ sub broken ($;$) {
     # must be run outside transaction
     my $affected;
     $newst= 'broken' unless defined $newst;
+    eval {
+	# This is not always effective, but when we really care is
+	# situations where $newst is not `broken' (eg `starved') and
+	# we are running in Executive mode under sg-run-job, and then
+	# this works.  If we are running under sg-run-job, sg-run-job
+	# will set the step status if we don't manage it.
+	my $testid = $ENV{'OSSTEST_TESTID'}
+	    || die "OSSTEST_TESTID not set";
+	$mjobdb->step_finish($testid, $newst);
+    };
+    warn "failed to set step status $newst: $@" if $@;
     db_retry($flight,'running', $dbh_tests,[qw(flights)], sub {
         $affected= $dbh_tests->do(<<END, {}, $newst, $flight, $job);
             UPDATE jobs SET status=?
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel