| OLD | NEW |
| 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 json |
| 6 import optparse | 6 import optparse |
| 7 | 7 |
| 8 from webkitpy.common.net.buildbot import Build | 8 from webkitpy.common.net.buildbot import Build |
| 9 from webkitpy.common.net.git_cl import GitCL | 9 from webkitpy.common.net.git_cl import GitCL |
| 10 from webkitpy.common.checkout.git_mock import MockGit | 10 from webkitpy.common.checkout.git_mock import MockGit |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 def test_continues_with_missing_results_when_filling_results(self): | 333 def test_continues_with_missing_results_when_filling_results(self): |
| 334 self.tool.buildbot.set_results(Build('MOCK Try Win', 5000), None) | 334 self.tool.buildbot.set_results(Build('MOCK Try Win', 5000), None) |
| 335 return_code = self.command.execute(self.command_options(fill_missing=Tru
e), ['fast/dom/prototype-taco.html'], self.tool) | 335 return_code = self.command.execute(self.command_options(fill_missing=Tru
e), ['fast/dom/prototype-taco.html'], self.tool) |
| 336 self.assertEqual(return_code, 0) | 336 self.assertEqual(return_code, 0) |
| 337 self.assertLog([ | 337 self.assertLog([ |
| 338 'INFO: Failed to fetch results for Build(builder_name=\'MOCK Try Win
\', build_number=5000)\n', | 338 'INFO: Failed to fetch results for Build(builder_name=\'MOCK Try Win
\', build_number=5000)\n', |
| 339 'INFO: Results URL: https://storage.googleapis.com/chromium-layout-t
est-archives' | 339 'INFO: Results URL: https://storage.googleapis.com/chromium-layout-t
est-archives' |
| 340 '/MOCK_Try_Win/5000/layout-test-results/results.html\n', | 340 '/MOCK_Try_Win/5000/layout-test-results/results.html\n', |
| 341 'INFO: Retry job by running: git cl try -b MOCK Try Win\n', | 341 'INFO: Retry job by running: git cl try -b MOCK Try Win\n', |
| 342 'INFO: For fast/dom/prototype-taco.html:\n', | 342 'INFO: For fast/dom/prototype-taco.html:\n', |
| 343 'INFO: Using Build(builder_name=\'MOCK Try Mac\', build_number=4000)
to supply results for test-win-win7.\n', | 343 'INFO: Using Build(builder_name=\'MOCK Try Linux\', build_number=600
0) to supply results for test-win-win7.\n', |
| 344 'INFO: Rebaselining fast/dom/prototype-taco.html\n' | 344 'INFO: Rebaselining fast/dom/prototype-taco.html\n' |
| 345 ]) | 345 ]) |
| 346 | 346 |
| 347 def test_bails_when_there_are_unstaged_baselines(self): | 347 def test_bails_when_there_are_unstaged_baselines(self): |
| 348 git = self.tool.git() | 348 git = self.tool.git() |
| 349 git.unstaged_changes = lambda: {'third_party/WebKit/LayoutTests/my-test-
expected.txt': '?'} | 349 git.unstaged_changes = lambda: {'third_party/WebKit/LayoutTests/my-test-
expected.txt': '?'} |
| 350 return_code = self.command.execute(self.command_options(), [], self.tool
) | 350 return_code = self.command.execute(self.command_options(), [], self.tool
) |
| 351 self.assertEqual(return_code, 1) | 351 self.assertEqual(return_code, 1) |
| 352 self.assertLog([ | 352 self.assertLog([ |
| 353 'ERROR: Aborting: there are unstaged baselines:\n', | 353 'ERROR: Aborting: there are unstaged baselines:\n', |
| 354 'ERROR: /mock-checkout/third_party/WebKit/LayoutTests/my-test-expe
cted.txt\n', | 354 'ERROR: /mock-checkout/third_party/WebKit/LayoutTests/my-test-expe
cted.txt\n', |
| 355 ]) | 355 ]) |
| 356 | 356 |
| 357 def test_fill_in_missing_results(self): | 357 def test_fill_in_missing_results(self): |
| 358 test_baseline_set = TestBaselineSet(self.tool) | 358 test_baseline_set = TestBaselineSet(self.tool) |
| 359 test_baseline_set.add('fast/dom/prototype-taco.html', Build('MOCK Try Li
nux', 100)) | 359 test_baseline_set.add('fast/dom/prototype-taco.html', Build('MOCK Try Li
nux', 100)) |
| 360 test_baseline_set.add('fast/dom/prototype-taco.html', Build('MOCK Try Wi
n', 200)) | 360 test_baseline_set.add('fast/dom/prototype-taco.html', Build('MOCK Try Wi
n', 200)) |
| 361 self.command.fill_in_missing_results(test_baseline_set) | 361 self.command.fill_in_missing_results(test_baseline_set) |
| 362 self.assertEqual( | 362 self.assertEqual( |
| 363 test_baseline_set.build_port_pairs('fast/dom/prototype-taco.html'), | 363 test_baseline_set.build_port_pairs('fast/dom/prototype-taco.html'), |
| 364 [ | 364 [ |
| 365 (Build(builder_name='MOCK Try Linux', build_number=100), 'test-l
inux-trusty'), | 365 (Build(builder_name='MOCK Try Linux', build_number=100), 'test-l
inux-trusty'), |
| 366 (Build(builder_name='MOCK Try Win', build_number=200), 'test-win
-win7'), | 366 (Build(builder_name='MOCK Try Win', build_number=200), 'test-win
-win7'), |
| 367 (Build(builder_name='MOCK Try Linux', build_number=100), 'test-m
ac-mac10.11'), | 367 (Build(builder_name='MOCK Try Linux', build_number=100), 'test-m
ac-mac10.11'), |
| 368 ]) | 368 ]) |
| 369 self.assertLog([ | 369 self.assertLog([ |
| 370 'INFO: For fast/dom/prototype-taco.html:\n', | 370 'INFO: For fast/dom/prototype-taco.html:\n', |
| 371 'INFO: Using Build(builder_name=\'MOCK Try Linux\', build_number=100
) to supply results for test-mac-mac10.11.\n', | 371 'INFO: Using Build(builder_name=\'MOCK Try Linux\', build_number=100
) to supply results for test-mac-mac10.11.\n', |
| 372 ]) | 372 ]) |
| 373 |
| 374 def test_fill_in_missing_results_prefers_build_with_same_os_type(self): |
| 375 self.tool.builders = BuilderList({ |
| 376 'MOCK Foo12': { |
| 377 'port_name': 'foo-foo12', |
| 378 'specifiers': ['Foo12', 'Release'], |
| 379 'is_try_builder': True, |
| 380 }, |
| 381 'MOCK Foo45': { |
| 382 'port_name': 'foo-foo45', |
| 383 'specifiers': ['Foo45', 'Release'], |
| 384 'is_try_builder': True, |
| 385 }, |
| 386 'MOCK Bar3': { |
| 387 'port_name': 'bar-bar3', |
| 388 'specifiers': ['Bar3', 'Release'], |
| 389 'is_try_builder': True, |
| 390 }, |
| 391 'MOCK Bar4': { |
| 392 'port_name': 'bar-bar4', |
| 393 'specifiers': ['Bar4', 'Release'], |
| 394 'is_try_builder': True, |
| 395 }, |
| 396 }) |
| 397 test_baseline_set = TestBaselineSet(self.tool) |
| 398 test_baseline_set.add('fast/dom/prototype-taco.html', Build('MOCK Foo12'
, 100)) |
| 399 test_baseline_set.add('fast/dom/prototype-taco.html', Build('MOCK Bar4',
200)) |
| 400 self.command.fill_in_missing_results(test_baseline_set) |
| 401 self.assertEqual( |
| 402 test_baseline_set.build_port_pairs('fast/dom/prototype-taco.html'), |
| 403 [ |
| 404 (Build(builder_name='MOCK Foo12', build_number=100), 'foo-foo12'
), |
| 405 (Build(builder_name='MOCK Bar4', build_number=200), 'bar-bar4'), |
| 406 (Build(builder_name='MOCK Foo12', build_number=100), 'foo-foo45'
), |
| 407 (Build(builder_name='MOCK Bar4', build_number=200), 'bar-bar3'), |
| 408 ]) |
| 409 self.assertLog([ |
| 410 'INFO: For fast/dom/prototype-taco.html:\n', |
| 411 'INFO: Using Build(builder_name=\'MOCK Foo12\', build_number=100) to
supply results for foo-foo45.\n', |
| 412 'INFO: Using Build(builder_name=\'MOCK Bar4\', build_number=200) to
supply results for bar-bar3.\n', |
| 413 ]) |
| OLD | NEW |