diff options
Diffstat (limited to 'deps/v8/tools/testrunner/testproc/progress.py')
-rw-r--r-- | deps/v8/tools/testrunner/testproc/progress.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/deps/v8/tools/testrunner/testproc/progress.py b/deps/v8/tools/testrunner/testproc/progress.py index c102cddec1..ec97ab226f 100644 --- a/deps/v8/tools/testrunner/testproc/progress.py +++ b/deps/v8/tools/testrunner/testproc/progress.py @@ -15,6 +15,7 @@ import time from . import base from . import util +from ..local import junit_output def print_failure_header(test, is_flaky=False): @@ -361,6 +362,45 @@ 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): super(JsonTestProgressIndicator, self).__init__() |