Avoid output timeout when using progress indicator ci

Using test runner with option --progress=ci can generate
output timeouts in an actual CI environment. To avoid
that we gonna write a timestamp in the standard output
at every minute.

Bug: v8:9146
Change-Id: Id2f05530956b01d9b07809e509cd0cefc0be54b2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1863196
Commit-Queue: Liviu Rau <liviurau@chromium.org>
Reviewed-by: Tamer Tas <tmrts@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64311}
This commit is contained in:
Liviu Rau 2019-10-16 10:40:24 +02:00 committed by Commit Bot
parent 143241483b
commit b3270b82eb

View File

@ -5,6 +5,7 @@
# for py2/py3 compatibility
from __future__ import print_function
import datetime
import json
import os
import platform
@ -151,8 +152,11 @@ class VerboseProgressIndicator(SimpleProgressIndicator):
except:
pass
def _ensure_delay(self, delay):
return time.time() - self._last_printed_time > delay
def _on_heartbeat(self):
if time.time() - self._last_printed_time > 30:
if self._ensure_delay(30):
# Print something every 30 seconds to not get killed by an output
# timeout.
self._print('Still working...')
@ -169,6 +173,16 @@ class CIProgressIndicator(VerboseProgressIndicator):
if self.options.ci_test_completion:
with open(self.options.ci_test_completion, "a") as f:
f.write(self._message(test, result) + "\n")
self._output_feedback()
def _output_feedback(self):
"""Reduced the verbosity leads to getting killed by an ouput timeout.
We ensure output every minute.
"""
if self._ensure_delay(60):
dt = time.time()
st = datetime.datetime.fromtimestamp(dt).strftime('%Y-%m-%d %H:%M:%S')
self._print(st)
class DotsProgressIndicator(SimpleProgressIndicator):