| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fdad5b6 commit 4bf6e02
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,7 +38,7 @@ | |||
| 38 | 38 | ||
| 39 | 39 | # Reset this number to 0 on major V8 upgrades. | |
| 40 | 40 | # Increment by one for each non-official patch applied to deps/v8. | |
| 41 | - 'v8_embedder_string': '-node.1', | ||
| 41 | + 'v8_embedder_string': '-node.2', | ||
| 42 | 42 | ||
| 43 | 43 | ##### V8 defaults for Node.js ##### | |
| 44 | 44 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -350,6 +350,9 @@ def _add_parser_default_options(self, parser): | |||
| 350 | 350 | "color, mono)") | |
| 351 | 351 | parser.add_option("--json-test-results", | |
| 352 | 352 | help="Path to a file for storing json results.") | |
| 353 | + parser.add_option("--junitout", help="File name of the JUnit output") | ||
| 354 | + parser.add_option("--junittestsuite", default="v8tests", | ||
| 355 | + help="The testsuite name in the JUnit output file") | ||
| 353 | 356 | parser.add_option("--exit-after-n-failures", type="int", default=100, | |
| 354 | 357 | help="Exit after the first N failures instead of " | |
| 355 | 358 | "running all tests. Pass 0 to disable this feature.") | |
@@ -796,6 +799,9 @@ def _get_shard_info(self, options): | |||
| 796 | 799 | ||
| 797 | 800 | def _create_progress_indicators(self, test_count, options): | |
| 798 | 801 | procs = [PROGRESS_INDICATORS[options.progress]()] | |
| 802 | + if options.junitout: | ||
| 803 | + procs.append(progress.JUnitTestProgressIndicator(options.junitout, | ||
| 804 | + options.junittestsuite)) | ||
| 799 | 805 | if options.json_test_results: | |
| 800 | 806 | procs.append(progress.JsonTestProgressIndicator( | |
| 801 | 807 | self.framework_name, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,49 @@ | |||
| 1 | + # Copyright 2013 the V8 project authors. All rights reserved. | ||
| 2 | + # Redistribution and use in source and binary forms, with or without | ||
| 3 | + # modification, are permitted provided that the following conditions are | ||
| 4 | + # met: | ||
| 5 | + # | ||
| 6 | + # * Redistributions of source code must retain the above copyright | ||
| 7 | + # notice, this list of conditions and the following disclaimer. | ||
| 8 | + # * Redistributions in binary form must reproduce the above | ||
| 9 | + # copyright notice, this list of conditions and the following | ||
| 10 | + # disclaimer in the documentation and/or other materials provided | ||
| 11 | + # with the distribution. | ||
| 12 | + # * Neither the name of Google Inc. nor the names of its | ||
| 13 | + # contributors may be used to endorse or promote products derived | ||
| 14 | + # from this software without specific prior written permission. | ||
| 15 | + # | ||
| 16 | + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 17 | + # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 18 | + # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
| 19 | + # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 20 | + # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
| 21 | + # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 22 | + # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| 23 | + # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| 24 | + # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| 25 | + # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 26 | + # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 27 | + | ||
| 28 | + | ||
| 29 | + import xml.etree.ElementTree as xml | ||
| 30 | + | ||
| 31 | + | ||
| 32 | + class JUnitTestOutput: | ||
| 33 | + def __init__(self, test_suite_name): | ||
| 34 | + self.root = xml.Element("testsuite") | ||
| 35 | + self.root.attrib["name"] = test_suite_name | ||
| 36 | + | ||
| 37 | + def HasRunTest(self, test_name, test_cmd, test_duration, test_failure): | ||
| 38 | + testCaseElement = xml.Element("testcase") | ||
| 39 | + testCaseElement.attrib["name"] = test_name | ||
| 40 | + testCaseElement.attrib["cmd"] = test_cmd | ||
| 41 | + testCaseElement.attrib["time"] = str(round(test_duration, 3)) | ||
| 42 | + if len(test_failure): | ||
| 43 | + failureElement = xml.Element("failure") | ||
| 44 | + failureElement.text = test_failure | ||
| 45 | + testCaseElement.append(failureElement) | ||
| 46 | + self.root.append(testCaseElement) | ||
| 47 | + | ||
| 48 | + def FinishAndWrite(self, f): | ||
| 49 | + xml.ElementTree(self.root).write(f, "UTF-8") | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,6 +14,7 @@ | |||
| 14 | 14 | import time | |
| 15 | 15 | ||
| 16 | 16 | from . import base | |
| 17 | + from ..local import junit_output | ||
| 17 | 18 | ||
| 18 | 19 | ||
| 19 | 20 | # Base dir of the build products for Release and Debug. | |
@@ -316,6 +317,45 @@ def _clear_line(self, last_length): | |||
| 316 | 317 | print(("\r" + (" " * last_length) + "\r"), end='') | |
| 317 | 318 | ||
| 318 | 319 | ||
| 320 | + class JUnitTestProgressIndicator(ProgressIndicator): | ||
| 321 | + def __init__(self, junitout, junittestsuite): | ||
| 322 | + super(JUnitTestProgressIndicator, self).__init__() | ||
| 323 | + self._requirement = base.DROP_PASS_STDOUT | ||
| 324 | + | ||
| 325 | + self.outputter = junit_output.JUnitTestOutput(junittestsuite) | ||
| 326 | + if junitout: | ||
| 327 | + self.outfile = open(junitout, "w") | ||
| 328 | + else: | ||
| 329 | + self.outfile = sys.stdout | ||
| 330 | + | ||
| 331 | + def _on_result_for(self, test, result): | ||
| 332 | + # TODO(majeski): Support for dummy/grouped results | ||
| 333 | + fail_text = "" | ||
| 334 | + output = result.output | ||
| 335 | + if result.has_unexpected_output: | ||
| 336 | + stdout = output.stdout.strip() | ||
| 337 | + if len(stdout): | ||
| 338 | + fail_text += "stdout:\n%s\n" % stdout | ||
| 339 | + stderr = output.stderr.strip() | ||
| 340 | + if len(stderr): | ||
| 341 | + fail_text += "stderr:\n%s\n" % stderr | ||
| 342 | + fail_text += "Command: %s" % result.cmd.to_string() | ||
| 343 | + if output.HasCrashed(): | ||
| 344 | + fail_text += "exit code: %d\n--- CRASHED ---" % output.exit_code | ||
| 345 | + if output.HasTimedOut(): | ||
| 346 | + fail_text += "--- TIMEOUT ---" | ||
| 347 | + self.outputter.HasRunTest( | ||
| 348 | + test_name=str(test), | ||
| 349 | + test_cmd=result.cmd.to_string(relative=True), | ||
| 350 | + test_duration=output.duration, | ||
| 351 | + test_failure=fail_text) | ||
| 352 | + | ||
| 353 | + def finished(self): | ||
| 354 | + self.outputter.FinishAndWrite(self.outfile) | ||
| 355 | + if self.outfile != sys.stdout: | ||
| 356 | + self.outfile.close() | ||
| 357 | + | ||
| 358 | + | ||
| 319 | 359 | class JsonTestProgressIndicator(ProgressIndicator): | |
| 320 | 360 | def __init__(self, framework_name, json_test_results, arch, mode): | |
| 321 | 361 | super(JsonTestProgressIndicator, self).__init__() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments