4a2d9b1b20
This is a partial revert of: https://crrev.com/c/890938 and https://crrev.com/c/893982 Before this CL, the test runner blocked on ongoing tests in order to process their results after an internal timeout. However, the logic required for this feature was overly complicated and prevented an acceptable implementation for fast aborts. Furthermore, also the fuzzers suffered from timeouts on swarming due to hanging tests. Instead, we now abort immediately on internal timeout (used on fuzzers), SIGINT (Ctrl-C) and SIGTERM. Ongoing tests are immediately terminated and their results are disregarded. On SIGTERM and SIGINT, we return with non-zero exit codes, and zero on internal timeout. This will also properly return json output, when the external hard timeout is reached on swarming (causes SIGTERM). TBR=sergiyb@chromium.org Bug: v8:7423, chromium:813065 Change-Id: Ib20f835f58a0970693bdd3b21dc5d766d8e115d8 Reviewed-on: https://chromium-review.googlesource.com/924852 Reviewed-by: Michael Achenbach <machenbach@chromium.org> Commit-Queue: Michael Achenbach <machenbach@chromium.org> Cr-Commit-Position: refs/heads/master@{#51399}
29 lines
682 B
Python
29 lines
682 B
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 time
|
|
|
|
from . import base
|
|
|
|
|
|
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_heartbeat(self):
|
|
self._on_event()
|
|
|
|
def _on_event(self):
|
|
if not self.is_stopped:
|
|
if time.time() - self._start > self._duration_sec:
|
|
self.stop()
|