Commit a49fdc7a authored by Liviu Rau's avatar Liviu Rau Committed by V8 LUCI CQ

[testrunner] Pass events down to indicators

Bug: v8:12785
Change-Id: Icae27e743824a234d51946747402c2c4e2bb9ec2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3779686
Commit-Queue: Liviu Rau <liviurau@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81870}
parent 6df7f9e4
......@@ -19,9 +19,9 @@ from testrunner.local import command
from testrunner.local import testsuite
from testrunner.local import utils
from testrunner.test_config import TestConfig
from testrunner.testproc import indicators
from testrunner.testproc.sigproc import SignalProc
from testrunner.testproc import util
from testrunner.testproc.indicators import PROGRESS_INDICATORS
from testrunner.testproc.sigproc import SignalProc
from testrunner.utils.augmented_options import AugmentedOptions
from testrunner.build_config import BuildConfig
......@@ -117,15 +117,6 @@ TRY_RELEASE_MODE = ModeConfig(
status_mode="debug",
)
PROGRESS_INDICATORS = {
'verbose': indicators.VerboseProgressIndicator,
'ci': indicators.CIProgressIndicator,
'dots': indicators.DotsProgressIndicator,
'color': indicators.ColorProgressIndicator,
'mono': indicators.MonochromeProgressIndicator,
'stream': indicators.StreamProgressIndicator,
}
class TestRunnerError(Exception):
pass
......
......@@ -101,6 +101,7 @@ class TestProc(object):
def _send_result(self, test, result):
"""Helper method for sending result to the previous processor."""
self._prev_proc.result_for(test, result)
class TestProcObserver(TestProc):
"""Processor used for observing the data."""
def __init__(self):
......
......@@ -36,6 +36,12 @@ class ProgressIndicator():
def finished(self):
pass
def on_heartbeat(self):
pass
def on_event(self, event):
pass
class SimpleProgressIndicator(ProgressIndicator):
......@@ -143,14 +149,14 @@ class VerboseProgressIndicator(SimpleProgressIndicator):
def _ensure_delay(self, delay):
return time.time() - self._last_printed_time > delay
def _on_heartbeat(self):
def on_heartbeat(self):
if self._ensure_delay(30):
# Print something every 30 seconds to not get killed by an output
# timeout.
self._print('Still working...')
self._print_processes_linux()
def _on_event(self, event):
def on_event(self, event):
self._print(event)
self._print_processes_linux()
......@@ -417,3 +423,13 @@ class JsonTestProgressIndicator(ProgressIndicator):
with open(self.options.json_test_results, "w") as f:
json.dump(result, f)
PROGRESS_INDICATORS = {
'verbose': VerboseProgressIndicator,
'ci': CIProgressIndicator,
'dots': DotsProgressIndicator,
'color': ColorProgressIndicator,
'mono': MonochromeProgressIndicator,
'stream': StreamProgressIndicator,
}
......@@ -5,8 +5,7 @@
from . import base
from testrunner.local import utils
from testrunner.testproc.indicators import JsonTestProgressIndicator
from testrunner.base_runner import PROGRESS_INDICATORS
from testrunner.testproc.indicators import JsonTestProgressIndicator, PROGRESS_INDICATORS
class ResultsTracker(base.TestProcObserver):
......@@ -73,3 +72,11 @@ class ProgressProc(base.TestProcObserver):
def finished(self):
for proc in self.procs:
proc.finished()
def _on_heartbeat(self):
for proc in self.procs:
proc.on_heartbeat()
def _on_event(self, event):
for proc in self.procs:
proc.on_event(event)
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