diff options
Diffstat (limited to 'deps/v8/tools/testrunner/testproc/progress.py')
-rw-r--r-- | deps/v8/tools/testrunner/testproc/progress.py | 58 |
1 files changed, 16 insertions, 42 deletions
diff --git a/deps/v8/tools/testrunner/testproc/progress.py b/deps/v8/tools/testrunner/testproc/progress.py index 6957cdc423..98f08ac842 100644 --- a/deps/v8/tools/testrunner/testproc/progress.py +++ b/deps/v8/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 @@ -13,7 +14,6 @@ import sys import time from . import base -from ..local import junit_output # Base dir of the build products for Release and Debug. @@ -152,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...') @@ -170,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): @@ -303,45 +316,6 @@ class MonochromeProgressIndicator(CompactProgressIndicator): print(("\r" + (" " * last_length) + "\r"), end='') -class JUnitTestProgressIndicator(ProgressIndicator): - def __init__(self, junitout, junittestsuite): - super(JUnitTestProgressIndicator, self).__init__() - self._requirement = base.DROP_PASS_STDOUT - - self.outputter = junit_output.JUnitTestOutput(junittestsuite) - if junitout: - self.outfile = open(junitout, "w") - else: - self.outfile = sys.stdout - - def _on_result_for(self, test, result): - # TODO(majeski): Support for dummy/grouped results - fail_text = "" - output = result.output - if result.has_unexpected_output: - stdout = output.stdout.strip() - if len(stdout): - fail_text += "stdout:\n%s\n" % stdout - stderr = output.stderr.strip() - if len(stderr): - fail_text += "stderr:\n%s\n" % stderr - fail_text += "Command: %s" % result.cmd.to_string() - if output.HasCrashed(): - fail_text += "exit code: %d\n--- CRASHED ---" % output.exit_code - if output.HasTimedOut(): - fail_text += "--- TIMEOUT ---" - self.outputter.HasRunTest( - test_name=str(test), - test_cmd=result.cmd.to_string(relative=True), - test_duration=output.duration, - test_failure=fail_text) - - def finished(self): - self.outputter.FinishAndWrite(self.outfile) - if self.outfile != sys.stdout: - self.outfile.close() - - class JsonTestProgressIndicator(ProgressIndicator): def __init__(self, framework_name, json_test_results, arch, mode): super(JsonTestProgressIndicator, self).__init__() @@ -400,7 +374,7 @@ class JsonTestProgressIndicator(ProgressIndicator): complete_results = [] if os.path.exists(self.json_test_results): with open(self.json_test_results, "r") as f: - # Buildbot might start out with an empty file. + # On bots we might start out with an empty file. complete_results = json.loads(f.read() or "[]") duration_mean = None |