From b3270b82eb725ac446bd84b89a71b0b2f07975d2 Mon Sep 17 00:00:00 2001 From: Liviu Rau Date: Wed, 16 Oct 2019 10:40:24 +0200 Subject: [PATCH] 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 Reviewed-by: Tamer Tas Reviewed-by: Michael Achenbach Cr-Commit-Position: refs/heads/master@{#64311} --- tools/testrunner/testproc/progress.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/testrunner/testproc/progress.py b/tools/testrunner/testproc/progress.py index 72d65fda45..98f08ac842 100644 --- a/tools/testrunner/testproc/progress.py +++ b/tools/testrunner/testproc/progress.py @@ -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):