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

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

Issue 2776543003: Change rebaseline-test-internal to take port name option. (Closed)
Patch Set: Add example port name and builder in help strings Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 json
5 import optparse 6 import optparse
6 import unittest 7 import unittest
7 8
8 from webkitpy.common.net.buildbot import Build 9 from webkitpy.common.net.buildbot import Build
9 from webkitpy.common.net.layout_test_results import LayoutTestResults 10 from webkitpy.common.net.layout_test_results import LayoutTestResults
10 from webkitpy.common.system.executive_mock import MockExecutive 11 from webkitpy.common.system.executive_mock import MockExecutive
11 from webkitpy.common.system.output_capture import OutputCapture 12 from webkitpy.common.system.output_capture import OutputCapture
12 from webkitpy.layout_tests.builder_list import BuilderList 13 from webkitpy.layout_tests.builder_list import BuilderList
13 from webkitpy.layout_tests.port.factory_mock import MockPortFactory 14 from webkitpy.layout_tests.port.factory_mock import MockPortFactory
14 from webkitpy.tool.commands.rebaseline import ( 15 from webkitpy.tool.commands.rebaseline import (
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 command_constructor = CopyExistingBaselinesInternal 109 command_constructor = CopyExistingBaselinesInternal
109 110
110 def setUp(self): 111 def setUp(self):
111 super(TestCopyExistingBaselinesInternal, self).setUp() 112 super(TestCopyExistingBaselinesInternal, self).setUp()
112 113
113 def options(self, **kwargs): 114 def options(self, **kwargs):
114 options_dict = { 115 options_dict = {
115 'results_directory': None, 116 'results_directory': None,
116 'suffixes': 'txt', 117 'suffixes': 'txt',
117 'verbose': False, 118 'verbose': False,
119 'port_name': None,
118 } 120 }
119 options_dict.update(kwargs) 121 options_dict.update(kwargs)
120 return optparse.Values(options_dict) 122 return optparse.Values(options_dict)
121 123
122 def baseline_path(self, path_from_layout_test_dir): 124 def baseline_path(self, path_from_layout_test_dir):
123 port = self.tool.port_factory.get() 125 port = self.tool.port_factory.get()
124 return self.tool.filesystem.join(port.layout_tests_dir(), path_from_layo ut_test_dir) 126 return self.tool.filesystem.join(port.layout_tests_dir(), path_from_layo ut_test_dir)
125 127
126 # The tests in this class all depend on the fall-back path graph 128 # The tests in this class all depend on the fall-back path graph
127 # that is set up in |TestPort.FALLBACK_PATHS|. 129 # that is set up in |TestPort.FALLBACK_PATHS|.
128 130
129 def test_copy_baseline_mac_newer_to_older_version(self): 131 def test_copy_baseline_mac_newer_to_older_version(self):
130 # The test-mac-mac10.11 baseline is copied over to the test-mac-mac10.10 132 # The test-mac-mac10.11 baseline is copied over to the test-mac-mac10.10
131 # baseline directory because test-mac-mac10.10 is the "immediate 133 # baseline directory because test-mac-mac10.10 is the "immediate
132 # predecessor" in the fall-back graph. 134 # predecessor" in the fall-back graph.
133 self._write( 135 self._write(
134 self.baseline_path('platform/test-mac-mac10.11/failures/expected/ima ge-expected.txt'), 136 self.baseline_path('platform/test-mac-mac10.11/failures/expected/ima ge-expected.txt'),
135 'original test-mac-mac10.11 result') 137 'original test-mac-mac10.11 result')
136 self.assertFalse(self.tool.filesystem.exists( 138 self.assertFalse(self.tool.filesystem.exists(
137 self.baseline_path('platform/test-mac-mac10.10/failures/expected/ima ge-expected.txt'))) 139 self.baseline_path('platform/test-mac-mac10.10/failures/expected/ima ge-expected.txt')))
138 140
139 self.command.execute(self.options(builder='MOCK Mac10.11', test='failure s/expected/image.html'), [], self.tool) 141 self.command.execute(self.options(port_name='test-mac-mac10.11', test='f ailures/expected/image.html'), [], self.tool)
140 142
141 self.assertEqual( 143 self.assertEqual(
142 self._read(self.baseline_path('platform/test-mac-mac10.11/failures/e xpected/image-expected.txt')), 144 self._read(self.baseline_path('platform/test-mac-mac10.11/failures/e xpected/image-expected.txt')),
143 'original test-mac-mac10.11 result') 145 'original test-mac-mac10.11 result')
144 self.assertEqual( 146 self.assertEqual(
145 self._read(self.baseline_path('platform/test-mac-mac10.10/failures/e xpected/image-expected.txt')), 147 self._read(self.baseline_path('platform/test-mac-mac10.10/failures/e xpected/image-expected.txt')),
146 'original test-mac-mac10.11 result') 148 'original test-mac-mac10.11 result')
147 149
148 def test_copy_baseline_win10_to_linux_trusty_and_win7(self): 150 def test_copy_baseline_to_multiple_immediate_predecessors(self):
149 # The test-win-win10 baseline is copied over to the test-linux-trusty 151 # The test-win-win10 baseline is copied over to the test-linux-trusty
150 # and test-win-win7 baseline paths, since both of these are "immediate 152 # and test-win-win7 baseline paths, since both of these are "immediate
151 # predecessors". 153 # predecessors".
152 self._write( 154 self._write(
153 self.baseline_path('platform/test-win-win10/failures/expected/image- expected.txt'), 155 self.baseline_path('platform/test-win-win10/failures/expected/image- expected.txt'),
154 'original test-win-win10 result') 156 'original test-win-win10 result')
155 self.assertFalse(self.tool.filesystem.exists( 157 self.assertFalse(self.tool.filesystem.exists(
156 self.baseline_path('platform/test-linux-trusty/failures/expected/ima ge-expected.txt'))) 158 self.baseline_path('platform/test-linux-trusty/failures/expected/ima ge-expected.txt')))
157 159
158 self.command.execute(self.options(builder='MOCK Win10', test='failures/e xpected/image.html'), [], self.tool) 160 self.command.execute(self.options(port_name='test-win-win10', test='fail ures/expected/image.html'), [], self.tool)
159 161
160 self.assertEqual( 162 self.assertEqual(
161 self._read(self.baseline_path('platform/test-win-win10/failures/expe cted/image-expected.txt')), 163 self._read(self.baseline_path('platform/test-win-win10/failures/expe cted/image-expected.txt')),
162 'original test-win-win10 result') 164 'original test-win-win10 result')
163 self.assertEqual( 165 self.assertEqual(
164 self._read(self.baseline_path('platform/test-linux-trusty/failures/e xpected/image-expected.txt')), 166 self._read(self.baseline_path('platform/test-linux-trusty/failures/e xpected/image-expected.txt')),
165 'original test-win-win10 result') 167 'original test-win-win10 result')
166 self.assertEqual( 168 self.assertEqual(
167 self._read(self.baseline_path('platform/test-linux-trusty/failures/e xpected/image-expected.txt')), 169 self._read(self.baseline_path('platform/test-linux-trusty/failures/e xpected/image-expected.txt')),
168 'original test-win-win10 result') 170 'original test-win-win10 result')
169 171
170 def test_no_copy_existing_baseline(self): 172 def test_no_copy_existing_baseline(self):
171 # If a baseline exists already for an "immediate prdecessor" baseline 173 # If a baseline exists already for an "immediate prdecessor" baseline
172 # directory, (e.g. test-linux-trusty), then no "immediate successor" 174 # directory, (e.g. test-linux-trusty), then no "immediate successor"
173 # baselines (e.g. test-win-win10) are copied over. 175 # baselines (e.g. test-win-win10) are copied over.
174 self._write( 176 self._write(
175 self.baseline_path('platform/test-win-win10/failures/expected/image- expected.txt'), 177 self.baseline_path('platform/test-win-win10/failures/expected/image- expected.txt'),
176 'original test-win-win10 result') 178 'original test-win-win10 result')
177 self._write( 179 self._write(
178 self.baseline_path('platform/test-linux-trusty/failures/expected/ima ge-expected.txt'), 180 self.baseline_path('platform/test-linux-trusty/failures/expected/ima ge-expected.txt'),
179 'original test-linux-trusty result') 181 'original test-linux-trusty result')
180 182
181 self.command.execute(self.options(builder='MOCK Win10', test='failures/e xpected/image.html'), [], self.tool) 183 self.command.execute(self.options(port_name='test-win-win10', test='fail ures/expected/image.html'), [], self.tool)
182 184
183 self.assertEqual( 185 self.assertEqual(
184 self._read(self.baseline_path('platform/test-win-win10/failures/expe cted/image-expected.txt')), 186 self._read(self.baseline_path('platform/test-win-win10/failures/expe cted/image-expected.txt')),
185 'original test-win-win10 result') 187 'original test-win-win10 result')
186 self.assertEqual( 188 self.assertEqual(
187 self._read(self.baseline_path('platform/test-linux-trusty/failures/e xpected/image-expected.txt')), 189 self._read(self.baseline_path('platform/test-linux-trusty/failures/e xpected/image-expected.txt')),
188 'original test-linux-trusty result') 190 'original test-linux-trusty result')
189 191
190 def test_no_copy_skipped_test(self): 192 def test_no_copy_skipped_test(self):
191 # If a test is skipped on some platform, no baselines are copied over 193 # If a test is skipped on some platform, no baselines are copied over
192 # to that directory. In this example, the test is skipped on linux, 194 # to that directory. In this example, the test is skipped on linux,
193 # so the test-win-win10 baseline is not copied over. 195 # so the test-win-win10 baseline is not copied over.
194 port = self.tool.port_factory.get('test-win-win10') 196 port = self.tool.port_factory.get('test-win-win10')
195 self._write( 197 self._write(
196 self.baseline_path('platform/test-win-win10/failures/expected/image- expected.txt'), 198 self.baseline_path('platform/test-win-win10/failures/expected/image- expected.txt'),
197 'original test-win-win10 result') 199 'original test-win-win10 result')
198 self._write( 200 self._write(
199 port.path_to_generic_test_expectations_file(), 201 port.path_to_generic_test_expectations_file(),
200 ('[ Win ] failures/expected/image.html [ Failure ]\n' 202 ('[ Win ] failures/expected/image.html [ Failure ]\n'
201 '[ Linux ] failures/expected/image.html [ Skip ]\n')) 203 '[ Linux ] failures/expected/image.html [ Skip ]\n'))
202 204
203 self.command.execute(self.options(builder='MOCK Win10', test='failures/e xpected/image.html'), [], self.tool) 205 self.command.execute(self.options(port_name='test-win-win10', test='fail ures/expected/image.html'), [], self.tool)
204 206
205 self.assertFalse( 207 self.assertFalse(
206 self.tool.filesystem.exists(self.baseline_path('platform/test-linux- trusty/failures/expected/image-expected.txt'))) 208 self.tool.filesystem.exists(self.baseline_path('platform/test-linux- trusty/failures/expected/image-expected.txt')))
207 209
208 def test_port_for_primary_baseline(self): 210 def test_port_for_primary_baseline(self):
209 self.assertEqual(self.command._port_for_primary_baseline('test-linux-tru sty').name(), 'test-linux-trusty') 211 self.assertEqual(self.command._port_for_primary_baseline('test-linux-tru sty').name(), 'test-linux-trusty')
210 self.assertEqual(self.command._port_for_primary_baseline('test-mac-mac10 .11').name(), 'test-mac-mac10.11') 212 self.assertEqual(self.command._port_for_primary_baseline('test-mac-mac10 .11').name(), 'test-mac-mac10.11')
211 213
212 def test_port_for_primary_baseline_not_found(self): 214 def test_port_for_primary_baseline_not_found(self):
213 with self.assertRaises(Exception): 215 with self.assertRaises(Exception):
214 self.command._port_for_primary_baseline('test-foo-foo4.7') 216 self.command._port_for_primary_baseline('test-foo-foo4.7')
215 217
216 218
217 class TestRebaselineTest(BaseTestCase): 219 class TestRebaselineTest(BaseTestCase):
218 command_constructor = RebaselineTest # AKA webkit-patch rebaseline-test-int ernal 220 command_constructor = RebaselineTest # AKA webkit-patch rebaseline-test-int ernal
219 221
220 def setUp(self): 222 def setUp(self):
221 super(TestRebaselineTest, self).setUp() 223 super(TestRebaselineTest, self).setUp()
222 224
223 @staticmethod 225 @staticmethod
224 def options(**kwargs): 226 def options(**kwargs):
225 return optparse.Values(dict({ 227 return optparse.Values(dict({
226 'builder': 'MOCK Mac10.11', 228 'builder': 'MOCK Mac10.11',
229 'port_name': None,
227 'test': 'userscripts/another-test.html', 230 'test': 'userscripts/another-test.html',
228 'suffixes': 'txt', 231 'suffixes': 'txt',
229 'results_directory': None, 232 'results_directory': None,
230 'build_number': None 233 'build_number': None
231 }, **kwargs)) 234 }, **kwargs))
232 235
233 def test_baseline_directory(self): 236 def test_baseline_directory(self):
234 command = self.command 237 command = self.command
235 self.assertMultiLineEqual(command._baseline_directory('MOCK Mac10.11'), 238 self.assertMultiLineEqual(command._baseline_directory('MOCK Mac10.11'),
236 '/test.checkout/LayoutTests/platform/test-mac- mac10.11') 239 '/test.checkout/LayoutTests/platform/test-mac- mac10.11')
(...skipping 20 matching lines...) Expand all
257 [self.WEB_PREFIX + '/userscripts/another-test-actu al.png', 260 [self.WEB_PREFIX + '/userscripts/another-test-actu al.png',
258 self.WEB_PREFIX + '/userscripts/another-test-actu al.wav', 261 self.WEB_PREFIX + '/userscripts/another-test-actu al.wav',
259 self.WEB_PREFIX + '/userscripts/another-test-actu al.txt']) 262 self.WEB_PREFIX + '/userscripts/another-test-actu al.txt'])
260 new_expectations = self._read(self.mac_expectations_path) 263 new_expectations = self._read(self.mac_expectations_path)
261 self.assertMultiLineEqual( 264 self.assertMultiLineEqual(
262 new_expectations, 265 new_expectations,
263 ('Bug(B) [ Mac Linux Win7 Debug ] fast/dom/Window/window-postmessage -clone-really-deep-array.html [ Pass ]\n' 266 ('Bug(B) [ Mac Linux Win7 Debug ] fast/dom/Window/window-postmessage -clone-really-deep-array.html [ Pass ]\n'
264 'Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failu re ]\n')) 267 'Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failu re ]\n'))
265 268
266 def test_rebaseline_test(self): 269 def test_rebaseline_test(self):
267 self.command._rebaseline_test('MOCK Trusty', 'userscripts/another-test.h tml', 'txt', self.WEB_PREFIX) 270 self.command._rebaseline_test('test-linux-trusty', 'userscripts/another- test.html', 'txt', self.WEB_PREFIX)
268 self.assertItemsEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/u serscripts/another-test-actual.txt']) 271 self.assertItemsEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/u serscripts/another-test-actual.txt'])
269 272
270 def test_rebaseline_test_with_results_directory(self): 273 def test_rebaseline_test_with_results_directory(self):
271 self._write('userscripts/another-test.html', 'test data') 274 self._write('userscripts/another-test.html', 'test data')
272 self._write( 275 self._write(
273 self.mac_expectations_path, 276 self.mac_expectations_path,
274 ('Bug(x) [ Mac ] userscripts/another-test.html [ Failure ]\n' 277 ('Bug(x) [ Mac ] userscripts/another-test.html [ Failure ]\n'
275 'bug(z) [ Linux ] userscripts/another-test.html [ Failure ]\n')) 278 'bug(z) [ Linux ] userscripts/another-test.html [ Failure ]\n'))
276 self.command._rebaseline_test_and_update_expectations(self.options(resul ts_directory='/tmp')) 279 self.command._rebaseline_test_and_update_expectations(self.options(resul ts_directory='/tmp'))
277 self.assertItemsEqual(self.tool.web.urls_fetched, ['file:///tmp/userscri pts/another-test-actual.txt']) 280 self.assertItemsEqual(self.tool.web.urls_fetched, ['file:///tmp/userscri pts/another-test-actual.txt'])
(...skipping 14 matching lines...) Expand all
292 port.host.filesystem.join( 295 port.host.filesystem.join(
293 port.layout_tests_dir(), 296 port.layout_tests_dir(),
294 'platform/test-win-win10/failures/expected/image-expected.txt'), 297 'platform/test-win-win10/failures/expected/image-expected.txt'),
295 'original win10 result') 298 'original win10 result')
296 299
297 oc = OutputCapture() 300 oc = OutputCapture()
298 try: 301 try:
299 options = optparse.Values({ 302 options = optparse.Values({
300 'optimize': True, 303 'optimize': True,
301 'builder': 'MOCK Win10', 304 'builder': 'MOCK Win10',
305 'port_name': None,
302 'suffixes': 'txt', 306 'suffixes': 'txt',
303 'verbose': True, 307 'verbose': True,
304 'test': 'failures/expected/image.html', 308 'test': 'failures/expected/image.html',
305 'results_directory': None, 309 'results_directory': None,
306 'build_number': None 310 'build_number': None
307 }) 311 })
308 oc.capture_output() 312 oc.capture_output()
309 self.command.execute(options, [], self.tool) 313 self.command.execute(options, [], self.tool)
310 finally: 314 finally:
311 out, _, _ = oc.restore_output() 315 out, _, _ = oc.restore_output()
312 316
313 self.assertMultiLineEqual( 317 self.assertMultiLineEqual(
314 self._read(self.tool.filesystem.join( 318 self._read(self.tool.filesystem.join(
315 port.layout_tests_dir(), 319 port.layout_tests_dir(),
316 'platform/test-win-win10/failures/expected/image-expected.txt')) , 320 'platform/test-win-win10/failures/expected/image-expected.txt')) ,
317 'MOCK Web result, convert 404 to None=True') 321 'MOCK Web result, convert 404 to None=True')
318 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join( 322 self.assertFalse(self.tool.filesystem.exists(self.tool.filesystem.join(
319 port.layout_tests_dir(), 'platform/test-win-win7/failures/expected/i mage-expected.txt'))) 323 port.layout_tests_dir(), 'platform/test-win-win7/failures/expected/i mage-expected.txt')))
320 self.assertMultiLineEqual( 324 self.assertMultiLineEqual(
321 out, '{"remove-lines": [{"test": "failures/expected/image.html", "bu ilder": "MOCK Win10"}]}\n') 325 out, '{"remove-lines": [{"test": "failures/expected/image.html", "po rt_name": "test-win-win10"}]}\n')
322 326
323 327
324 class TestAbstractParallelRebaselineCommand(BaseTestCase): 328 class TestAbstractParallelRebaselineCommand(BaseTestCase):
325 command_constructor = AbstractParallelRebaselineCommand 329 command_constructor = AbstractParallelRebaselineCommand
326 330
327 def test_builders_to_fetch_from(self): 331 def test_builders_to_fetch_from(self):
328 builders_to_fetch = self.command._builders_to_fetch_from( 332 builders_to_fetch = self.command._builders_to_fetch_from(
329 ['MOCK Win10', 'MOCK Win7 (dbg)(1)', 'MOCK Win7 (dbg)(2)', 'MOCK Win 7']) 333 ['MOCK Win10', 'MOCK Win7 (dbg)(1)', 'MOCK Win7 (dbg)(2)', 'MOCK Win 7'])
330 self.assertEqual(builders_to_fetch, {'MOCK Win7', 'MOCK Win10'}) 334 self.assertEqual(builders_to_fetch, {'MOCK Win7', 'MOCK Win10'})
331 335
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 self._setup_mock_build_data() 412 self._setup_mock_build_data()
409 413
410 self._write('userscripts/first-test.html', 'Dummy test contents') 414 self._write('userscripts/first-test.html', 'Dummy test contents')
411 test_baseline_set = TestBaselineSet(self.tool) 415 test_baseline_set = TestBaselineSet(self.tool)
412 test_baseline_set.add('userscripts/first-test.html', Build('MOCK Win7')) 416 test_baseline_set.add('userscripts/first-test.html', Build('MOCK Win7'))
413 self.command.rebaseline(self.options(), test_baseline_set) 417 self.command.rebaseline(self.options(), test_baseline_set)
414 418
415 self.assertEqual( 419 self.assertEqual(
416 self.tool.executive.calls, 420 self.tool.executive.calls,
417 [ 421 [
418 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi xes', 'txt,png', 422 [[
419 '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.ht ml', '--verbose']], 423 'python', 'echo', 'copy-existing-baselines-internal',
420 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't xt,png', 424 '--verbose',
421 '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.ht ml', '--verbose']], 425 '--test', 'userscripts/first-test.html',
422 [['python', 'echo', 'optimize-baselines', '--suffixes', 'txt,png ', 426 '--suffixes', 'txt,png',
423 'userscripts/first-test.html', '--verbose']] 427 '--port-name', 'test-win-win7',
428 ]],
429 [[
430 'python', 'echo', 'rebaseline-test-internal',
431 '--verbose',
432 '--test', 'userscripts/first-test.html',
433 '--suffixes', 'txt,png',
434 '--port-name', 'test-win-win7',
435 '--builder', 'MOCK Win7',
436 ]],
437 [[
438 'python', 'echo', 'optimize-baselines',
439 '--verbose',
440 '--suffixes', 'txt,png',
441 'userscripts/first-test.html',
442 ]]
424 ]) 443 ])
425 444
426 def test_rebaseline_debug(self): 445 def test_rebaseline_debug(self):
427 self._setup_mock_build_data() 446 self._setup_mock_build_data()
428 self._write('userscripts/first-test.html', 'Dummy test contents') 447 self._write('userscripts/first-test.html', 'Dummy test contents')
429 test_baseline_set = TestBaselineSet(self.tool) 448 test_baseline_set = TestBaselineSet(self.tool)
430 test_baseline_set.add('userscripts/first-test.html', Build('MOCK Win7 (d bg)')) 449 test_baseline_set.add('userscripts/first-test.html', Build('MOCK Win7 (d bg)'))
431 450
432 self.command.rebaseline(self.options(), test_baseline_set) 451 self.command.rebaseline(self.options(), test_baseline_set)
433 452
434 self.assertEqual( 453 self.assertEqual(
435 self.tool.executive.calls, 454 self.tool.executive.calls,
436 [ 455 [
437 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi xes', 'txt,png', 456 [[
438 '--builder', 'MOCK Win7 (dbg)', '--test', 'userscripts/first-t est.html', '--verbose']], 457 'python', 'echo', 'copy-existing-baselines-internal',
439 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't xt,png', '--builder', 458 '--verbose',
440 'MOCK Win7 (dbg)', '--test', 'userscripts/first-test.html', '- -verbose']], 459 '--test', 'userscripts/first-test.html',
441 [['python', 'echo', 'optimize-baselines', '--suffixes', 'txt,png ', 460 '--suffixes', 'txt,png',
442 'userscripts/first-test.html', '--verbose']] 461 '--port-name', 'test-win-win7',
462 ]],
463 [[
464 'python', 'echo', 'rebaseline-test-internal',
465 '--verbose',
466 '--test', 'userscripts/first-test.html',
467 '--suffixes', 'txt,png',
468 '--port-name', 'test-win-win7',
469 '--builder', 'MOCK Win7 (dbg)',
470 ]],
471 [[
472 'python', 'echo', 'optimize-baselines',
473 '--verbose',
474 '--suffixes', 'txt,png',
475 'userscripts/first-test.html',
476 ]]
443 ]) 477 ])
444 478
445 def test_no_optimize(self): 479 def test_no_optimize(self):
446 self._setup_mock_build_data() 480 self._setup_mock_build_data()
447 self._write('userscripts/first-test.html', 'Dummy test contents') 481 self._write('userscripts/first-test.html', 'Dummy test contents')
448 test_baseline_set = TestBaselineSet(self.tool) 482 test_baseline_set = TestBaselineSet(self.tool)
449 test_baseline_set.add('userscripts/first-test.html', Build('MOCK Win7')) 483 test_baseline_set.add('userscripts/first-test.html', Build('MOCK Win7'))
450 self.command.rebaseline(self.options(optimize=False), test_baseline_set) 484 self.command.rebaseline(self.options(optimize=False), test_baseline_set)
451 485
452 self.assertEqual( 486 self.assertEqual(
453 self.tool.executive.calls, 487 self.tool.executive.calls,
454 [ 488 [
455 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi xes', 'txt,png', 489 [[
456 '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.ht ml', '--verbose']], 490 'python', 'echo', 'copy-existing-baselines-internal',
457 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't xt,png', 491 '--verbose',
458 '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.ht ml', '--verbose']] 492 '--test', 'userscripts/first-test.html',
493 '--suffixes', 'txt,png',
494 '--port-name', 'test-win-win7',
495
496 ]],
497 [[
498 'python', 'echo', 'rebaseline-test-internal',
499 '--verbose',
500 '--test', 'userscripts/first-test.html',
501 '--suffixes', 'txt,png',
502 '--port-name', 'test-win-win7',
503 '--builder', 'MOCK Win7',
504 ]]
459 ]) 505 ])
460 506
461 def test_results_directory(self): 507 def test_results_directory(self):
462 self._setup_mock_build_data() 508 self._setup_mock_build_data()
463 self._write('userscripts/first-test.html', 'Dummy test contents') 509 self._write('userscripts/first-test.html', 'Dummy test contents')
464 test_baseline_set = TestBaselineSet(self.tool) 510 test_baseline_set = TestBaselineSet(self.tool)
465 test_baseline_set.add('userscripts/first-test.html', Build('MOCK Win7')) 511 test_baseline_set.add('userscripts/first-test.html', Build('MOCK Win7'))
466 self.command.rebaseline(self.options(optimize=False, results_directory=' /tmp'), test_baseline_set) 512 self.command.rebaseline(self.options(optimize=False, results_directory=' /tmp'), test_baseline_set)
467 513
468 self.assertEqual( 514 self.assertEqual(
469 self.tool.executive.calls, 515 self.tool.executive.calls,
470 [ 516 [
471 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi xes', 'txt,png', 517 [[
472 '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.ht ml', '--verbose']], 518 'python', 'echo', 'copy-existing-baselines-internal',
473 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't xt,png', 519 '--verbose',
474 '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.ht ml', '--verbose', '--results-directory', '/tmp']] 520 '--test', 'userscripts/first-test.html',
521 '--suffixes', 'txt,png',
522 '--port-name', 'test-win-win7',
523 ]],
524 [[
525 'python', 'echo', 'rebaseline-test-internal',
526 '--verbose',
527 '--test', 'userscripts/first-test.html',
528 '--suffixes', 'txt,png',
529 '--port-name', 'test-win-win7',
530 '--builder', 'MOCK Win7',
531 '--results-directory', '/tmp']]
475 ]) 532 ])
476 533
477 def test_unstaged_baselines(self): 534 def test_unstaged_baselines(self):
478 git = self.tool.git() 535 git = self.tool.git()
479 git.unstaged_changes = lambda: { 536 git.unstaged_changes = lambda: {
480 'third_party/WebKit/LayoutTests/x/foo-expected.txt': 'M', 537 'third_party/WebKit/LayoutTests/x/foo-expected.txt': 'M',
481 'third_party/WebKit/LayoutTests/x/foo-expected.something': '?', 538 'third_party/WebKit/LayoutTests/x/foo-expected.something': '?',
482 'third_party/WebKit/LayoutTests/x/foo-expected.png': '?', 539 'third_party/WebKit/LayoutTests/x/foo-expected.png': '?',
483 'third_party/WebKit/LayoutTests/x/foo.html': 'M', 540 'third_party/WebKit/LayoutTests/x/foo.html': 'M',
484 'docs/something.md': '?', 541 'docs/something.md': '?',
485 } 542 }
486 self.assertEqual( 543 self.assertEqual(
487 self.command.unstaged_baselines(), 544 self.command.unstaged_baselines(),
488 [ 545 [
489 '/mock-checkout/third_party/WebKit/LayoutTests/x/foo-expected.pn g', 546 '/mock-checkout/third_party/WebKit/LayoutTests/x/foo-expected.pn g',
490 '/mock-checkout/third_party/WebKit/LayoutTests/x/foo-expected.tx t', 547 '/mock-checkout/third_party/WebKit/LayoutTests/x/foo-expected.tx t',
491 ]) 548 ])
492 549
493 550
494 class TestRebaselineUpdatesExpectationsFiles(BaseTestCase): 551 class TestRebaselineUpdatesExpectationsFiles(BaseTestCase):
495 """Tests for the logic related to updating the test expectations file.""" 552 """Tests for the logic related to updating the test expectations file."""
496 command_constructor = Rebaseline 553 command_constructor = Rebaseline
497 554
498 def setUp(self): 555 def setUp(self):
499 super(TestRebaselineUpdatesExpectationsFiles, self).setUp() 556 super(TestRebaselineUpdatesExpectationsFiles, self).setUp()
500 self.tool.executive = MockExecutive() 557 self.tool.executive = MockExecutive()
501 558
502 def mock_run_command(*args, **kwargs): # pylint: disable=unused-argumen t 559 def mock_run_command(*args, **kwargs): # pylint: disable=unused-argumen t
503 return '{"add": [], "remove-lines": [{"test": "userscripts/first-tes t.html", "builder": "MOCK Mac10.11"}]}\n' 560 return '{"add": [], "remove-lines": [{"test": "userscripts/first-tes t.html", "port_name": "test-mac-mac10.11"}]}\n'
504 self.tool.executive.run_command = mock_run_command 561 self.tool.executive.run_command = mock_run_command
505 562
506 @staticmethod 563 @staticmethod
507 def options(): 564 def options():
508 return optparse.Values({ 565 return optparse.Values({
509 'optimize': False, 566 'optimize': False,
510 'verbose': True, 567 'verbose': True,
511 'results_directory': None 568 'results_directory': None
512 }) 569 })
513 570
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 'optimize': False, 674 'optimize': False,
618 'builders': None, 675 'builders': None,
619 'suffixes': 'txt,png', 676 'suffixes': 'txt,png',
620 'verbose': True 677 'verbose': True
621 }) 678 })
622 self.command.execute(options, ['userscripts/first-test.html'], self.tool ) 679 self.command.execute(options, ['userscripts/first-test.html'], self.tool )
623 680
624 self.assertEqual( 681 self.assertEqual(
625 self.tool.executive.calls, 682 self.tool.executive.calls,
626 [ 683 [
627 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi xes', 'txt,png', 684 [[
628 '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.ht ml', '--verbose']], 685 'python', 'echo', 'copy-existing-baselines-internal',
629 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't xt,png', 686 '--verbose',
630 '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.ht ml', '--verbose']] 687 '--test', 'userscripts/first-test.html',
688 '--suffixes', 'txt,png',
689 '--port-name', 'test-win-win7',
690 ]],
691 [[
692 'python', 'echo', 'rebaseline-test-internal',
693 '--verbose',
694 '--test', 'userscripts/first-test.html',
695 '--suffixes', 'txt,png',
696 '--port-name', 'test-win-win7',
697 '--builder', 'MOCK Win7',
698 ]]
631 ]) 699 ])
632 700
633 def test_rebaseline_directory(self): 701 def test_rebaseline_directory(self):
634 self.command._builders_to_pull_from = lambda: ['MOCK Win7'] 702 self.command._builders_to_pull_from = lambda: ['MOCK Win7']
635 703
636 self._write('userscripts/first-test.html', 'test data') 704 self._write('userscripts/first-test.html', 'test data')
637 self._write('userscripts/second-test.html', 'test data') 705 self._write('userscripts/second-test.html', 'test data')
638 706
639 self._setup_mock_build_data() 707 self._setup_mock_build_data()
640 options = optparse.Values({ 708 options = optparse.Values({
641 'results_directory': False, 709 'results_directory': False,
642 'optimize': False, 710 'optimize': False,
643 'builders': None, 711 'builders': None,
644 'suffixes': 'txt,png', 712 'suffixes': 'txt,png',
645 'verbose': True 713 'verbose': True
646 }) 714 })
647 self.command.execute(options, ['userscripts'], self.tool) 715 self.command.execute(options, ['userscripts'], self.tool)
648 716
649 self.assertEqual( 717 self.assertEqual(
650 self.tool.executive.calls, 718 self.tool.executive.calls,
651 [ 719 [
652 [ 720 [
653 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt,png', 721 [
654 '--builder', 'MOCK Win7', '--test', 'userscripts/first-test .html', '--verbose'], 722 'python', 'echo', 'copy-existing-baselines-internal',
655 ['python', 'echo', 'copy-existing-baselines-internal', '--su ffixes', 'txt,png', 723 '--verbose',
656 '--builder', 'MOCK Win7', '--test', 'userscripts/second-tes t.html', '--verbose'] 724 '--test', 'userscripts/first-test.html',
725 '--suffixes', 'txt,png',
726 '--port-name', 'test-win-win7',
727 ],
728 [
729 'python', 'echo', 'copy-existing-baselines-internal',
730 '--verbose',
731 '--test', 'userscripts/second-test.html',
732 '--suffixes', 'txt,png',
733 '--port-name', 'test-win-win7',
734 ]
657 ], 735 ],
658 [ 736 [
659 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', 737 [
660 '--builder', 'MOCK Win7', '--test', 'userscripts/first-test .html', '--verbose'], 738 'python', 'echo', 'rebaseline-test-internal',
661 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', 739 '--verbose',
662 '--builder', 'MOCK Win7', '--test', 'userscripts/second-tes t.html', '--verbose'] 740 '--test', 'userscripts/first-test.html',
741 '--suffixes', 'txt,png',
742 '--port-name', 'test-win-win7',
743 '--builder', 'MOCK Win7',
744 ],
745 [
746 'python', 'echo', 'rebaseline-test-internal',
747 '--verbose',
748 '--test', 'userscripts/second-test.html',
749 '--suffixes', 'txt,png',
750 '--port-name', 'test-win-win7',
751 '--builder', 'MOCK Win7',
752 ]
663 ] 753 ]
664 ]) 754 ])
665 755
666 756
667 class TestRebaselineExpectations(BaseTestCase): 757 class TestRebaselineExpectations(BaseTestCase):
668 command_constructor = RebaselineExpectations 758 command_constructor = RebaselineExpectations
669 759
670 def setUp(self): 760 def setUp(self):
671 super(TestRebaselineExpectations, self).setUp() 761 super(TestRebaselineExpectations, self).setUp()
672 762
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 self.command._tests_to_rebaseline = lambda port: { 801 self.command._tests_to_rebaseline = lambda port: {
712 'userscripts/another-test.html', 802 'userscripts/another-test.html',
713 'userscripts/images.svg', 803 'userscripts/images.svg',
714 'userscripts/not-actually-failing.html', 804 'userscripts/not-actually-failing.html',
715 } 805 }
716 806
717 self.command.execute(self.options(), [], self.tool) 807 self.command.execute(self.options(), [], self.tool)
718 808
719 self.assertEqual(self.tool.executive.calls, [ 809 self.assertEqual(self.tool.executive.calls, [
720 [ 810 [
721 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'txt', 811 [
722 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/another-te st.html'], 812 'python', 'echo', 'copy-existing-baselines-internal',
723 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'txt', 813 '--test', 'userscripts/another-test.html',
724 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/another-te st.html'], 814 '--suffixes', 'txt',
725 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'txt,png', 815 '--port-name', 'test-mac-mac10.10',
726 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/images.svg '], 816 ],
727 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'txt,png', 817 [
728 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/images.svg '], 818 'python', 'echo', 'copy-existing-baselines-internal',
819 '--test', 'userscripts/another-test.html',
820 '--suffixes', 'txt',
821 '--port-name', 'test-mac-mac10.11',
822 ],
823 [
824 'python', 'echo', 'copy-existing-baselines-internal',
825 '--test', 'userscripts/images.svg',
826 '--suffixes', 'txt,png',
827 '--port-name', 'test-mac-mac10.10',
828 ],
829 [
830 'python', 'echo', 'copy-existing-baselines-internal',
831 '--test', 'userscripts/images.svg',
832 '--suffixes', 'txt,png',
833 '--port-name', 'test-mac-mac10.11',
834 ],
729 ], 835 ],
730 [ 836 [
731 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx t', 837 [
732 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/another-te st.html'], 838 'python', 'echo', 'rebaseline-test-internal',
733 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx t', 839 '--test', 'userscripts/another-test.html',
734 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/another-te st.html'], 840 '--suffixes', 'txt',
735 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx t,png', 841 '--port-name', 'test-mac-mac10.10',
736 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/images.svg '], 842 '--builder', 'MOCK Mac10.10',
737 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx t,png', 843 ],
738 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/images.svg '], 844 [
845 'python', 'echo', 'rebaseline-test-internal',
846 '--test', 'userscripts/another-test.html',
847 '--suffixes', 'txt',
848 '--port-name', 'test-mac-mac10.11',
849 '--builder', 'MOCK Mac10.11',
850 ],
851 [
852 'python', 'echo', 'rebaseline-test-internal',
853 '--test', 'userscripts/images.svg',
854 '--suffixes', 'txt,png',
855 '--port-name', 'test-mac-mac10.10',
856 '--builder', 'MOCK Mac10.10',
857 ],
858 [
859 'python', 'echo', 'rebaseline-test-internal',
860 '--test', 'userscripts/images.svg',
861 '--suffixes', 'txt,png',
862 '--port-name', 'test-mac-mac10.11',
863 '--builder', 'MOCK Mac10.11',
864 ],
739 ], 865 ],
740 ]) 866 ])
741 867
742 def test_rebaseline_expectations_reftests(self): 868 def test_rebaseline_expectations_reftests(self):
743 self._zero_out_test_expectations() 869 self._zero_out_test_expectations()
744 870
745 self.tool.executive = MockExecutive() 871 self.tool.executive = MockExecutive()
746 872
747 for builder in ['MOCK Mac10.10', 'MOCK Mac10.11']: 873 for builder in ['MOCK Mac10.10', 'MOCK Mac10.11']:
748 self.tool.buildbot.set_results(Build(builder), LayoutTestResults({ 874 self.tool.buildbot.set_results(Build(builder), LayoutTestResults({
(...skipping 21 matching lines...) Expand all
770 self.command._tests_to_rebaseline = lambda port: { 896 self.command._tests_to_rebaseline = lambda port: {
771 'userscripts/reftest-text.html': set(['txt']), 897 'userscripts/reftest-text.html': set(['txt']),
772 'userscripts/reftest-image.html': set(['png']), 898 'userscripts/reftest-image.html': set(['png']),
773 'userscripts/reftest-image-text.html': set(['png', 'txt']), 899 'userscripts/reftest-image-text.html': set(['png', 'txt']),
774 } 900 }
775 901
776 self.command.execute(self.options(), [], self.tool) 902 self.command.execute(self.options(), [], self.tool)
777 903
778 self.assertEqual(self.tool.executive.calls, [ 904 self.assertEqual(self.tool.executive.calls, [
779 [ 905 [
780 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'txt', 906 [
781 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/reftest-te xt.html'], 907 'python', 'echo', 'copy-existing-baselines-internal',
782 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'txt', 908 '--test', 'userscripts/reftest-text.html',
783 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/reftest-te xt.html'], 909 '--suffixes', 'txt',
910 '--port-name', 'test-mac-mac10.10',
911 ],
912 [
913 'python', 'echo', 'copy-existing-baselines-internal',
914 '--test', 'userscripts/reftest-text.html',
915 '--suffixes', 'txt',
916 '--port-name', 'test-mac-mac10.11',
917 ],
784 ], 918 ],
785 [ 919 [
786 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx t', 920 [
787 '--builder', 'MOCK Mac10.10', '--test', 'userscripts/reftest-te xt.html'], 921 'python', 'echo', 'rebaseline-test-internal',
788 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx t', 922 '--test', 'userscripts/reftest-text.html',
789 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/reftest-te xt.html'], 923 '--suffixes', 'txt',
924 '--port-name', 'test-mac-mac10.10',
925 '--builder', 'MOCK Mac10.10',
926 ],
927 [
928 'python', 'echo', 'rebaseline-test-internal',
929 '--test', 'userscripts/reftest-text.html',
930 '--suffixes', 'txt',
931 '--port-name', 'test-mac-mac10.11',
932 '--builder', 'MOCK Mac10.11',
933 ],
790 ], 934 ],
791 ]) 935 ])
792 936
793 def test_rebaseline_expectations_noop(self): 937 def test_rebaseline_expectations_noop(self):
794 self._zero_out_test_expectations() 938 self._zero_out_test_expectations()
795 self.command.execute(self.options(), [], self.tool) 939 self.command.execute(self.options(), [], self.tool)
796 self.assertEqual(self.tool.filesystem.written_files, {}) 940 self.assertEqual(self.tool.filesystem.written_files, {})
797 941
798 def disabled_test_overrides_are_included_correctly(self): 942 def disabled_test_overrides_are_included_correctly(self):
799 # TODO(qyearsley): Fix or remove this test method. 943 # TODO(qyearsley): Fix or remove this test method.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 self.command._tests_to_rebaseline = lambda port: { 1036 self.command._tests_to_rebaseline = lambda port: {
893 'fast/dom/missing-text.html': set(['txt', 'png']), 1037 'fast/dom/missing-text.html': set(['txt', 'png']),
894 'fast/dom/missing-text-and-image.html': set(['txt', 'png']), 1038 'fast/dom/missing-text-and-image.html': set(['txt', 'png']),
895 'fast/dom/missing-image.html': set(['txt', 'png']), 1039 'fast/dom/missing-image.html': set(['txt', 'png']),
896 } 1040 }
897 1041
898 self.command.execute(self.options(), [], self.tool) 1042 self.command.execute(self.options(), [], self.tool)
899 1043
900 self.assertEqual(self.tool.executive.calls, [ 1044 self.assertEqual(self.tool.executive.calls, [
901 [ 1045 [
902 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'txt', 1046 [
903 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/missing-text. html'], 1047 'python', 'echo', 'copy-existing-baselines-internal',
904 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'txt,png', 1048 '--test', 'fast/dom/missing-text.html',
905 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/missing-text- and-image.html'], 1049 '--suffixes', 'txt',
906 ['python', 'echo', 'copy-existing-baselines-internal', '--suffix es', 'png', 1050 '--port-name', 'test-mac-mac10.10',
907 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/missing-image .html'], 1051 ],
1052 [
1053 'python', 'echo', 'copy-existing-baselines-internal',
1054 '--test', 'fast/dom/missing-text-and-image.html',
1055 '--suffixes', 'txt,png',
1056 '--port-name', 'test-mac-mac10.10',
1057 ],
1058 [
1059 'python', 'echo', 'copy-existing-baselines-internal',
1060 '--test', 'fast/dom/missing-image.html',
1061 '--suffixes', 'png',
1062 '--port-name', 'test-mac-mac10.10',
1063 ],
908 ], 1064 ],
909 [ 1065 [
910 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx t', 1066 [
911 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/missing-text. html'], 1067 'python', 'echo', 'rebaseline-test-internal',
912 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'tx t,png', 1068 '--test', 'fast/dom/missing-text.html',
913 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/missing-text- and-image.html'], 1069 '--suffixes', 'txt',
914 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'pn g', 1070 '--port-name', 'test-mac-mac10.10',
915 '--builder', 'MOCK Mac10.10', '--test', 'fast/dom/missing-image .html'], 1071 '--builder', 'MOCK Mac10.10',
1072 ],
1073 [
1074 'python', 'echo', 'rebaseline-test-internal',
1075 '--test', 'fast/dom/missing-text-and-image.html',
1076 '--suffixes', 'txt,png',
1077 '--port-name', 'test-mac-mac10.10',
1078 '--builder', 'MOCK Mac10.10',
1079 ],
1080 [
1081 'python', 'echo', 'rebaseline-test-internal',
1082 '--test', 'fast/dom/missing-image.html',
1083 '--suffixes', 'png',
1084 '--port-name', 'test-mac-mac10.10',
1085 '--builder', 'MOCK Mac10.10',
1086 ],
916 ] 1087 ]
917 ]) 1088 ])
918 1089
919 1090
920 class MockLineRemovingExecutive(MockExecutive): 1091 class MockLineRemovingExecutive(MockExecutive):
921 1092
922 def run_in_parallel(self, commands): 1093 def run_in_parallel(self, commands):
923 assert len(commands) 1094 assert len(commands)
924 1095
925 num_previous_calls = len(self.calls) 1096 num_previous_calls = len(self.calls)
926 command_outputs = [] 1097 command_outputs = []
927 for cmd_line, cwd in commands: 1098 for cmd_line, cwd in commands:
928 out = self.run_command(cmd_line, cwd=cwd) 1099 out = self.run_command(cmd_line, cwd=cwd)
929 if 'rebaseline-test-internal' in cmd_line: 1100 if 'rebaseline-test-internal' in cmd_line:
930 out = '{"remove-lines": [{"test": "%s", "builder": "%s"}]}\n' % (cmd_line[8], cmd_line[6]) 1101 test = cmd_line[cmd_line.index('--test') + 1]
1102 port_name = cmd_line[cmd_line.index('--port-name') + 1]
1103 out = json.dumps({'remove-lines': [{'test': test, 'port_name': p ort_name}]})
931 command_outputs.append([0, out, '']) 1104 command_outputs.append([0, out, ''])
932 1105
933 new_calls = self.calls[num_previous_calls:] 1106 new_calls = self.calls[num_previous_calls:]
934 self.calls = self.calls[:num_previous_calls] 1107 self.calls = self.calls[:num_previous_calls]
935 self.calls.append(new_calls) 1108 self.calls.append(new_calls)
936 return command_outputs 1109 return command_outputs
937 1110
938 1111
939 class TestBaselineSetTest(unittest.TestCase): 1112 class TestBaselineSetTest(unittest.TestCase):
940 1113
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 1145
973 def test_str_basic(self): 1146 def test_str_basic(self):
974 test_baseline_set = TestBaselineSet(host=self.host) 1147 test_baseline_set = TestBaselineSet(host=self.host)
975 test_baseline_set.add('a/x.html', Build('MOCK Mac10.12')) 1148 test_baseline_set.add('a/x.html', Build('MOCK Mac10.12'))
976 test_baseline_set.add('a/x.html', Build('MOCK Win10')) 1149 test_baseline_set.add('a/x.html', Build('MOCK Win10'))
977 self.assertEqual( 1150 self.assertEqual(
978 str(test_baseline_set), 1151 str(test_baseline_set),
979 ('<TestBaselineSet with:\n' 1152 ('<TestBaselineSet with:\n'
980 ' a/x.html: Build(builder_name=\'MOCK Mac10.12\', build_number=Non e)\n' 1153 ' a/x.html: Build(builder_name=\'MOCK Mac10.12\', build_number=Non e)\n'
981 ' a/x.html: Build(builder_name=\'MOCK Win10\', build_number=None)> ')) 1154 ' a/x.html: Build(builder_name=\'MOCK Win10\', build_number=None)> '))
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698