From: Ian Jackson Date: Fri, 15 Jul 2016 14:08:20 +0000 (+0100) Subject: Job truncation: Tolerate `truncated' job status X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=516d10e3cc7102c3f3f0788b0f7fc8be91836cb7;p=people%2Fliuw%2Fosstest.git Job truncation: Tolerate `truncated' job status We are going to introduce a new `truncated' job status, which means that the job went OK until sg-run-job decided not to continue with it because it had done all that was requested. (This will be used for bisection, to stop a bisection job after the step of interest.) Its properties are: * In summary HTML `truncated' shows up as a green job status, like `pass'. * The duration estimator _does_ look at truncated jobs. (Note that it only looks on the specific branch, so only when organising a bisection will it look at bisections.) * Consequently the host allocator for bisections will expect the duration to be that of the last flight where this job passed, failed or was truncated, which is correct. * When the host allocator is choosing a host for non-bisections it won't consider these truncated jobs because they ought not to appear in main branch flights. If they do they count more as fails than (that is, they do make the job sticky). * sg-execute-flight expects that sg-run-job might set the job status to `truncated' and then exit with status 0. * sg-report-flight does not look for an interesting failing step when the job is truncated (ie for this purpose it's like pass). * sg-report-flight doesn't consider truncated jobs to indicate trouble, and handles truncated properly in Subject line generation. Signed-off-by: Ian Jackson --- diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm index 468031c..1ee36da 100644 --- a/Osstest/Executive.pm +++ b/Osstest/Executive.pm @@ -303,7 +303,7 @@ sub report_run_getinfo ($) { }; }; - if ($status eq 'pass') { + if ($status eq 'pass' or $status eq 'truncated') { return $single->("($status)", $green); } elsif ($status eq 'fail' or $status eq 'broken') { my $failcolour = $status eq 'fail' ? $red : $yellow; @@ -1036,7 +1036,8 @@ sub duration_estimator ($$;$) { AND f.branch=? AND j.job=? AND r.val=? - AND (j.status='pass' OR j.status='fail') + AND (j.status='pass' OR j.status='fail' OR + j.status='truncated') AND f.started IS NOT NULL AND f.started >= ? ORDER BY f.started DESC diff --git a/sg-execute-flight b/sg-execute-flight index 4e3fcf2..7c3cf37 100755 --- a/sg-execute-flight +++ b/sg-execute-flight @@ -186,7 +186,7 @@ proc main_iteration {} { if {!$found} { error "job not in database $flight $job" } switch -exact -- $jobinfo(status) { - pass - fail - broken - blocked { + pass - fail - broken - blocked - truncated { } queued - preparing - running { jobdb::job-set-status-unlocked $flight $job broken diff --git a/sg-report-flight b/sg-report-flight index 99bde92..de1fd14 100755 --- a/sg-report-flight +++ b/sg-report-flight @@ -487,7 +487,8 @@ END $grid{ $j->{job} }[ $gridrow ]= $fi; } - if ($j->{status} ne 'pass' and !$foundfail) { + if ($j->{status} ne 'pass' and $j->{status} ne 'truncated' + and !$foundfail) { $storefail->({ stepno => '', status => "$j->{status}", @@ -518,9 +519,11 @@ END my $outcome; if ($outcomes eq 'pass') { $outcome= 'all pass'; + } elsif ($outcomes =~ m,^(?:pass/)?truncated$,) { + $outcome= 'truncated'; } elsif ($outcomes eq 'fail') { $outcome= 'ALL FAIL'; - } elsif ($outcomes =~ m,^(?:blocked/)?(?:fail/)?pass$,) { + } elsif ($outcomes =~ m,^(?:blocked/)?(?:fail/)?pass(?:/truncated)?$,) { $outcome= 'FAIL'; } else { $outcome= "trouble: $outcomes"; @@ -692,7 +695,7 @@ END } if (!%{ $r->{Failures} }) { - bodyprint "All tests in this flight passed"; + bodyprint "All tests in this flight passed as required"; } bodyprint "\n"; diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive index 13a0652..bc62211 100755 --- a/ts-hosts-allocate-Executive +++ b/ts-hosts-allocate-Executive @@ -524,9 +524,9 @@ sub hid_recurse ($$) { !defined($duration) || defined($cand->{Duration}) && $cand->{Duration} >= $duration; $previously_failed++ if - ($cand->{MostRecentStatus} // '') eq 'fail'; + ($cand->{MostRecentStatus} // '') =~ m/^(?:fail|truncated)/; $previously_failed_equiv++ if - ($cand->{EquivMostRecentStatus} // '') eq 'fail'; + ($cand->{EquivMostRecentStatus} // '') =~ m/^(?:fail|truncated)/; } my $duration_rightaway_adjust= 0;