Chromium Code Reviews| Index: tools/testrunner/local/progress.py |
| diff --git a/tools/testrunner/local/progress.py b/tools/testrunner/local/progress.py |
| index 9075a954faae6e084835d8781b6d9f6d2c6f2977..94eaccd340e45abd62f4d87a3a8d1e94ffb9785d 100644 |
| --- a/tools/testrunner/local/progress.py |
| +++ b/tools/testrunner/local/progress.py |
| @@ -29,6 +29,8 @@ |
| import sys |
| import time |
| +from testrunner.local import junit_output |
|
Jakob Kummerow
2013/04/09 09:41:35
nit: please use "from . import junit_output"
palfia
2013/04/10 17:23:32
Done.
|
| + |
| def EscapeCommand(command): |
| parts = [] |
| for part in command: |
| @@ -230,6 +232,51 @@ class MonochromeProgressIndicator(CompactProgressIndicator): |
| print ("\r" + (" " * last_line_length) + "\r"), |
| +class JUnitTestProgressIndicator(ProgressIndicator): |
| + |
| + def __init__(self, progress_indicator, junitout, junittestsuite): |
| + self.progress_indicator = progress_indicator |
| + self.outputter = junit_output.JUnitTestOutput(junittestsuite) |
| + if junitout: |
| + self.outfile = open(junitout, "w") |
| + else: |
| + self.outfile = sys.stdout |
| + |
| + def Starting(self): |
| + self.progress_indicator.runner = self.runner |
| + self.progress_indicator.Starting() |
| + |
| + def Done(self): |
| + self.progress_indicator.Done() |
| + self.outputter.FinishAndWrite(self.outfile) |
| + if self.outfile != sys.stdout: |
| + self.outfile.close() |
| + |
| + def AboutToRun(self, test): |
| + self.progress_indicator.AboutToRun(test) |
| + |
| + def HasRun(self, test): |
| + self.progress_indicator.HasRun(test) |
| + fail_text = "" |
| + if test.suite.HasUnexpectedOutput(test): |
| + stdout = test.output.stdout.strip() |
| + if len(stdout): |
| + fail_text += "stdout:\n%s\n" % stdout |
| + stderr = test.output.stderr.strip() |
| + if len(stderr): |
| + fail_text += "stderr:\n%s\n" % stderr |
| + fail_text += "Command: %s" % EscapeCommand(self.runner.GetCommand(test)) |
| + if test.output.HasCrashed(): |
| + fail_text += "exit code: %d\n--- CRASHED ---" % test.output.exit_code |
| + if test.output.HasTimedOut(): |
| + fail_text += "--- TIMEOUT ---" |
| + self.outputter.HasRunTest( |
|
Jakob Kummerow
2013/04/09 09:41:35
nit: suggestion for formatting that better reflect
palfia
2013/04/10 17:23:32
Done.
|
| + [test.GetLabel()] + |
| + self.runner.context.mode_flags + |
| + test.flags, |
| + test.duration, fail_text) |
| + |
| + |
| PROGRESS_INDICATORS = { |
| 'verbose': VerboseProgressIndicator, |
| 'dots': DotsProgressIndicator, |