04d95171f4
This reverts commit f4ebbb3fd4
.
Reason for revert: Suspected to make things worse than better, e.g.:
https://chromium-swarm.appspot.com/task?id=3b4b2f864304f010&refresh=10&show_raw=1
and
https://chromium-swarm.appspot.com/task?id=3b4b2f8045da5510&refresh=10&show_raw=1
Original change's description:
> [test] Let fuzzer total timeout also stop the execution loop
>
> TBR=sergiyb@chromium.org
>
> Bug: v8:6917
> Change-Id: I5bc8f49dc01d98949e3efab01192c663de8027bf
> Reviewed-on: https://chromium-review.googlesource.com/888578
> Commit-Queue: Michael Achenbach <machenbach@chromium.org>
> Reviewed-by: Michael Achenbach <machenbach@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#50887}
TBR=machenbach@chromium.org,sergiyb@chromium.org,majeski@google.com
Change-Id: Ib9f530348594e361d491e827aa03a38f41da9f1a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:6917
Reviewed-on: https://chromium-review.googlesource.com/888519
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50894}
60 lines
1.8 KiB
Python
60 lines
1.8 KiB
Python
# Copyright 2018 the V8 project authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
import collections
|
|
|
|
from . import base
|
|
from .result import RerunResult
|
|
|
|
|
|
class RerunProc(base.TestProcProducer):
|
|
def __init__(self, rerun_max, rerun_max_total=None):
|
|
super(RerunProc, self).__init__('Rerun')
|
|
self._requirement = base.DROP_OUTPUT
|
|
|
|
self._rerun = {}
|
|
self._results = collections.defaultdict(list)
|
|
self._rerun_max = rerun_max
|
|
self._rerun_total_left = rerun_max_total
|
|
|
|
def _next_test(self, test):
|
|
self._send_next_subtest(test)
|
|
|
|
def _result_for(self, test, subtest, result):
|
|
# First result
|
|
if subtest.procid[-2:] == '-1':
|
|
# Passed, no reruns
|
|
if not result.has_unexpected_output:
|
|
self._send_result(test, result)
|
|
return
|
|
|
|
self._rerun[test.procid] = 0
|
|
|
|
results = self._results[test.procid]
|
|
results.append(result)
|
|
|
|
if self._needs_rerun(test, result):
|
|
self._rerun[test.procid] += 1
|
|
if self._rerun_total_left is not None:
|
|
self._rerun_total_left -= 1
|
|
self._send_next_subtest(test, self._rerun[test.procid])
|
|
else:
|
|
result = RerunResult.create(results)
|
|
self._finalize_test(test)
|
|
self._send_result(test, result)
|
|
|
|
def _needs_rerun(self, test, result):
|
|
# TODO(majeski): Limit reruns count for slow tests.
|
|
return ((self._rerun_total_left is None or self._rerun_total_left > 0) and
|
|
self._rerun[test.procid] < self._rerun_max and
|
|
result.has_unexpected_output)
|
|
|
|
def _send_next_subtest(self, test, run=0):
|
|
subtest = self._create_subtest(test, str(run + 1), keep_output=(run != 0))
|
|
self._send_test(subtest)
|
|
|
|
def _finalize_test(self, test):
|
|
del self._rerun[test.procid]
|
|
del self._results[test.procid]
|