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

Side by Side Diff: Tools/Scripts/webkitpy/tool/bot/layouttestresultsreader.py

Issue 17639006: Remove committer list, bugzilla, watchlist code and transitive closure of stuff. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: merge on top of thakis' change in r153020 Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2013 Google Inc. All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are
5 # met:
6 #
7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer
11 # in the documentation and/or other materials provided with the
12 # distribution.
13 # * Neither the name of Google Inc. nor the names of its
14 # contributors may be used to endorse or promote products derived from
15 # this software without specific prior written permission.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 import logging
30
31 from webkitpy.common.net.layouttestresults import LayoutTestResults
32 from webkitpy.common.net.unittestresults import UnitTestResults
33 from webkitpy.tool.steps.runtests import RunTests
34
35 _log = logging.getLogger(__name__)
36
37
38 # FIXME: This class no longer has a clear purpose, and should probably
39 # be made part of Port, or renamed to LayoutTestResultsArchiver or something mor e fitting?
40 class LayoutTestResultsReader(object):
41 def __init__(self, host, results_directory, archive_directory):
42 self._host = host
43 self._results_directory = results_directory
44 self._archive_directory = archive_directory
45
46 # FIXME: This exists for mocking, but should instead be mocked via
47 # host.filesystem.read_text_file. They have different error handling at the moment.
48 def _read_file_contents(self, path):
49 try:
50 return self._host.filesystem.read_text_file(path)
51 except IOError, e: # File does not exist or can't be read.
52 return None
53
54 # FIXME: This logic should move to the port object.
55 def _create_layout_test_results(self):
56 results_path = self._host.filesystem.join(self._results_directory, "full _results.json")
57 results_html = self._read_file_contents(results_path)
58 if not results_html:
59 return None
60 return LayoutTestResults.results_from_string(results_html)
61
62 def _create_unit_test_results(self):
63 results_path = self._host.filesystem.join(self._results_directory, "webk it_unit_tests_output.xml")
64 results_xml = self._read_file_contents(results_path)
65 if not results_xml:
66 return None
67 return UnitTestResults.results_from_string(results_xml)
68
69 def results(self):
70 layout_test_results = self._create_layout_test_results()
71 unit_test_results = self._create_unit_test_results()
72 if layout_test_results:
73 # FIXME: This is used to detect if we had N failures due to
74 # N tests failing, or if we hit the "exit-after-n-failures" limit.
75 # These days we could just check for the "interrupted" key in result s.json instead!
76 layout_test_results.set_failure_limit_count(RunTests.NON_INTERACTIVE _FAILURE_LIMIT_COUNT)
77 if unit_test_results:
78 layout_test_results.add_unit_test_failures(unit_test_results)
79 return layout_test_results
80
81 def archive(self, patch):
82 filesystem = self._host.filesystem
83 workspace = self._host.workspace
84 results_directory = self._results_directory
85 results_name, _ = filesystem.splitext(filesystem.basename(results_direct ory))
86 # Note: We name the zip with the bug_id instead of patch_id to match wor k_item_log_path().
87 zip_path = workspace.find_unused_filename(self._archive_directory, "%s-% s" % (patch.bug_id(), results_name), "zip")
88 if not zip_path:
89 return None
90 if not filesystem.isdir(results_directory):
91 _log.info("%s does not exist, not archiving." % results_directory)
92 return None
93 archive = workspace.create_zip(filesystem.abspath(zip_path), filesystem. abspath(results_directory))
94 # Remove the results directory to prevent http logs, etc. from getting h uge between runs.
95 # We could have create_zip remove the original, but this is more explici t.
96 filesystem.rmtree(results_directory)
97 return archive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698