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

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

Issue 2271463002: Change rebaseline-cl command to trigger any necessary try jobs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: should -> will Created 4 years, 3 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 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import optparse 5 import optparse
6 import json 6 import json
7 7
8 from webkitpy.common.checkout.scm.scm_mock import MockSCM 8 from webkitpy.common.checkout.scm.scm_mock import MockSCM
9 from webkitpy.common.net.buildbot import Build 9 from webkitpy.common.net.buildbot import Build
10 from webkitpy.common.net.rietveld import Rietveld 10 from webkitpy.common.net.rietveld import Rietveld
(...skipping 29 matching lines...) Expand all
40 'third_party/WebKit/LayoutTests/fast/dom/prototype-taco.html ': {'status': 'M'}, 40 'third_party/WebKit/LayoutTests/fast/dom/prototype-taco.html ': {'status': 'M'},
41 }, 41 },
42 }), 42 }),
43 }) 43 })
44 self.tool.builders = BuilderList({ 44 self.tool.builders = BuilderList({
45 "MOCK Try Win": { 45 "MOCK Try Win": {
46 "port_name": "test-win-win7", 46 "port_name": "test-win-win7",
47 "specifiers": ["Win7", "Release"], 47 "specifiers": ["Win7", "Release"],
48 "is_try_builder": True, 48 "is_try_builder": True,
49 }, 49 },
50 "MOCK Try Mac": { 50 "MOCK Try Linux": {
51 "port_name": "test-mac-mac10.10", 51 "port_name": "test-mac-mac10.10",
52 "specifiers": ["Mac10.10", "Release"], 52 "specifiers": ["Mac10.10", "Release"],
53 "is_try_builder": True, 53 "is_try_builder": True,
54 }, 54 },
55 }) 55 })
56 self.command.rietveld = Rietveld(web) 56 self.command.rietveld = Rietveld(web)
57 self.git = MockSCM() 57 self.git = MockSCM()
58 self.git.get_issue_number = lambda: 'None' 58 self.git.get_issue_number = lambda: 'None'
59 self.command.git = lambda: self.git 59 self.command.git = lambda: self.git
60 60
61 @staticmethod 61 @staticmethod
62 def command_options(**kwargs): 62 def command_options(**kwargs):
63 options = { 63 options = {
64 'only_changed_tests': False, 64 'only_changed_tests': False,
65 'dry_run': False, 65 'dry_run': False,
66 'issue': None, 66 'issue': None,
67 'optimize': True, 67 'optimize': True,
68 'results_directory': None, 68 'results_directory': None,
69 'verbose': False, 69 'verbose': False,
70 'trigger_jobs': False,
70 } 71 }
71 options.update(kwargs) 72 options.update(kwargs)
72 return optparse.Values(dict(**options)) 73 return optparse.Values(dict(**options))
73 74
74 def test_execute_with_issue_number_given(self): 75 def test_execute_with_issue_number_given(self):
75 oc = OutputCapture() 76 oc = OutputCapture()
76 try: 77 try:
77 oc.capture_output() 78 oc.capture_output()
78 self.command.execute(self.command_options(issue=11112222), [], self. tool) 79 self.command.execute(self.command_options(issue=11112222), [], self. tool)
79 finally: 80 finally:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 # is in the list of failed tests, but not in the list of files modified 127 # is in the list of failed tests, but not in the list of files modified
127 # in the given CL; it should be included because all_tests is set to Tru e. 128 # in the given CL; it should be included because all_tests is set to Tru e.
128 self.assertMultiLineEqual( 129 self.assertMultiLineEqual(
129 logs, 130 logs,
130 ('Tests to rebaseline:\n' 131 ('Tests to rebaseline:\n'
131 ' fast/dom/prototype-inheritance.html: MOCK Try Win (5000)\n' 132 ' fast/dom/prototype-inheritance.html: MOCK Try Win (5000)\n'
132 ' fast/dom/prototype-taco.html: MOCK Try Win (5000)\n' 133 ' fast/dom/prototype-taco.html: MOCK Try Win (5000)\n'
133 'Rebaselining fast/dom/prototype-inheritance.html\n' 134 'Rebaselining fast/dom/prototype-inheritance.html\n'
134 'Rebaselining fast/dom/prototype-taco.html\n')) 135 'Rebaselining fast/dom/prototype-taco.html\n'))
135 136
137 def test_execute_with_trigger_jobs_option(self):
138 oc = OutputCapture()
139 try:
140 oc.capture_output()
141 self.command.execute(self.command_options(issue=11112222, trigger_jo bs=True), [], self.tool)
142 finally:
143 _, _, logs = oc.restore_output()
144 # A message is printed showing that some try jobs are triggered.
145 self.assertMultiLineEqual(
146 logs,
147 ('Triggering try jobs for: MOCK Try Linux\n'
148 'Tests to rebaseline:\n'
149 ' svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr .html: MOCK Try Win (5000)\n'
150 ' fast/dom/prototype-inheritance.html: MOCK Try Win (5000)\n'
151 ' fast/dom/prototype-taco.html: MOCK Try Win (5000)\n'
152 'Rebaselining fast/dom/prototype-inheritance.html\n'
153 'Rebaselining fast/dom/prototype-taco.html\n'
154 'Rebaselining svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDev iation-attr.html\n'))
155 # The first executive call, before the rebaseline calls, is triggering t ry jobs.
156 self.assertEqual(
157 self.tool.executive.calls,
158 [
159 ['git', 'cl', 'try', '-b', 'MOCK Try Linux'],
160 [
161 ['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', 'png',
162 'svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviatio n-attr.html'],
163 ['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', 'txt',
164 'fast/dom/prototype-inheritance.html'],
165 ['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', 'txt',
166 'fast/dom/prototype-taco.html']
167 ]
168 ])
169
136 def test_rebaseline_calls(self): 170 def test_rebaseline_calls(self):
137 """Tests the list of commands that are invoked when rebaseline is called .""" 171 """Tests the list of commands that are invoked when rebaseline is called ."""
138 # First write test contents to the mock filesystem so that 172 # First write test contents to the mock filesystem so that
139 # fast/dom/prototype-taco.html is considered a real test to rebaseline. 173 # fast/dom/prototype-taco.html is considered a real test to rebaseline.
140 # TODO(qyearsley): Change this to avoid accessing protected methods. 174 # TODO(qyearsley): Change this to avoid accessing protected methods.
141 # pylint: disable=protected-access 175 # pylint: disable=protected-access
142 port = self.tool.port_factory.get('test-win-win7') 176 port = self.tool.port_factory.get('test-win-win7')
143 self._write( 177 self._write(
144 port._filesystem.join(port.layout_tests_dir(), 'fast/dom/prototype-t aco.html'), 178 port._filesystem.join(port.layout_tests_dir(), 'fast/dom/prototype-t aco.html'),
145 'test contents') 179 'test contents')
146 180
147 self.command._rebaseline( 181 self.command._rebaseline(
148 self.command_options(issue=11112222), 182 self.command_options(issue=11112222),
149 {"fast/dom/prototype-taco.html": {Build("MOCK Try Win", 5000): ["txt ", "png"]}}) 183 {"fast/dom/prototype-taco.html": {Build("MOCK Try Win", 5000): ["txt ", "png"]}})
150 184
151 self.assertEqual( 185 self.assertEqual(
152 self.tool.executive.calls, 186 self.tool.executive.calls,
153 [ 187 [
154 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi xes', 'txt', 188 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi xes', 'txt',
155 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac o.html', '--build-number', '5000']], 189 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac o.html', '--build-number', '5000']],
156 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't xt', 190 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't xt',
157 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac o.html', '--build-number', '5000']], 191 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac o.html', '--build-number', '5000']],
158 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '-- suffixes', 'txt', 'fast/dom/prototype-taco.html']] 192 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '-- suffixes', 'txt', 'fast/dom/prototype-taco.html']]
159 ]) 193 ])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698