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

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

Issue 2153973002: Reland of In rebaseline, include build number information with "test_prefix_list" dicts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix spelling baseilnes -> baselines Created 4 years, 5 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_from_try_jobs_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 unittest 5 import unittest
6 6
7 from webkitpy.common.net.buildbot_mock import MockBuilder 7 from webkitpy.common.net.buildbot_mock import MockBuilder
8 from webkitpy.common.net.layouttestresults import LayoutTestResults 8 from webkitpy.common.net.layouttestresults import LayoutTestResults
9 from webkitpy.common.system.executive_mock import MockExecutive 9 from webkitpy.common.system.executive_mock import MockExecutive
10 from webkitpy.common.system.executive_mock import MockExecutive2 10 from webkitpy.common.system.executive_mock import MockExecutive2
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 self.tool.filesystem.write_text_file( 45 self.tool.filesystem.write_text_file(
46 self.tool.filesystem.join(self.mac_port.layout_tests_dir(), "Virtual TestSuites"), '[]') 46 self.tool.filesystem.join(self.mac_port.layout_tests_dir(), "Virtual TestSuites"), '[]')
47 47
48 # In AbstractParallelRebaselineCommand._rebaseline_commands, a default p ort 48 # In AbstractParallelRebaselineCommand._rebaseline_commands, a default p ort
49 # object is gotten using self.tool.port_factory.get(), which is used to get 49 # object is gotten using self.tool.port_factory.get(), which is used to get
50 # test paths -- and the layout tests directory may be different for the "test" 50 # test paths -- and the layout tests directory may be different for the "test"
51 # ports and real ports. Since only "test" ports are used in this class, 51 # ports and real ports. Since only "test" ports are used in this class,
52 # we can make the default port also a "test" port. 52 # we can make the default port also a "test" port.
53 self.original_port_factory_get = self.tool.port_factory.get 53 self.original_port_factory_get = self.tool.port_factory.get
54 test_port = self.tool.port_factory.get('test') 54 test_port = self.tool.port_factory.get('test')
55 self._builder_data = {} 55 self._build_data = {}
56 56
57 def get_test_port(port_name=None, options=None, **kwargs): 57 def get_test_port(port_name=None, options=None, **kwargs):
58 if not port_name: 58 if not port_name:
59 return test_port 59 return test_port
60 return self.original_port_factory_get(port_name, options, **kwargs) 60 return self.original_port_factory_get(port_name, options, **kwargs)
61 61
62 self.tool.port_factory.get = get_test_port 62 self.tool.port_factory.get = get_test_port
63 63
64 def tearDown(self): 64 def tearDown(self):
65 self.tool.port_factory.get = self.original_port_factory_get 65 self.tool.port_factory.get = self.original_port_factory_get
66 66
67 def _expand(self, path): 67 def _expand(self, path):
68 if self.tool.filesystem.isabs(path): 68 if self.tool.filesystem.isabs(path):
69 return path 69 return path
70 return self.tool.filesystem.join(self.mac_port.layout_tests_dir(), path) 70 return self.tool.filesystem.join(self.mac_port.layout_tests_dir(), path)
71 71
72 def _read(self, path): 72 def _read(self, path):
73 return self.tool.filesystem.read_text_file(self._expand(path)) 73 return self.tool.filesystem.read_text_file(self._expand(path))
74 74
75 def _write(self, path, contents): 75 def _write(self, path, contents):
76 self.tool.filesystem.write_text_file(self._expand(path), contents) 76 self.tool.filesystem.write_text_file(self._expand(path), contents)
77 77
78 def _zero_out_test_expectations(self): 78 def _zero_out_test_expectations(self):
79 for port_name in self.tool.port_factory.all_port_names(): 79 for port_name in self.tool.port_factory.all_port_names():
80 port = self.tool.port_factory.get(port_name) 80 port = self.tool.port_factory.get(port_name)
81 for path in port.expectations_files(): 81 for path in port.expectations_files():
82 self._write(path, '') 82 self._write(path, '')
83 self.tool.filesystem.written_files = {} 83 self.tool.filesystem.written_files = {}
84 84
85 def _setup_mock_builder_data(self): 85 def _setup_mock_build_data(self):
86 data = LayoutTestResults({ 86 data = LayoutTestResults({
87 "tests": { 87 "tests": {
88 "userscripts": { 88 "userscripts": {
89 "first-test.html": { 89 "first-test.html": {
90 "expected": "PASS", 90 "expected": "PASS",
91 "actual": "IMAGE+TEXT" 91 "actual": "IMAGE+TEXT"
92 }, 92 },
93 "second-test.html": { 93 "second-test.html": {
94 "expected": "FAIL", 94 "expected": "FAIL",
95 "actual": "IMAGE+TEXT" 95 "actual": "IMAGE+TEXT"
96 } 96 }
97 } 97 }
98 } 98 }
99 }) 99 })
100 100
101 def builder_data(): 101 def build_data():
102 self._builder_data = {} 102 self._build_data = {}
103 for builder in ['MOCK Win7', 'MOCK Win7 (dbg)', 'MOCK Mac10.11']: 103 for builder in ['MOCK Win7', 'MOCK Win7 (dbg)', 'MOCK Mac10.11']:
104 self._builder_data[builder] = data 104 self._build_data[Build(builder)] = data
105 return self._builder_data 105 return self._build_data
106 106
107 self.command.builder_data = builder_data 107 self.command.build_data = build_data
108 108
109 class TestCopyExistingBaselinesInternal(BaseTestCase): 109 class TestCopyExistingBaselinesInternal(BaseTestCase):
110 command_constructor = CopyExistingBaselinesInternal 110 command_constructor = CopyExistingBaselinesInternal
111 111
112 def setUp(self): 112 def setUp(self):
113 super(TestCopyExistingBaselinesInternal, self).setUp() 113 super(TestCopyExistingBaselinesInternal, self).setUp()
114 114
115 def test_copying_overwritten_baseline(self): 115 def test_copying_overwritten_baseline(self):
116 self.tool.executive = MockExecutive2() 116 self.tool.executive = MockExecutive2()
117 117
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 command_constructor = RebaselineJson 334 command_constructor = RebaselineJson
335 335
336 def setUp(self): 336 def setUp(self):
337 super(TestRebaselineJson, self).setUp() 337 super(TestRebaselineJson, self).setUp()
338 self.tool.executive = MockExecutive2() 338 self.tool.executive = MockExecutive2()
339 339
340 def tearDown(self): 340 def tearDown(self):
341 super(TestRebaselineJson, self).tearDown() 341 super(TestRebaselineJson, self).tearDown()
342 342
343 def test_rebaseline_test_passes_on_all_builders(self): 343 def test_rebaseline_test_passes_on_all_builders(self):
344 self._setup_mock_builder_data() 344 self._setup_mock_build_data()
345 345
346 def builder_data(): 346 def build_data():
347 self._builder_data['MOCK Win7'] = LayoutTestResults({ 347 self._build_data[Build('MOCK Win7')] = LayoutTestResults({
348 "tests": { 348 "tests": {
349 "userscripts": { 349 "userscripts": {
350 "first-test.html": { 350 "first-test.html": {
351 "expected": "NEEDSREBASELINE", 351 "expected": "NEEDSREBASELINE",
352 "actual": "PASS" 352 "actual": "PASS"
353 } 353 }
354 } 354 }
355 } 355 }
356 }) 356 })
357 return self._builder_data 357 return self._build_data
358 358
359 self.command.builder_data = builder_data 359 self.command.build_data = build_data
360 360
361 options = MockOptions(optimize=True, verbose=True, results_directory=Non e) 361 options = MockOptions(optimize=True, verbose=True, results_directory=Non e)
362 362
363 self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.h tml [ Failure ]\n") 363 self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.h tml [ Failure ]\n")
364 self._write("userscripts/first-test.html", "Dummy test contents") 364 self._write("userscripts/first-test.html", "Dummy test contents")
365 365
366 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK Win7": ["txt", "png"]}}) 366 self.command._rebaseline(options, {"userscripts/first-test.html": {Build ("MOCK Win7"): ["txt", "png"]}})
367 367
368 self.assertEqual(self.tool.executive.calls, []) 368 self.assertEqual(self.tool.executive.calls, [])
369 369
370 def test_rebaseline_all(self): 370 def test_rebaseline_all(self):
371 self._setup_mock_builder_data() 371 self._setup_mock_build_data()
372 372
373 options = MockOptions(optimize=True, verbose=True, results_directory=Non e) 373 options = MockOptions(optimize=True, verbose=True, results_directory=Non e)
374 self._write("userscripts/first-test.html", "Dummy test contents") 374 self._write("userscripts/first-test.html", "Dummy test contents")
375 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK Win7": ["txt", "png"]}}) 375 self.command._rebaseline(options, {"userscripts/first-test.html": {Build ("MOCK Win7"): ["txt", "png"]}})
376 376
377 # Note that we have one run_in_parallel() call followed by a run_command () 377 # Note that we have one run_in_parallel() call followed by a run_command ()
378 self.assertEqual(self.tool.executive.calls, 378 self.assertEqual(self.tool.executive.calls,
379 [ 379 [
380 [['python', 'echo', 'copy-existing-baselines-intern al', '--suffixes', 'txt,png', 380 [['python', 'echo', 'copy-existing-baselines-intern al', '--suffixes', 'txt,png',
381 '--builder', 'MOCK Win7', '--test', 'userscripts/ first-test.html', '--verbose']], 381 '--builder', 'MOCK Win7', '--test', 'userscripts/ first-test.html', '--verbose']],
382 [['python', 'echo', 'rebaseline-test-internal', '-- suffixes', 'txt,png', 382 [['python', 'echo', 'rebaseline-test-internal', '-- suffixes', 'txt,png',
383 '--builder', 'MOCK Win7', '--test', 'userscripts/ first-test.html', '--verbose']], 383 '--builder', 'MOCK Win7', '--test', 'userscripts/ first-test.html', '--verbose']],
384 [['python', 'echo', 'optimize-baselines', '--no-mod ify-scm', '--suffixes', 'txt,png', 384 [['python', 'echo', 'optimize-baselines', '--no-mod ify-scm', '--suffixes', 'txt,png',
385 'userscripts/first-test.html', '--verbose']] 385 'userscripts/first-test.html', '--verbose']]
386 ]) 386 ])
387 387
388 def test_rebaseline_debug(self): 388 def test_rebaseline_debug(self):
389 self._setup_mock_builder_data() 389 self._setup_mock_build_data()
390 390
391 options = MockOptions(optimize=True, verbose=True, results_directory=Non e) 391 options = MockOptions(optimize=True, verbose=True, results_directory=Non e)
392 self._write("userscripts/first-test.html", "Dummy test contents") 392 self._write("userscripts/first-test.html", "Dummy test contents")
393 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK Win7 (dbg)": ["txt", "png"]}}) 393 self.command._rebaseline(options, {"userscripts/first-test.html": {Build ("MOCK Win7 (dbg)"): ["txt", "png"]}})
394 394
395 # Note that we have one run_in_parallel() call followed by a run_command () 395 # Note that we have one run_in_parallel() call followed by a run_command ()
396 self.assertEqual(self.tool.executive.calls, 396 self.assertEqual(self.tool.executive.calls,
397 [ 397 [
398 [['python', 'echo', 'copy-existing-baselines-intern al', '--suffixes', 'txt,png', 398 [['python', 'echo', 'copy-existing-baselines-intern al', '--suffixes', 'txt,png',
399 '--builder', 'MOCK Win7 (dbg)', '--test', 'usersc ripts/first-test.html', '--verbose']], 399 '--builder', 'MOCK Win7 (dbg)', '--test', 'usersc ripts/first-test.html', '--verbose']],
400 [['python', 'echo', 'rebaseline-test-internal', '-- suffixes', 'txt,png', '--builder', 400 [['python', 'echo', 'rebaseline-test-internal', '-- suffixes', 'txt,png', '--builder',
401 'MOCK Win7 (dbg)', '--test', 'userscripts/first-t est.html', '--verbose']], 401 'MOCK Win7 (dbg)', '--test', 'userscripts/first-t est.html', '--verbose']],
402 [['python', 'echo', 'optimize-baselines', '--no-mod ify-scm', '--suffixes', 'txt,png', 402 [['python', 'echo', 'optimize-baselines', '--no-mod ify-scm', '--suffixes', 'txt,png',
403 'userscripts/first-test.html', '--verbose']] 403 'userscripts/first-test.html', '--verbose']]
404 ]) 404 ])
405 405
406 def test_no_optimize(self): 406 def test_no_optimize(self):
407 self._setup_mock_builder_data() 407 self._setup_mock_build_data()
408 408
409 options = MockOptions(optimize=False, verbose=True, results_directory=No ne) 409 options = MockOptions(optimize=False, verbose=True, results_directory=No ne)
410 self._write("userscripts/first-test.html", "Dummy test contents") 410 self._write("userscripts/first-test.html", "Dummy test contents")
411 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK Win7 (dbg)": ["txt", "png"]}}) 411 self.command._rebaseline(options, {"userscripts/first-test.html": {Build ("MOCK Win7 (dbg)"): ["txt", "png"]}})
412 412
413 # Note that we have only one run_in_parallel() call 413 # Note that we have only one run_in_parallel() call
414 self.assertEqual(self.tool.executive.calls, 414 self.assertEqual(self.tool.executive.calls,
415 [[['python', 'echo', 'copy-existing-baselines-internal' , '--suffixes', 'txt,png', '--builder', 'MOCK Win7 (dbg)', '--test', 'userscript s/first-test.html', '--verbose']], 415 [[['python', 'echo', 'copy-existing-baselines-internal' , '--suffixes', 'txt,png', '--builder', 'MOCK Win7 (dbg)', '--test', 'userscript s/first-test.html', '--verbose']],
416 [['python', 'echo', 'rebaseline-test-internal', '--suf fixes', 'txt,png', '--builder', 'MOCK Win7 (dbg)', '--test', 'userscripts/first- test.html', '--verbose']]]) 416 [['python', 'echo', 'rebaseline-test-internal', '--suf fixes', 'txt,png', '--builder', 'MOCK Win7 (dbg)', '--test', 'userscripts/first- test.html', '--verbose']]])
417 417
418 def test_results_directory(self): 418 def test_results_directory(self):
419 self._setup_mock_builder_data() 419 self._setup_mock_build_data()
420 420
421 options = MockOptions(optimize=False, verbose=True, results_directory='/ tmp') 421 options = MockOptions(optimize=False, verbose=True, results_directory='/ tmp')
422 self._write("userscripts/first-test.html", "Dummy test contents") 422 self._write("userscripts/first-test.html", "Dummy test contents")
423 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK Win7": ["txt", "png"]}}) 423 self.command._rebaseline(options, {"userscripts/first-test.html": {Build ("MOCK Win7"): ["txt", "png"]}})
424 424
425 # Note that we have only one run_in_parallel() call 425 # Note that we have only one run_in_parallel() call
426 self.assertEqual(self.tool.executive.calls, 426 self.assertEqual(self.tool.executive.calls,
427 [[['python', 'echo', 'copy-existing-baselines-internal' , '--suffixes', 'txt,png', '--builder', 'MOCK Win7', '--test', 'userscripts/firs t-test.html', '--results-directory', '/tmp', '--verbose']], 427 [[['python', 'echo', 'copy-existing-baselines-internal' , '--suffixes', 'txt,png', '--builder', 'MOCK Win7', '--test', 'userscripts/firs t-test.html', '--results-directory', '/tmp', '--verbose']],
428 [['python', 'echo', 'rebaseline-test-internal', '--suf fixes', 'txt,png', '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.h tml', '--results-directory', '/tmp', '--verbose']]]) 428 [['python', 'echo', 'rebaseline-test-internal', '--suf fixes', 'txt,png', '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.h tml', '--results-directory', '/tmp', '--verbose']]])
429 429
430 430
431 class TestRebaselineJsonUpdatesExpectationsFiles(BaseTestCase): 431 class TestRebaselineJsonUpdatesExpectationsFiles(BaseTestCase):
432 command_constructor = RebaselineJson 432 command_constructor = RebaselineJson
433 433
434 def setUp(self): 434 def setUp(self):
435 super(TestRebaselineJsonUpdatesExpectationsFiles, self).setUp() 435 super(TestRebaselineJsonUpdatesExpectationsFiles, self).setUp()
436 self.tool.executive = MockExecutive2() 436 self.tool.executive = MockExecutive2()
437 437
438 def mock_run_command(*args, **kwargs): # pylint: disable=unused-argumen t 438 def mock_run_command(*args, **kwargs): # pylint: disable=unused-argumen t
439 return '{"add": [], "remove-lines": [{"test": "userscripts/first-tes t.html", "builder": "MOCK Mac10.11"}]}\n' 439 return '{"add": [], "remove-lines": [{"test": "userscripts/first-tes t.html", "builder": "MOCK Mac10.11"}]}\n'
440 self.tool.executive.run_command = mock_run_command 440 self.tool.executive.run_command = mock_run_command
441 441
442 def test_rebaseline_updates_expectations_file(self): 442 def test_rebaseline_updates_expectations_file(self):
443 options = MockOptions(optimize=False, verbose=True, results_directory=No ne) 443 options = MockOptions(optimize=False, verbose=True, results_directory=No ne)
444 444
445 self._write(self.mac_expectations_path, 445 self._write(self.mac_expectations_path,
446 "Bug(x) [ Mac ] userscripts/first-test.html [ Failure ]\nbug (z) [ Linux ] userscripts/first-test.html [ Failure ]\n") 446 "Bug(x) [ Mac ] userscripts/first-test.html [ Failure ]\nbug (z) [ Linux ] userscripts/first-test.html [ Failure ]\n")
447 self._write("userscripts/first-test.html", "Dummy test contents") 447 self._write("userscripts/first-test.html", "Dummy test contents")
448 self._setup_mock_builder_data() 448 self._setup_mock_build_data()
449 449
450 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK Mac10.11": ["txt", "png"]}}) 450 self.command._rebaseline(options, {"userscripts/first-test.html": {Build ("MOCK Mac10.11"): ["txt", "png"]}})
451 451
452 new_expectations = self._read(self.mac_expectations_path) 452 new_expectations = self._read(self.mac_expectations_path)
453 self.assertMultiLineEqual( 453 self.assertMultiLineEqual(
454 new_expectations, "Bug(x) [ Mac10.10 ] userscripts/first-test.html [ Failure ]\nbug(z) [ Linux ] userscripts/first-test.html [ Failure ]\n") 454 new_expectations, "Bug(x) [ Mac10.10 ] userscripts/first-test.html [ Failure ]\nbug(z) [ Linux ] userscripts/first-test.html [ Failure ]\n")
455 455
456 def test_rebaseline_updates_expectations_file_all_platforms(self): 456 def test_rebaseline_updates_expectations_file_all_platforms(self):
457 options = MockOptions(optimize=False, verbose=True, results_directory=No ne) 457 options = MockOptions(optimize=False, verbose=True, results_directory=No ne)
458 458
459 self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.h tml [ Failure ]\n") 459 self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.h tml [ Failure ]\n")
460 self._write("userscripts/first-test.html", "Dummy test contents") 460 self._write("userscripts/first-test.html", "Dummy test contents")
461 self._setup_mock_builder_data() 461 self._setup_mock_build_data()
462 462
463 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK Mac10.11": ["txt", "png"]}}) 463 self.command._rebaseline(options, {"userscripts/first-test.html": {Build ("MOCK Mac10.11"): ["txt", "png"]}})
464 464
465 new_expectations = self._read(self.mac_expectations_path) 465 new_expectations = self._read(self.mac_expectations_path)
466 self.assertMultiLineEqual( 466 self.assertMultiLineEqual(
467 new_expectations, "Bug(x) [ Linux Mac10.10 Win ] userscripts/first-t est.html [ Failure ]\n") 467 new_expectations, "Bug(x) [ Linux Mac10.10 Win ] userscripts/first-t est.html [ Failure ]\n")
468 468
469 def test_rebaseline_handles_platform_skips(self): 469 def test_rebaseline_handles_platform_skips(self):
470 # This test is just like test_rebaseline_updates_expectations_file_all_p latforms(), 470 # This test is just like test_rebaseline_updates_expectations_file_all_p latforms(),
471 # except that if a particular port happens to SKIP a test in an override s file, 471 # except that if a particular port happens to SKIP a test in an override s file,
472 # we count that as passing, and do not think that we still need to rebas eline it. 472 # we count that as passing, and do not think that we still need to rebas eline it.
473 options = MockOptions(optimize=False, verbose=True, results_directory=No ne) 473 options = MockOptions(optimize=False, verbose=True, results_directory=No ne)
474 474
475 self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.h tml [ Failure ]\n") 475 self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.h tml [ Failure ]\n")
476 self._write("NeverFixTests", "Bug(y) [ Android ] userscripts [ WontFix ] \n") 476 self._write("NeverFixTests", "Bug(y) [ Android ] userscripts [ WontFix ] \n")
477 self._write("userscripts/first-test.html", "Dummy test contents") 477 self._write("userscripts/first-test.html", "Dummy test contents")
478 self._setup_mock_builder_data() 478 self._setup_mock_build_data()
479 479
480 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK Mac10.11": ["txt", "png"]}}) 480 self.command._rebaseline(options, {"userscripts/first-test.html": {Build ("MOCK Mac10.11"): ["txt", "png"]}})
481 481
482 new_expectations = self._read(self.mac_expectations_path) 482 new_expectations = self._read(self.mac_expectations_path)
483 self.assertMultiLineEqual( 483 self.assertMultiLineEqual(
484 new_expectations, "Bug(x) [ Linux Mac10.10 Win ] userscripts/first-t est.html [ Failure ]\n") 484 new_expectations, "Bug(x) [ Linux Mac10.10 Win ] userscripts/first-t est.html [ Failure ]\n")
485 485
486 def test_rebaseline_handles_skips_in_file(self): 486 def test_rebaseline_handles_skips_in_file(self):
487 # This test is like test_Rebaseline_handles_platform_skips, except that the 487 # This test is like test_Rebaseline_handles_platform_skips, except that the
488 # Skip is in the same (generic) file rather than a platform file. In thi s case, 488 # Skip is in the same (generic) file rather than a platform file. In thi s case,
489 # the Skip line should be left unmodified. Note that the first line is n ow 489 # the Skip line should be left unmodified. Note that the first line is n ow
490 # qualified as "[Linux Mac Win]"; if it was unqualified, it would confli ct with 490 # qualified as "[Linux Mac Win]"; if it was unqualified, it would confli ct with
491 # the second line. 491 # the second line.
492 options = MockOptions(optimize=False, verbose=True, results_directory=No ne) 492 options = MockOptions(optimize=False, verbose=True, results_directory=No ne)
493 493
494 self._write(self.mac_expectations_path, 494 self._write(self.mac_expectations_path,
495 ("Bug(x) [ Linux Mac Win ] userscripts/first-test.html [ Fai lure ]\n" 495 ("Bug(x) [ Linux Mac Win ] userscripts/first-test.html [ Fai lure ]\n"
496 "Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n" )) 496 "Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n" ))
497 self._write("userscripts/first-test.html", "Dummy test contents") 497 self._write("userscripts/first-test.html", "Dummy test contents")
498 self._setup_mock_builder_data() 498 self._setup_mock_build_data()
499 499
500 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK Mac10.11": ["txt", "png"]}}) 500 self.command._rebaseline(options, {"userscripts/first-test.html": {Build ("MOCK Mac10.11"): ["txt", "png"]}})
501 501
502 new_expectations = self._read(self.mac_expectations_path) 502 new_expectations = self._read(self.mac_expectations_path)
503 self.assertMultiLineEqual( 503 self.assertMultiLineEqual(
504 new_expectations, 504 new_expectations,
505 ("Bug(x) [ Linux Mac10.10 Win ] userscripts/first-test.html [ Failur e ]\n" 505 ("Bug(x) [ Linux Mac10.10 Win ] userscripts/first-test.html [ Failur e ]\n"
506 "Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n")) 506 "Bug(y) [ Android ] userscripts/first-test.html [ Skip ]\n"))
507 507
508 def test_rebaseline_handles_smoke_tests(self): 508 def test_rebaseline_handles_smoke_tests(self):
509 # This test is just like test_rebaseline_handles_platform_skips, except that we check for 509 # This test is just like test_rebaseline_handles_platform_skips, except that we check for
510 # a test not being in the SmokeTests file, instead of using overrides fi les. 510 # a test not being in the SmokeTests file, instead of using overrides fi les.
511 # If a test is not part of the smoke tests, we count that as passing on ports that only 511 # If a test is not part of the smoke tests, we count that as passing on ports that only
512 # run smoke tests, and do not think that we still need to rebaseline it. 512 # run smoke tests, and do not think that we still need to rebaseline it.
513 options = MockOptions(optimize=False, verbose=True, results_directory=No ne) 513 options = MockOptions(optimize=False, verbose=True, results_directory=No ne)
514 514
515 self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.h tml [ Failure ]\n") 515 self._write(self.mac_expectations_path, "Bug(x) userscripts/first-test.h tml [ Failure ]\n")
516 self._write("SmokeTests", "fast/html/article-element.html") 516 self._write("SmokeTests", "fast/html/article-element.html")
517 self._write("userscripts/first-test.html", "Dummy test contents") 517 self._write("userscripts/first-test.html", "Dummy test contents")
518 self._setup_mock_builder_data() 518 self._setup_mock_build_data()
519 519
520 self.command._rebaseline(options, {"userscripts/first-test.html": {"MOCK Mac10.11": ["txt", "png"]}}) 520 self.command._rebaseline(options, {"userscripts/first-test.html": {Build ("MOCK Mac10.11"): ["txt", "png"]}})
521 521
522 new_expectations = self._read(self.mac_expectations_path) 522 new_expectations = self._read(self.mac_expectations_path)
523 self.assertMultiLineEqual( 523 self.assertMultiLineEqual(
524 new_expectations, "Bug(x) [ Linux Mac10.10 Win ] userscripts/first-t est.html [ Failure ]\n") 524 new_expectations, "Bug(x) [ Linux Mac10.10 Win ] userscripts/first-t est.html [ Failure ]\n")
525 525
526 526
527 class TestRebaseline(BaseTestCase): 527 class TestRebaseline(BaseTestCase):
528 # This command shares most of its logic with RebaselineJson, so these tests just test what is different. 528 # This command shares most of its logic with RebaselineJson, so these tests just test what is different.
529 529
530 command_constructor = Rebaseline # AKA webkit-patch rebaseline 530 command_constructor = Rebaseline # AKA webkit-patch rebaseline
531 531
532 def test_rebaseline(self): 532 def test_rebaseline(self):
533 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK Win7')] 533 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK Win7')]
534 534
535 self._write("userscripts/first-test.html", "test data") 535 self._write("userscripts/first-test.html", "test data")
536 536
537 self._zero_out_test_expectations() 537 self._zero_out_test_expectations()
538 self._setup_mock_builder_data() 538 self._setup_mock_build_data()
539 539
540 self.command.execute(MockOptions(results_directory=False, optimize=False , builders=None, 540 self.command.execute(MockOptions(results_directory=False, optimize=False , builders=None,
541 suffixes="txt,png", verbose=True), ['us erscripts/first-test.html'], self.tool) 541 suffixes="txt,png", verbose=True), ['us erscripts/first-test.html'], self.tool)
542 542
543 self.assertEqual(self.tool.executive.calls, 543 self.assertEqual(self.tool.executive.calls,
544 [[['python', 'echo', 'copy-existing-baselines-internal' , '--suffixes', 'txt,png', '--builder', 'MOCK Win7', '--test', 'userscripts/firs t-test.html', '--verbose']], 544 [[['python', 'echo', 'copy-existing-baselines-internal' , '--suffixes', 'txt,png', '--builder', 'MOCK Win7', '--test', 'userscripts/firs t-test.html', '--verbose']],
545 [['python', 'echo', 'rebaseline-test-internal', '--suf fixes', 'txt,png', '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.h tml', '--verbose']]]) 545 [['python', 'echo', 'rebaseline-test-internal', '--suf fixes', 'txt,png', '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.h tml', '--verbose']]])
546 546
547 def test_rebaseline_directory(self): 547 def test_rebaseline_directory(self):
548 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK Win7')] 548 self.command._builders_to_pull_from = lambda: [MockBuilder('MOCK Win7')]
549 549
550 self._write("userscripts/first-test.html", "test data") 550 self._write("userscripts/first-test.html", "test data")
551 self._write("userscripts/second-test.html", "test data") 551 self._write("userscripts/second-test.html", "test data")
552 552
553 self._setup_mock_builder_data() 553 self._setup_mock_build_data()
554 554
555 self.command.execute(MockOptions(results_directory=False, optimize=False , builders=None, 555 self.command.execute(MockOptions(results_directory=False, optimize=False , builders=None,
556 suffixes="txt,png", verbose=True), ['us erscripts'], self.tool) 556 suffixes="txt,png", verbose=True), ['us erscripts'], self.tool)
557 557
558 self.assertEqual(self.tool.executive.calls, 558 self.assertEqual(self.tool.executive.calls,
559 [ 559 [
560 [ 560 [
561 ['python', 'echo', 'copy-existing-baselines-int ernal', '--suffixes', 'txt,png', 561 ['python', 'echo', 'copy-existing-baselines-int ernal', '--suffixes', 'txt,png',
562 '--builder', 'MOCK Win7', '--test', 'userscrip ts/first-test.html', '--verbose'], 562 '--builder', 'MOCK Win7', '--test', 'userscrip ts/first-test.html', '--verbose'],
563 ['python', 'echo', 'copy-existing-baselines-int ernal', '--suffixes', 'txt,png', 563 ['python', 'echo', 'copy-existing-baselines-int ernal', '--suffixes', 'txt,png',
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 601
602 def _write_test_file(self, port, path, contents): 602 def _write_test_file(self, port, path, contents):
603 abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path) 603 abs_path = self.tool.filesystem.join(port.layout_tests_dir(), path)
604 self.tool.filesystem.write_text_file(abs_path, contents) 604 self.tool.filesystem.write_text_file(abs_path, contents)
605 605
606 def test_rebaseline_expectations(self): 606 def test_rebaseline_expectations(self):
607 self._zero_out_test_expectations() 607 self._zero_out_test_expectations()
608 608
609 self.tool.executive = MockExecutive2() 609 self.tool.executive = MockExecutive2()
610 610
611 def builder_data(): 611 def build_data():
612 self._builder_data['MOCK Mac10.11'] = self._builder_data['MOCK Mac10 .10'] = LayoutTestResults({ 612 self._build_data[Build('MOCK Mac10.11')] = self._build_data[Build('M OCK Mac10.10')] = LayoutTestResults({
613 "tests": { 613 "tests": {
614 "userscripts": { 614 "userscripts": {
615 "another-test.html": { 615 "another-test.html": {
616 "expected": "PASS", 616 "expected": "PASS",
617 "actual": "PASS TEXT" 617 "actual": "PASS TEXT"
618 }, 618 },
619 "images.svg": { 619 "images.svg": {
620 "expected": "FAIL", 620 "expected": "FAIL",
621 "actual": "IMAGE+TEXT" 621 "actual": "IMAGE+TEXT"
622 } 622 }
623 } 623 }
624 } 624 }
625 }) 625 })
626 return self._builder_data 626 return self._build_data
627 627
628 self.command.builder_data = builder_data 628 self.command.build_data = build_data
629 629
630 self._write("userscripts/another-test.html", "Dummy test contents") 630 self._write("userscripts/another-test.html", "Dummy test contents")
631 self._write("userscripts/images.svg", "Dummy test contents") 631 self._write("userscripts/images.svg", "Dummy test contents")
632 self.command._tests_to_rebaseline = lambda port: { 632 self.command._tests_to_rebaseline = lambda port: {
633 'userscripts/another-test.html': set(['txt']), 633 'userscripts/another-test.html': set(['txt']),
634 'userscripts/images.svg': set(['png']), 634 'userscripts/images.svg': set(['png']),
635 'userscripts/not-actually-failing.html': set(['txt', 'png', 'wav']), 635 'userscripts/not-actually-failing.html': set(['txt', 'png', 'wav']),
636 } 636 }
637 637
638 self.command.execute(self.options, [], self.tool) 638 self.command.execute(self.options, [], self.tool)
(...skipping 19 matching lines...) Expand all
658 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'pn g', 658 ['python', 'echo', 'rebaseline-test-internal', '--suffixes', 'pn g',
659 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/images.svg '], 659 '--builder', 'MOCK Mac10.11', '--test', 'userscripts/images.svg '],
660 ], 660 ],
661 ]) 661 ])
662 662
663 def test_rebaseline_expectations_reftests(self): 663 def test_rebaseline_expectations_reftests(self):
664 self._zero_out_test_expectations() 664 self._zero_out_test_expectations()
665 665
666 self.tool.executive = MockExecutive2() 666 self.tool.executive = MockExecutive2()
667 667
668 def builder_data(): 668 def build_data():
669 self._builder_data['MOCK Mac10.10'] = self._builder_data['MOCK Mac10 .11'] = LayoutTestResults({ 669 self._build_data[Build('MOCK Mac10.10')] = self._build_data[Build('M OCK Mac10.11')] = LayoutTestResults({
670 "tests": { 670 "tests": {
671 "userscripts": { 671 "userscripts": {
672 "reftest-text.html": { 672 "reftest-text.html": {
673 "expected": "PASS", 673 "expected": "PASS",
674 "actual": "TEXT" 674 "actual": "TEXT"
675 }, 675 },
676 "reftest-image.html": { 676 "reftest-image.html": {
677 "expected": "FAIL", 677 "expected": "FAIL",
678 "actual": "IMAGE" 678 "actual": "IMAGE"
679 }, 679 },
680 "reftest-image-text.html": { 680 "reftest-image-text.html": {
681 "expected": "FAIL", 681 "expected": "FAIL",
682 "actual": "IMAGE+TEXT" 682 "actual": "IMAGE+TEXT"
683 } 683 }
684 } 684 }
685 } 685 }
686 }) 686 })
687 return self._builder_data 687 return self._build_data
688 688
689 self.command.builder_data = builder_data 689 self.command.build_data = build_data
690 690
691 self._write("userscripts/reftest-text.html", "Dummy test contents") 691 self._write("userscripts/reftest-text.html", "Dummy test contents")
692 self._write("userscripts/reftest-text-expected.html", "Dummy test conten ts") 692 self._write("userscripts/reftest-text-expected.html", "Dummy test conten ts")
693 self._write("userscripts/reftest-text-expected.html", "Dummy test conten ts") 693 self._write("userscripts/reftest-text-expected.html", "Dummy test conten ts")
694 self.command._tests_to_rebaseline = lambda port: { 694 self.command._tests_to_rebaseline = lambda port: {
695 'userscripts/reftest-text.html': set(['txt']), 695 'userscripts/reftest-text.html': set(['txt']),
696 'userscripts/reftest-image.html': set(['png']), 696 'userscripts/reftest-image.html': set(['png']),
697 'userscripts/reftest-image-text.html': set(['png', 'txt']), 697 'userscripts/reftest-image-text.html': set(['png', 'txt']),
698 } 698 }
699 699
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 744
745 def test_rebaseline_without_other_expectations(self): 745 def test_rebaseline_without_other_expectations(self):
746 self._write("userscripts/another-test.html", "Dummy test contents") 746 self._write("userscripts/another-test.html", "Dummy test contents")
747 self._write(self.mac_expectations_path, "Bug(x) userscripts/another-test .html [ Rebaseline ]\n") 747 self._write(self.mac_expectations_path, "Bug(x) userscripts/another-test .html [ Rebaseline ]\n")
748 self.assertDictEqual(self.command._tests_to_rebaseline(self.mac_port), 748 self.assertDictEqual(self.command._tests_to_rebaseline(self.mac_port),
749 {'userscripts/another-test.html': ('png', 'wav', 't xt')}) 749 {'userscripts/another-test.html': ('png', 'wav', 't xt')})
750 750
751 def test_rebaseline_test_passes_everywhere(self): 751 def test_rebaseline_test_passes_everywhere(self):
752 test_port = self.tool.port_factory.get('test') 752 test_port = self.tool.port_factory.get('test')
753 753
754 def builder_data(): 754 def build_data():
755 self._builder_data['MOCK Mac10.10'] = self._builder_data['MOCK Mac10 .11'] = LayoutTestResults({ 755 self._build_data[Build('MOCK Mac10.10')] = self._build_data[Build('M OCK Mac10.11')] = LayoutTestResults({
756 "tests": { 756 "tests": {
757 "fast": { 757 "fast": {
758 "dom": { 758 "dom": {
759 "prototype-taco.html": { 759 "prototype-taco.html": {
760 "expected": "FAIL", 760 "expected": "FAIL",
761 "actual": "PASS", 761 "actual": "PASS",
762 "is_unexpected": True 762 "is_unexpected": True
763 } 763 }
764 } 764 }
765 } 765 }
766 } 766 }
767 }) 767 })
768 return self._builder_data 768 return self._build_data
769 769
770 self.command.builder_data = builder_data 770 self.command.build_data = build_data
771 771
772 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe ctations_file(), """ 772 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe ctations_file(), """
773 Bug(foo) fast/dom/prototype-taco.html [ Rebaseline ] 773 Bug(foo) fast/dom/prototype-taco.html [ Rebaseline ]
774 """) 774 """)
775 775
776 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents") 776 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents")
777 777
778 self.tool.executive = MockLineRemovingExecutive() 778 self.tool.executive = MockLineRemovingExecutive()
779 779
780 self.tool.builders = BuilderList({ 780 self.tool.builders = BuilderList({
781 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": [" Mac10.10", "Release"]}, 781 "MOCK Mac10.10": {"port_name": "test-mac-mac10.10", "specifiers": [" Mac10.10", "Release"]},
782 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": [" Mac10.11", "Release"]}, 782 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": [" Mac10.11", "Release"]},
783 }) 783 })
784 784
785 self.command.execute(self.options, [], self.tool) 785 self.command.execute(self.options, [], self.tool)
786 self.assertEqual(self.tool.executive.calls, []) 786 self.assertEqual(self.tool.executive.calls, [])
787 787
788 # The mac ports should both be removed since they're the only ones in th e builder list. 788 # The mac ports should both be removed since they're the only ones in th e builder list.
789 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_g eneric_test_expectations_file()), """ 789 self.assertEqual(self.tool.filesystem.read_text_file(test_port.path_to_g eneric_test_expectations_file()), """
790 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ Rebaseline ] 790 Bug(foo) [ Linux Win ] fast/dom/prototype-taco.html [ Rebaseline ]
791 """) 791 """)
792 792
793 def test_rebaseline_missing(self): 793 def test_rebaseline_missing(self):
794 def builder_data(): 794 def build_data():
795 self._builder_data['MOCK Mac10.10'] = LayoutTestResults({ 795 self._build_data[Build('MOCK Mac10.10')] = LayoutTestResults({
796 "tests": { 796 "tests": {
797 "fast": { 797 "fast": {
798 "dom": { 798 "dom": {
799 "missing-text.html": { 799 "missing-text.html": {
800 "expected": "PASS", 800 "expected": "PASS",
801 "actual": "MISSING", 801 "actual": "MISSING",
802 "is_unexpected": True, 802 "is_unexpected": True,
803 "is_missing_text": True 803 "is_missing_text": True
804 }, 804 },
805 "missing-text-and-image.html": { 805 "missing-text-and-image.html": {
806 "expected": "PASS", 806 "expected": "PASS",
807 "actual": "MISSING", 807 "actual": "MISSING",
808 "is_unexpected": True, 808 "is_unexpected": True,
809 "is_missing_text": True, 809 "is_missing_text": True,
810 "is_missing_image": True 810 "is_missing_image": True
811 }, 811 },
812 "missing-image.html": { 812 "missing-image.html": {
813 "expected": "PASS", 813 "expected": "PASS",
814 "actual": "MISSING", 814 "actual": "MISSING",
815 "is_unexpected": True, 815 "is_unexpected": True,
816 "is_missing_image": True 816 "is_missing_image": True
817 } 817 }
818 } 818 }
819 } 819 }
820 } 820 }
821 }) 821 })
822 return self._builder_data 822 return self._build_data
823 823
824 self.command.builder_data = builder_data 824 self.command.build_data = build_data
825 825
826 self._write('fast/dom/missing-text.html', "Dummy test contents") 826 self._write('fast/dom/missing-text.html', "Dummy test contents")
827 self._write('fast/dom/missing-text-and-image.html', "Dummy test contents ") 827 self._write('fast/dom/missing-text-and-image.html', "Dummy test contents ")
828 self._write('fast/dom/missing-image.html', "Dummy test contents") 828 self._write('fast/dom/missing-image.html', "Dummy test contents")
829 829
830 self.command._tests_to_rebaseline = lambda port: { 830 self.command._tests_to_rebaseline = lambda port: {
831 'fast/dom/missing-text.html': set(['txt', 'png']), 831 'fast/dom/missing-text.html': set(['txt', 'png']),
832 'fast/dom/missing-text-and-image.html': set(['txt', 'png']), 832 'fast/dom/missing-text-and-image.html': set(['txt', 'png']),
833 'fast/dom/missing-image.html': set(['txt', 'png']), 833 'fast/dom/missing-image.html': set(['txt', 'png']),
834 } 834 }
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe baseline ] 1049 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe baseline ]
1050 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Mac10.11 ] fast/dom/prototype -strawberry.html [ NeedsRebaseline ] 1050 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-06-14 20:18:46 +0000 11) crbug.com/24182 [ Mac10.11 ] fast/dom/prototype -strawberry.html [ NeedsRebaseline ]
1051 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 12) crbug.com/24182 fast/dom/prototype-chocolate.ht ml [ NeedsRebaseline ] 1051 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 12) crbug.com/24182 fast/dom/prototype-chocolate.ht ml [ NeedsRebaseline ]
1052 624caaaaaa path/to/TestExpectations (<foo@chromium.org> 2013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/not-cycled-through-bots .html [ NeedsRebaseline ] 1052 624caaaaaa path/to/TestExpectations (<foo@chromium.org> 2013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/not-cycled-through-bots .html [ NeedsRebaseline ]
1053 0000000000 path/to/TestExpectations (<foo@chromium.org> 2013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/locally-changed-lined.h tml [ NeedsRebaseline ] 1053 0000000000 path/to/TestExpectations (<foo@chromium.org> 2013-04-28 04:52:41 +0000 12) crbug.com/24182 path/to/locally-changed-lined.h tml [ NeedsRebaseline ]
1054 """ 1054 """
1055 self.tool.scm().blame = blame 1055 self.tool.scm().blame = blame
1056 1056
1057 test_port = self.tool.port_factory.get('test') 1057 test_port = self.tool.port_factory.get('test')
1058 1058
1059 def builder_data(): 1059 def build_data():
1060 # Have prototype-chocolate only fail on "MOCK Mac10.11". 1060 # Have prototype-chocolate only fail on "MOCK Mac10.11".
1061 self._builder_data['MOCK Mac10.11'] = LayoutTestResults({ 1061 self._build_data[Build('MOCK Mac10.11')] = LayoutTestResults({
1062 "tests": { 1062 "tests": {
1063 "fast": { 1063 "fast": {
1064 "dom": { 1064 "dom": {
1065 "prototype-taco.html": { 1065 "prototype-taco.html": {
1066 "expected": "PASS", 1066 "expected": "PASS",
1067 "actual": "PASS TEXT", 1067 "actual": "PASS TEXT",
1068 "is_unexpected": True 1068 "is_unexpected": True
1069 }, 1069 },
1070 "prototype-chocolate.html": { 1070 "prototype-chocolate.html": {
1071 "expected": "FAIL", 1071 "expected": "FAIL",
1072 "actual": "PASS" 1072 "actual": "PASS"
1073 }, 1073 },
1074 "prototype-strawberry.html": { 1074 "prototype-strawberry.html": {
1075 "expected": "PASS", 1075 "expected": "PASS",
1076 "actual": "IMAGE PASS", 1076 "actual": "IMAGE PASS",
1077 "is_unexpected": True 1077 "is_unexpected": True
1078 } 1078 }
1079 } 1079 }
1080 } 1080 }
1081 } 1081 }
1082 }) 1082 })
1083 return self._builder_data 1083 return self._build_data
1084 1084
1085 self.command.builder_data = builder_data 1085 self.command.build_data = build_data
1086 1086
1087 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe ctations_file(), """ 1087 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe ctations_file(), """
1088 crbug.com/24182 [ Debug ] path/to/norebaseline.html [ Rebaseline ] 1088 crbug.com/24182 [ Debug ] path/to/norebaseline.html [ Rebaseline ]
1089 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] 1089 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
1090 crbug.com/24182 [ Mac10.11 ] fast/dom/prototype-strawberry.html [ NeedsRebaselin e ] 1090 crbug.com/24182 [ Mac10.11 ] fast/dom/prototype-strawberry.html [ NeedsRebaselin e ]
1091 crbug.com/24182 fast/dom/prototype-chocolate.html [ NeedsRebaseline ] 1091 crbug.com/24182 fast/dom/prototype-chocolate.html [ NeedsRebaseline ]
1092 crbug.com/24182 path/to/not-cycled-through-bots.html [ NeedsRebaseline ] 1092 crbug.com/24182 path/to/not-cycled-through-bots.html [ NeedsRebaseline ]
1093 crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ] 1093 crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ]
1094 """) 1094 """)
1095 1095
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 1148
1149 def test_execute_git_cl_hangs(self): 1149 def test_execute_git_cl_hangs(self):
1150 def blame(_): 1150 def blame(_):
1151 return """ 1151 return """
1152 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe baseline ] 1152 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe baseline ]
1153 """ 1153 """
1154 self.tool.scm().blame = blame 1154 self.tool.scm().blame = blame
1155 1155
1156 test_port = self.tool.port_factory.get('test') 1156 test_port = self.tool.port_factory.get('test')
1157 1157
1158 original_builder_data = self.command.builder_data 1158 original_build_data = self.command.build_data
1159 def builder_data(): 1159
1160 original_builder_data() 1160 def build_data():
1161 original_build_data()
1161 # Have prototype-chocolate only fail on "MOCK Mac10.11". 1162 # Have prototype-chocolate only fail on "MOCK Mac10.11".
1162 self._builder_data['MOCK Mac10.11'] = LayoutTestResults({ 1163 self._build_data[Build('MOCK Mac10.11')] = LayoutTestResults({
1163 "tests": { 1164 "tests": {
1164 "fast": { 1165 "fast": {
1165 "dom": { 1166 "dom": {
1166 "prototype-taco.html": { 1167 "prototype-taco.html": {
1167 "expected": "PASS", 1168 "expected": "PASS",
1168 "actual": "PASS TEXT", 1169 "actual": "PASS TEXT",
1169 "is_unexpected": True 1170 "is_unexpected": True
1170 } 1171 }
1171 } 1172 }
1172 } 1173 }
1173 } 1174 }
1174 }) 1175 })
1175 return self._builder_data 1176 return self._build_data
1176 1177
1177 self.command.builder_data = builder_data 1178 self.command.build_data = build_data
1178 1179
1179 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe ctations_file(), """ 1180 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe ctations_file(), """
1180 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] 1181 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
1181 """) 1182 """)
1182 1183
1183 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents") 1184 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents")
1184 1185
1185 self.tool.builders = BuilderList({ 1186 self.tool.builders = BuilderList({
1186 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": [" Mac10.11", "Release"]}, 1187 "MOCK Mac10.11": {"port_name": "test-mac-mac10.11", "specifiers": [" Mac10.11", "Release"]},
1187 }) 1188 })
(...skipping 19 matching lines...) Expand all
1207 1208
1208 def test_execute_test_passes_everywhere(self): 1209 def test_execute_test_passes_everywhere(self):
1209 def blame(_): 1210 def blame(_):
1210 return """ 1211 return """
1211 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe baseline ] 1212 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe baseline ]
1212 """ 1213 """
1213 self.tool.scm().blame = blame 1214 self.tool.scm().blame = blame
1214 1215
1215 test_port = self.tool.port_factory.get('test') 1216 test_port = self.tool.port_factory.get('test')
1216 1217
1217 def builder_data(): 1218 def build_data():
1218 self._builder_data['MOCK Mac10.10'] = self._builder_data['MOCK Mac10 .11'] = LayoutTestResults({ 1219 self._build_data[Build('MOCK Mac10.10')] = self._build_data[Build('M OCK Mac10.11')] = LayoutTestResults({
1219 "tests": { 1220 "tests": {
1220 "fast": { 1221 "fast": {
1221 "dom": { 1222 "dom": {
1222 "prototype-taco.html": { 1223 "prototype-taco.html": {
1223 "expected": "FAIL", 1224 "expected": "FAIL",
1224 "actual": "PASS", 1225 "actual": "PASS",
1225 "is_unexpected": True 1226 "is_unexpected": True
1226 } 1227 }
1227 } 1228 }
1228 } 1229 }
1229 } 1230 }
1230 }) 1231 })
1231 return self._builder_data 1232 return self._build_data
1232 1233
1233 self.command.builder_data = builder_data 1234 self.command.build_data = build_data
1234 1235
1235 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe ctations_file(), """ 1236 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe ctations_file(), """
1236 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] 1237 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
1237 """) 1238 """)
1238 1239
1239 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents") 1240 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents")
1240 1241
1241 self.tool.executive = MockLineRemovingExecutive() 1242 self.tool.executive = MockLineRemovingExecutive()
1242 1243
1243 self.tool.builders = BuilderList({ 1244 self.tool.builders = BuilderList({
(...skipping 17 matching lines...) Expand all
1261 1262
1262 def test_execute_use_alternate_rebaseline_branch(self): 1263 def test_execute_use_alternate_rebaseline_branch(self):
1263 def blame(_): 1264 def blame(_):
1264 return """ 1265 return """
1265 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe baseline ] 1266 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe baseline ]
1266 """ 1267 """
1267 self.tool.scm().blame = blame 1268 self.tool.scm().blame = blame
1268 1269
1269 test_port = self.tool.port_factory.get('test') 1270 test_port = self.tool.port_factory.get('test')
1270 1271
1271 def builder_data(): 1272 def build_data():
1272 self._builder_data['MOCK Win'] = LayoutTestResults({ 1273 self._build_data[Build('MOCK Win')] = LayoutTestResults({
1273 "tests": { 1274 "tests": {
1274 "fast": { 1275 "fast": {
1275 "dom": { 1276 "dom": {
1276 "prototype-taco.html": { 1277 "prototype-taco.html": {
1277 "expected": "FAIL", 1278 "expected": "FAIL",
1278 "actual": "PASS", 1279 "actual": "PASS",
1279 "is_unexpected": True 1280 "is_unexpected": True
1280 } 1281 }
1281 } 1282 }
1282 } 1283 }
1283 } 1284 }
1284 }) 1285 })
1285 return self._builder_data 1286 return self._build_data
1286 1287
1287 self.command.builder_data = builder_data 1288 self.command.build_data = build_data
1288 1289
1289 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe ctations_file(), """ 1290 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe ctations_file(), """
1290 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] 1291 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
1291 """) 1292 """)
1292 1293
1293 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents") 1294 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents")
1294 1295
1295 self.tool.executive = MockLineRemovingExecutive() 1296 self.tool.executive = MockLineRemovingExecutive()
1296 1297
1297 self.tool.builders = BuilderList({ 1298 self.tool.builders = BuilderList({
(...skipping 19 matching lines...) Expand all
1317 1318
1318 def test_execute_stuck_on_alternate_rebaseline_branch(self): 1319 def test_execute_stuck_on_alternate_rebaseline_branch(self):
1319 def blame(_): 1320 def blame(_):
1320 return """ 1321 return """
1321 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe baseline ] 1322 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe baseline ]
1322 """ 1323 """
1323 self.tool.scm().blame = blame 1324 self.tool.scm().blame = blame
1324 1325
1325 test_port = self.tool.port_factory.get('test') 1326 test_port = self.tool.port_factory.get('test')
1326 1327
1327 def builder_data(): 1328 def build_data():
1328 self._builder_data['MOCK Win'] = LayoutTestResults({ 1329 self._build_data[Build('MOCK Win')] = LayoutTestResults({
1329 "tests": { 1330 "tests": {
1330 "fast": { 1331 "fast": {
1331 "dom": { 1332 "dom": {
1332 "prototype-taco.html": { 1333 "prototype-taco.html": {
1333 "expected": "FAIL", 1334 "expected": "FAIL",
1334 "actual": "PASS", 1335 "actual": "PASS",
1335 "is_unexpected": True 1336 "is_unexpected": True
1336 } 1337 }
1337 } 1338 }
1338 } 1339 }
1339 } 1340 }
1340 }) 1341 })
1341 return self._builder_data 1342 return self._build_data
1342 1343
1343 self.command.builder_data = builder_data 1344 self.command.build_data = build_data
1344 1345
1345 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe ctations_file(), """ 1346 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe ctations_file(), """
1346 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] 1347 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
1347 """) 1348 """)
1348 1349
1349 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents") 1350 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents")
1350 1351
1351 self.tool.executive = MockLineRemovingExecutive() 1352 self.tool.executive = MockLineRemovingExecutive()
1352 1353
1353 self.tool.builders = BuilderList({ 1354 self.tool.builders = BuilderList({
(...skipping 20 matching lines...) Expand all
1374 1375
1375 def _basic_execute_test(self, expected_executive_calls, auth_refresh_token_j son=None, commit_author=None, dry_run=False): 1376 def _basic_execute_test(self, expected_executive_calls, auth_refresh_token_j son=None, commit_author=None, dry_run=False):
1376 def blame(_): 1377 def blame(_):
1377 return """ 1378 return """
1378 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe baseline ] 1379 6469e754a1 path/to/TestExpectations (<foobarbaz1@chromium.org> 2013-04-28 04:52:41 +0000 13) Bug(foo) fast/dom/prototype-taco.html [ NeedsRe baseline ]
1379 """ 1380 """
1380 self.tool.scm().blame = blame 1381 self.tool.scm().blame = blame
1381 1382
1382 test_port = self.tool.port_factory.get('test') 1383 test_port = self.tool.port_factory.get('test')
1383 1384
1384 def builder_data(): 1385 def build_data():
1385 self._builder_data['MOCK Mac10.10'] = self._builder_data['MOCK Mac10 .11'] = LayoutTestResults({ 1386 self._build_data[Build('MOCK Mac10.10')] = self._build_data[Build('M OCK Mac10.11')] = LayoutTestResults({
1386 "tests": { 1387 "tests": {
1387 "fast": { 1388 "fast": {
1388 "dom": { 1389 "dom": {
1389 "prototype-taco.html": { 1390 "prototype-taco.html": {
1390 "expected": "FAIL", 1391 "expected": "FAIL",
1391 "actual": "PASS", 1392 "actual": "PASS",
1392 "is_unexpected": True 1393 "is_unexpected": True
1393 } 1394 }
1394 } 1395 }
1395 } 1396 }
1396 } 1397 }
1397 }) 1398 })
1398 return self._builder_data 1399 return self._build_data
1399 1400
1400 self.command.builder_data = builder_data 1401 self.command.build_data = build_data
1401 1402
1402 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe ctations_file(), """ 1403 self.tool.filesystem.write_text_file(test_port.path_to_generic_test_expe ctations_file(), """
1403 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] 1404 Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
1404 """) 1405 """)
1405 1406
1406 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents") 1407 self._write_test_file(test_port, 'fast/dom/prototype-taco.html', "Dummy test contents")
1407 1408
1408 self.tool.executive = MockLineRemovingExecutive() 1409 self.tool.executive = MockLineRemovingExecutive()
1409 1410
1410 self.tool.builders = BuilderList({ 1411 self.tool.builders = BuilderList({
(...skipping 18 matching lines...) Expand all
1429 ['git', 'cl', 'upload', '-f', '--auth-refresh-token-json', RIETV ELD_REFRESH_TOKEN], 1430 ['git', 'cl', 'upload', '-f', '--auth-refresh-token-json', RIETV ELD_REFRESH_TOKEN],
1430 ['git', 'pull'], 1431 ['git', 'pull'],
1431 ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', R IETVELD_REFRESH_TOKEN], 1432 ['git', 'cl', 'land', '-f', '-v', '--auth-refresh-token-json', R IETVELD_REFRESH_TOKEN],
1432 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv eldissue'], 1433 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietv eldissue'],
1433 ], 1434 ],
1434 auth_refresh_token_json=RIETVELD_REFRESH_TOKEN) 1435 auth_refresh_token_json=RIETVELD_REFRESH_TOKEN)
1435 1436
1436 def test_execute_with_dry_run(self): 1437 def test_execute_with_dry_run(self):
1437 self._basic_execute_test([], dry_run=True) 1438 self._basic_execute_test([], dry_run=True)
1438 self.assertEqual(self.tool.scm().local_commits(), []) 1439 self.assertEqual(self.tool.scm().local_commits(), [])
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_from_try_jobs_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698