Commit 580da898 authored by Liviu Rau's avatar Liviu Rau Committed by Commit Bot

Added a new CIProgressIndicator (--progress=ci)

The new indicator behaves like verbose without
printing the names of tests that passed. Also
a new option (--ci-test-completion=/path) was
added to represent a file where we can collect
test completion messages.

Bug: v8:9146
Change-Id: I0f1bbef4036a3019b60b094687b734d3d33a5915
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1806916Reviewed-by: 's avatarTamer Tas <tmrts@chromium.org>
Commit-Queue: Liviu Rau <liviurau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63837}
parent d8b0c1e3
......@@ -166,6 +166,7 @@ MODES = {
PROGRESS_INDICATORS = {
'verbose': progress.VerboseProgressIndicator,
'ci': progress.CIProgressIndicator,
'dots': progress.DotsProgressIndicator,
'color': progress.ColorProgressIndicator,
'mono': progress.MonochromeProgressIndicator,
......@@ -356,6 +357,10 @@ class BaseTestRunner(object):
parser.add_option("--exit-after-n-failures", type="int", default=100,
help="Exit after the first N failures instead of "
"running all tests. Pass 0 to disable this feature.")
parser.add_option("--ci-test-completion",
help="Path to a file for logging test completion in the "
"context of CI progress indicator. Ignored if "
"progress indicator is other than 'ci'.")
# Rerun
parser.add_option("--rerun-failures-count", default=0, type=int,
......@@ -802,6 +807,9 @@ class BaseTestRunner(object):
self.build_config.arch,
self.mode_options.execution_mode))
for proc in procs:
proc.configure(options)
for proc in procs:
try:
proc.set_test_count(test_count)
......
......@@ -56,9 +56,16 @@ class ResultsTracker(base.TestProcObserver):
class ProgressIndicator(base.TestProcObserver):
def __init__(self):
super(base.TestProcObserver, self).__init__()
self.options = None
def finished(self):
pass
def configure(self, options):
self.options = options
class SimpleProgressIndicator(ProgressIndicator):
def __init__(self):
......@@ -113,8 +120,7 @@ class VerboseProgressIndicator(SimpleProgressIndicator):
sys.stdout.flush()
self._last_printed_time = time.time()
def _on_result_for(self, test, result):
super(VerboseProgressIndicator, self)._on_result_for(test, result)
def _message(self, test, result):
# TODO(majeski): Support for dummy/grouped results
if result.has_unexpected_output:
if result.output.HasCrashed():
......@@ -123,9 +129,12 @@ class VerboseProgressIndicator(SimpleProgressIndicator):
outcome = 'FAIL'
else:
outcome = 'pass'
return 'Done running %s %s: %s' % (
test, test.variant or 'default', outcome)
self._print('Done running %s %s: %s' % (
test, test.variant or 'default', outcome))
def _on_result_for(self, test, result):
super(VerboseProgressIndicator, self)._on_result_for(test, result)
self._print(self._message(test, result))
# TODO(machenbach): Remove this platform specific hack and implement a proper
# feedback channel from the workers, providing which tests are currently run.
......@@ -154,6 +163,14 @@ class VerboseProgressIndicator(SimpleProgressIndicator):
self._print_processes_linux()
class CIProgressIndicator(VerboseProgressIndicator):
def _on_result_for(self, test, result):
super(VerboseProgressIndicator, self)._on_result_for(test, result)
if self.options.ci_test_completion:
with open(self.options.ci_test_completion, "a") as f:
f.write(self._message(test, result) + "\n")
class DotsProgressIndicator(SimpleProgressIndicator):
def __init__(self):
super(DotsProgressIndicator, self).__init__()
......
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