diff options
Diffstat (limited to 'autobuild')
-rw-r--r-- | autobuild/results.php | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/autobuild/results.php b/autobuild/results.php index 053d4b2..2fcf432 100644 --- a/autobuild/results.php +++ b/autobuild/results.php @@ -166,34 +166,22 @@ function toggle(titleid, contentid){ <?php # See if the pattern of recent build failures indicate a flaky build -# This looks at the last 10 builds for at least two failures +# This looks at the last 10 builds for at least 4 result change function is_flaky($history) { if (count($history) < 10) return false; # Most recent 5 builds - $num_bad = 0; - for ($i = 0; $i < 5; $i++) { - if ($history[$i] === 'build_failure') - $num_bad++; + $num_change = 0; + $current = $history[0]; + for ($i = 1; $i < 10; $i++) { + if ($history[$i] != $current) { + $num_change++; + $current = $history[$i]; + } } - if ($num_bad < 1 || $num_bad >= 5) - return false; - # Next older 5 builds - $num_bad_older = 0; - for ($i = 5; $i < 10; $i++) { - if ($history[$i] === 'build_failure') - $num_bad_older++; - } - if ($num_bad_older < 1 || $num_bad_older >= 5) - return false; - - $num_bad = $num_bad + $num_bad_older; - if ($num_bad < 2 || $num_bad > 7) - return false; - - return true; + return $num_change >= 4; } function get_build_history($package) { |