Commit c077ff54 authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

Revert "[test] Move timeout control to timeout processor"

This reverts commit 4de2be99.

Reason for revert: Testing stops too early now, e.g. here after 2 min:
https://build.chromium.org/p/client.v8.clusterfuzz/builders/V8%20NumFuzz/builds/32

Original change's description:
> [test] Move timeout control to timeout processor
> 
> Bug: v8:6917
> Change-Id: I03be38be952f0d59eb20fa98102ef09ca795de40
> Reviewed-on: https://chromium-review.googlesource.com/883446
> Commit-Queue: Michał Majewski <majeski@google.com>
> Reviewed-by: Michael Achenbach <machenbach@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#50848}

TBR=machenbach@chromium.org,sergiyb@chromium.org,majeski@google.com

Change-Id: I6a925866476c69b3b50aa08e99facca0eaaa396b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:6917
Reviewed-on: https://chromium-review.googlesource.com/884082Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50851}
parent da4553b1
......@@ -24,7 +24,6 @@ from testrunner.testproc.filter import StatusFileFilterProc, NameFilterProc
from testrunner.testproc.loader import LoadProc
from testrunner.testproc.progress import ResultsTracker, TestsCounter
from testrunner.testproc.rerun import RerunProc
from testrunner.testproc.timeout import TimeoutProc
DEFAULT_SUITES = ["mjsunit", "webkit", "benchmarks"]
......@@ -99,11 +98,10 @@ class NumFuzzer(base_runner.BaseTestRunner):
"between deopt points")
parser.add_option("--tests-count", default=5, type="int",
help="Number of tests to generate from each base test. "
"Can be combined with --total-timeout-sec with "
"value 0 to provide infinite number of subtests.")
help="Number of tests to generate from each base test")
parser.add_option("--total-timeout-sec", default=0, type="int",
help="How long should fuzzer run")
help="How long should fuzzer run. It overrides "
"--tests-count")
# Combine multiple tests
parser.add_option("--combine-tests", default=False, action="store_true",
......@@ -167,7 +165,6 @@ class NumFuzzer(base_runner.BaseTestRunner):
fuzzer_proc,
] + indicators + [
results,
self._create_timeout_proc(options),
self._create_rerun_proc(options),
execproc,
]
......@@ -275,11 +272,6 @@ class NumFuzzer(base_runner.BaseTestRunner):
add('deopt', options.stress_deopt, options.stress_deopt_min)
return fuzzers
def _create_timeout_proc(self, options):
if not options.total_timeout_sec:
return None
return TimeoutProc(options.total_timeout_sec)
def _create_rerun_proc(self, options):
if not options.rerun_failures_count:
return None
......
......@@ -42,7 +42,6 @@ class TestProc(object):
def __init__(self):
self._prev_proc = None
self._next_proc = None
self._stopped = False
self._requirement = DROP_RESULT
self._prev_requirement = None
self._reduce_result = lambda result: result
......@@ -93,15 +92,6 @@ class TestProc(object):
if self._prev_proc:
self._prev_proc.heartbeat()
def stop(self):
self._stopped = True
if self._prev_proc:
self._prev_proc.stop()
@property
def is_stopped(self):
return self._stopped
### Communication
def _send_test(self, test):
......
......@@ -65,14 +65,17 @@ class FuzzerProc(base.TestProcProducer):
self._disable_analysis = disable_analysis
self._gens = {}
self._start_time = None
self._stop = False
def setup(self, requirement=base.DROP_RESULT):
# Fuzzer is optimized to not store the results
assert requirement == base.DROP_RESULT
super(FuzzerProc, self).setup(requirement)
def _next_test(self, test):
if self.is_stopped:
return
if not self._start_time:
self._start_time = time.time()
analysis_subtest = self._create_analysis_subtest(test)
if analysis_subtest:
......@@ -97,6 +100,11 @@ class FuzzerProc(base.TestProcProducer):
def _result_for(self, test, subtest, result):
if self._fuzz_duration_sec and not self._stop:
if int(time.time() - self._start_time) > self._fuzz_duration_sec:
print '>>> Stopping fuzzing'
self._stop = True
if not self._disable_analysis:
if result is not None:
# Analysis phase, for fuzzing we drop the result.
......@@ -130,7 +138,7 @@ class FuzzerProc(base.TestProcProducer):
return
i = 0
while not self._count or i < self._count:
while (self._fuzz_duration_sec and not self._stop) or i < self._count:
main_index = self._rng.choice(indexes)
_, main_gen = gens[main_index]
......@@ -147,7 +155,7 @@ class FuzzerProc(base.TestProcProducer):
i += 1
def _try_send_next_test(self, test):
if not self.is_stopped:
if not self._stop:
for subtest in self._gens[test.procid]:
self._send_test(subtest)
return
......
# 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 time
from . import base
# TODO(majeski): Signal handler
class TimeoutProc(base.TestProcObserver):
def __init__(self, duration_sec):
super(TimeoutProc, self).__init__()
self._duration_sec = duration_sec
self._start = time.time()
def _on_next_test(self, test):
self._on_event()
def _on_result_for(self, test, result):
self._on_event()
def _on_event(self):
if not self.is_stopped:
if time.time() - self._start > self._duration_sec:
self.stop()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment