Skip to content

Commit 7c61c6e

Browse files
refacktargos
authored andcommitted
deps: V8: un-cherry-pick bd019bd
Original commit message: [testrunner] delete ancient junit compatible format support Testrunner has ancient support for JUnit compatible XML output. This CL removes this old feature. [email protected],[email protected],[email protected] CC=​[email protected] Bug: v8:8728 Change-Id: I7e1beb011dbaec3aa1a27398a5c52abdd778eaf0 Reviewed-on: https://chromium-review.googlesource.com/c/1430065 Reviewed-by: Jakob Gruber <[email protected]> Reviewed-by: Michael Starzinger <[email protected]> Commit-Queue: Tamer Tas <[email protected]> Cr-Commit-Position: refs/heads/master@{#59045} Refs: v8/v8@bd019bd PR-URL: #32116 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 1853127 commit 7c61c6e

File tree

4 files changed

+96
-1
lines changed

4 files changed

+96
-1
lines changed

‎common.gypi‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.0',
39+
'v8_embedder_string': '-node.1',
4040

4141
##### V8 defaults for Node.js #####
4242

‎deps/v8/tools/testrunner/base_runner.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,9 @@ def _add_parser_default_options(self, parser):
358358
help="Path to a file for storing json results.")
359359
parser.add_option('--slow-tests-cutoff', type="int", default=100,
360360
help='Collect N slowest tests')
361+
parser.add_option("--junitout", help="File name of the JUnit output")
362+
parser.add_option("--junittestsuite", default="v8tests",
363+
help="The testsuite name in the JUnit output file")
361364
parser.add_option("--exit-after-n-failures", type="int", default=100,
362365
help="Exit after the first N failures instead of "
363366
"running all tests. Pass 0 to disable this feature.")
@@ -780,6 +783,9 @@ def _get_shard_info(self, options):
780783

781784
def_create_progress_indicators(self, test_count, options):
782785
procs= [PROGRESS_INDICATORS[options.progress]()]
786+
ifoptions.junitout:
787+
procs.append(progress.JUnitTestProgressIndicator(options.junitout,
788+
options.junittestsuite))
783789
ifoptions.json_test_results:
784790
procs.append(progress.JsonTestProgressIndicator(self.framework_name))
785791

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
importxml.etree.ElementTreeasxml
30+
31+
32+
classJUnitTestOutput:
33+
def__init__(self, test_suite_name):
34+
self.root=xml.Element("testsuite")
35+
self.root.attrib["name"] =test_suite_name
36+
37+
defHasRunTest(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+
iflen(test_failure):
43+
failureElement=xml.Element("failure")
44+
failureElement.text=test_failure
45+
testCaseElement.append(failureElement)
46+
self.root.append(testCaseElement)
47+
48+
defFinishAndWrite(self, f):
49+
xml.ElementTree(self.root).write(f, "UTF-8")

‎deps/v8/tools/testrunner/testproc/progress.py‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
from . importbase
1717
from . importutil
18+
from ..localimportjunit_output
1819

1920

2021
defprint_failure_header(test):
@@ -348,6 +349,45 @@ def _clear_line(self, last_length):
348349
print(("\r"+ (" "*last_length) +"\r"), end='')
349350

350351

352+
classJUnitTestProgressIndicator(ProgressIndicator):
353+
def__init__(self, junitout, junittestsuite):
354+
super(JUnitTestProgressIndicator, self).__init__()
355+
self._requirement=base.DROP_PASS_STDOUT
356+
357+
self.outputter=junit_output.JUnitTestOutput(junittestsuite)
358+
ifjunitout:
359+
self.outfile=open(junitout, "w")
360+
else:
361+
self.outfile=sys.stdout
362+
363+
def_on_result_for(self, test, result):
364+
# TODO(majeski): Support for dummy/grouped results
365+
fail_text=""
366+
output=result.output
367+
ifresult.has_unexpected_output:
368+
stdout=output.stdout.strip()
369+
iflen(stdout):
370+
fail_text+="stdout:\n%s\n"%stdout
371+
stderr=output.stderr.strip()
372+
iflen(stderr):
373+
fail_text+="stderr:\n%s\n"%stderr
374+
fail_text+="Command: %s"%result.cmd.to_string()
375+
ifoutput.HasCrashed():
376+
fail_text+="exit code: %d\n--- CRASHED ---"%output.exit_code
377+
ifoutput.HasTimedOut():
378+
fail_text+="--- TIMEOUT ---"
379+
self.outputter.HasRunTest(
380+
test_name=str(test),
381+
test_cmd=result.cmd.to_string(relative=True),
382+
test_duration=output.duration,
383+
test_failure=fail_text)
384+
385+
deffinished(self):
386+
self.outputter.FinishAndWrite(self.outfile)
387+
ifself.outfile!=sys.stdout:
388+
self.outfile.close()
389+
390+
351391
classJsonTestProgressIndicator(ProgressIndicator):
352392
def__init__(self, framework_name):
353393
super(JsonTestProgressIndicator, self).__init__()

0 commit comments

Comments
(0)