Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Unified Diff: tools/testrunner/local/progress.py

Issue 13813003: Add support for JUnit compatible XML output in the new test runner. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed nits. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/testrunner/local/junit_output.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testrunner/local/progress.py
diff --git a/tools/testrunner/local/progress.py b/tools/testrunner/local/progress.py
index 9075a954faae6e084835d8781b6d9f6d2c6f2977..c13c0eb54e3c36e9753ee01bdf9373b74abf7262 100644
--- a/tools/testrunner/local/progress.py
+++ b/tools/testrunner/local/progress.py
@@ -29,6 +29,8 @@
import sys
import time
+from . import junit_output
+
def EscapeCommand(command):
parts = []
for part in command:
@@ -230,6 +232,50 @@ 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(
+ [test.GetLabel()] + self.runner.context.mode_flags + test.flags,
+ test.duration,
+ fail_text)
+
+
PROGRESS_INDICATORS = {
'verbose': VerboseProgressIndicator,
'dots': DotsProgressIndicator,
« no previous file with comments | « tools/testrunner/local/junit_output.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698