| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 142 |
| 143 @staticmethod | 143 @staticmethod |
| 144 def command_options(**kwargs): | 144 def command_options(**kwargs): |
| 145 options = { | 145 options = { |
| 146 'only_changed_tests': False, | 146 'only_changed_tests': False, |
| 147 'dry_run': False, | 147 'dry_run': False, |
| 148 'optimize': True, | 148 'optimize': True, |
| 149 'results_directory': None, | 149 'results_directory': None, |
| 150 'verbose': False, | 150 'verbose': False, |
| 151 'trigger_jobs': False, | 151 'trigger_jobs': False, |
| 152 'fill_missing': False, |
| 152 } | 153 } |
| 153 options.update(kwargs) | 154 options.update(kwargs) |
| 154 return optparse.Values(dict(**options)) | 155 return optparse.Values(dict(**options)) |
| 155 | 156 |
| 156 def test_execute_basic(self): | 157 def test_execute_basic(self): |
| 157 return_code = self.command.execute(self.command_options(), [], self.tool
) | 158 return_code = self.command.execute(self.command_options(), [], self.tool
) |
| 158 self.assertEqual(return_code, 0) | 159 self.assertEqual(return_code, 0) |
| 159 self.assertLog([ | 160 self.assertLog([ |
| 160 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n', | 161 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n', |
| 161 'INFO: Rebaselining fast/dom/prototype-newtest.html\n', | 162 'INFO: Rebaselining fast/dom/prototype-newtest.html\n', |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 | 333 |
| 333 def test_bails_when_there_are_unstaged_baselines(self): | 334 def test_bails_when_there_are_unstaged_baselines(self): |
| 334 git = self.tool.git() | 335 git = self.tool.git() |
| 335 git.unstaged_changes = lambda: {'third_party/WebKit/LayoutTests/my-test-
expected.txt': '?'} | 336 git.unstaged_changes = lambda: {'third_party/WebKit/LayoutTests/my-test-
expected.txt': '?'} |
| 336 return_code = self.command.execute(self.command_options(), [], self.tool
) | 337 return_code = self.command.execute(self.command_options(), [], self.tool
) |
| 337 self.assertEqual(return_code, 1) | 338 self.assertEqual(return_code, 1) |
| 338 self.assertLog([ | 339 self.assertLog([ |
| 339 'ERROR: Aborting: there are unstaged baselines:\n', | 340 'ERROR: Aborting: there are unstaged baselines:\n', |
| 340 'ERROR: /mock-checkout/third_party/WebKit/LayoutTests/my-test-expe
cted.txt\n', | 341 'ERROR: /mock-checkout/third_party/WebKit/LayoutTests/my-test-expe
cted.txt\n', |
| 341 ]) | 342 ]) |
| 343 |
| 344 def test_fill_in_missing_results(self): |
| 345 test_baseline_set = TestBaselineSet(self.tool) |
| 346 test_baseline_set.add('fast/dom/prototype-taco.html', Build('MOCK Try Li
nux', 100)) |
| 347 test_baseline_set.add('fast/dom/prototype-taco.html', Build('MOCK Try Wi
n', 200)) |
| 348 self.command.fill_in_missing_results(test_baseline_set) |
| 349 self.assertEqual( |
| 350 test_baseline_set.build_port_pairs('fast/dom/prototype-taco.html'), |
| 351 [ |
| 352 (Build(builder_name='MOCK Try Linux', build_number=100), 'test-l
inux-trusty'), |
| 353 (Build(builder_name='MOCK Try Win', build_number=200), 'test-win
-win7'), |
| 354 (Build(builder_name='MOCK Try Linux', build_number=100), 'test-m
ac-mac10.11'), |
| 355 ]) |
| 356 self.assertLog([ |
| 357 'INFO: For fast/dom/prototype-taco.html:\n', |
| 358 'INFO: Using Build(builder_name=\'MOCK Try Linux\', build_number=100
) to supply results for test-mac-mac10.11.\n', |
| 359 ]) |
| OLD | NEW |