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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaselineserver.py

Issue 2069743002: Rebaseline the actual missing results only (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 # Copyright (c) 2010 Google Inc. All rights reserved. 1 # Copyright (c) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 13 matching lines...) Expand all
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 """Starts a local HTTP server which displays layout test failures (given a test 29 """Starts a local HTTP server which displays layout test failures (given a test
30 results directory), provides comparisons of expected and actual results (both 30 results directory), provides comparisons of expected and actual results (both
31 images and text) and allows one-click rebaselining of tests.""" 31 images and text) and allows one-click rebaselining of tests."""
32 32
33 from webkitpy.common.host import Host 33 from webkitpy.common.host import Host
34 from webkitpy.common.net.layouttestresults import for_each_test, JSONTestResult 34 from webkitpy.common.net.layouttestresults import LayoutTestResults
35 from webkitpy.layout_tests.layout_package import json_results_generator 35 from webkitpy.layout_tests.layout_package import json_results_generator
36 from webkitpy.tool.commands.abstractlocalservercommand import AbstractLocalServe rCommand 36 from webkitpy.tool.commands.abstractlocalservercommand import AbstractLocalServe rCommand
37 from webkitpy.tool.servers.rebaselineserver import get_test_baselines, Rebaselin eHTTPServer, STATE_NEEDS_REBASELINE 37 from webkitpy.tool.servers.rebaselineserver import get_test_baselines, Rebaselin eHTTPServer, STATE_NEEDS_REBASELINE
38 38
39 39
40 class TestConfig(object): 40 class TestConfig(object):
41 41
42 def __init__(self, test_port, layout_tests_directory, results_directory, pla tforms, host): 42 def __init__(self, test_port, layout_tests_directory, results_directory, pla tforms, host):
43 self.test_port = test_port 43 self.test_port = test_port
44 self.layout_tests_directory = layout_tests_directory 44 self.layout_tests_directory = layout_tests_directory
(...skipping 11 matching lines...) Expand all
56 argument_names = "/path/to/results/directory" 56 argument_names = "/path/to/results/directory"
57 57
58 server = RebaselineHTTPServer 58 server = RebaselineHTTPServer
59 59
60 def _gather_baselines(self, results_json): 60 def _gather_baselines(self, results_json):
61 # Rebaseline server and it's associated JavaScript expected the tests su btree to 61 # Rebaseline server and it's associated JavaScript expected the tests su btree to
62 # be key-value pairs instead of hierarchical. 62 # be key-value pairs instead of hierarchical.
63 # FIXME: make the rebaseline server use the hierarchical tree. 63 # FIXME: make the rebaseline server use the hierarchical tree.
64 new_tests_subtree = {} 64 new_tests_subtree = {}
65 65
66 def gather_baselines_for_test(test_name, result_dict): 66 def gather_baselines_for_test(result):
67 result = JSONTestResult(test_name, result_dict)
68 if result.did_pass_or_run_as_expected(): 67 if result.did_pass_or_run_as_expected():
69 return 68 return
69 result_dict = result.result_dict()
70 result_dict['state'] = STATE_NEEDS_REBASELINE 70 result_dict['state'] = STATE_NEEDS_REBASELINE
71 result_dict['baselines'] = get_test_baselines(test_name, self._test_ config) 71 result_dict['baselines'] = get_test_baselines(result.test_name(), se lf._test_config)
72 new_tests_subtree[test_name] = result_dict 72 new_tests_subtree[result.test_name()] = result_dict
73 73
74 for_each_test(results_json['tests'], gather_baselines_for_test) 74 LayoutTestResults(results_json).for_each_test(gather_baselines_for_test)
75 results_json['tests'] = new_tests_subtree 75 results_json['tests'] = new_tests_subtree
76 76
77 def _prepare_config(self, options, args, tool): 77 def _prepare_config(self, options, args, tool):
78 results_directory = args[0] 78 results_directory = args[0]
79 host = Host() 79 host = Host()
80 host.initialize_scm() 80 host.initialize_scm()
81 81
82 print 'Parsing full_results.json...' 82 print 'Parsing full_results.json...'
83 results_json_path = host.filesystem.join(results_directory, 'full_result s.json') 83 results_json_path = host.filesystem.join(results_directory, 'full_result s.json')
84 results_json = json_results_generator.load_json(host.filesystem, results _json_path) 84 results_json = json_results_generator.load_json(host.filesystem, results _json_path)
85 85
86 port = tool.port_factory.get() 86 port = tool.port_factory.get()
87 layout_tests_directory = port.layout_tests_dir() 87 layout_tests_directory = port.layout_tests_dir()
88 platforms = host.filesystem.listdir(host.filesystem.join(layout_tests_di rectory, 'platform')) 88 platforms = host.filesystem.listdir(host.filesystem.join(layout_tests_di rectory, 'platform'))
89 self._test_config = TestConfig(port, layout_tests_directory, results_dir ectory, platforms, host) 89 self._test_config = TestConfig(port, layout_tests_directory, results_dir ectory, platforms, host)
90 90
91 print 'Gathering current baselines...' 91 print 'Gathering current baselines...'
92 self._gather_baselines(results_json) 92 self._gather_baselines(results_json)
93 93
94 return { 94 return {
95 'test_config': self._test_config, 95 'test_config': self._test_config,
96 "results_json": results_json, 96 "results_json": results_json,
97 "platforms_json": { 97 "platforms_json": {
98 'platforms': platforms, 98 'platforms': platforms,
99 'defaultPlatform': port.name(), 99 'defaultPlatform': port.name(),
100 }, 100 },
101 } 101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698