| 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.rietveld import Rietveld | 9 from webkitpy.common.net.rietveld import Rietveld |
| 10 from webkitpy.common.net.web_mock import MockWeb | 10 from webkitpy.common.net.web_mock import MockWeb |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 'results_directory': None, | 82 'results_directory': None, |
| 83 'verbose': False, | 83 'verbose': False, |
| 84 'trigger_jobs': False, | 84 'trigger_jobs': False, |
| 85 } | 85 } |
| 86 options.update(kwargs) | 86 options.update(kwargs) |
| 87 return optparse.Values(dict(**options)) | 87 return optparse.Values(dict(**options)) |
| 88 | 88 |
| 89 def test_execute_with_issue_number_given(self): | 89 def test_execute_with_issue_number_given(self): |
| 90 self.command.execute(self.command_options(issue=11112222), [], self.tool
) | 90 self.command.execute(self.command_options(issue=11112222), [], self.tool
) |
| 91 self.assertLog([ | 91 self.assertLog([ |
| 92 'INFO: Tests to rebaseline:\n', | |
| 93 'INFO: fast/dom/prototype-newtest.html: MOCK Try Win (5000)\n', | |
| 94 'INFO: svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation
-attr.html: MOCK Try Win (5000)\n', | |
| 95 'INFO: fast/dom/prototype-inheritance.html: MOCK Try Win (5000)\n'
, | |
| 96 'INFO: fast/dom/prototype-taco.html: MOCK Try Win (5000)\n', | |
| 97 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n', | 92 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n', |
| 98 'INFO: Rebaselining fast/dom/prototype-newtest.html\n', | 93 'INFO: Rebaselining fast/dom/prototype-newtest.html\n', |
| 99 'INFO: Rebaselining fast/dom/prototype-taco.html\n', | 94 'INFO: Rebaselining fast/dom/prototype-taco.html\n', |
| 100 'INFO: Rebaselining svg/dynamic-updates/SVGFEDropShadowElement-dom-s
tdDeviation-attr.html\n', | 95 'INFO: Rebaselining svg/dynamic-updates/SVGFEDropShadowElement-dom-s
tdDeviation-attr.html\n', |
| 101 ]) | 96 ]) |
| 102 | 97 |
| 103 def test_execute_with_no_issue_number(self): | 98 def test_execute_with_no_issue_number(self): |
| 104 self.command.execute(self.command_options(), [], self.tool) | 99 self.command.execute(self.command_options(), [], self.tool) |
| 105 self.assertLog(['ERROR: No issue number given and no issue for current b
ranch. This tool requires a CL\n' | 100 self.assertLog(['ERROR: No issue number given and no issue for current b
ranch. This tool requires a CL\n' |
| 106 'to operate on; please run `git cl upload` on this branc
h first, or use the --issue\n' | 101 'to operate on; please run `git cl upload` on this branc
h first, or use the --issue\n' |
| 107 'option to download baselines for another existing CL.\n
']) | 102 'option to download baselines for another existing CL.\n
']) |
| 108 | 103 |
| 109 def test_execute_with_issue_number_from_branch(self): | 104 def test_execute_with_issue_number_from_branch(self): |
| 110 git_cl = GitCL(MockExecutive2()) | 105 git_cl = GitCL(MockExecutive2()) |
| 111 git_cl.get_issue_number = lambda: '11112222' | 106 git_cl.get_issue_number = lambda: '11112222' |
| 112 self.command.git_cl = lambda: git_cl | 107 self.command.git_cl = lambda: git_cl |
| 113 self.command.execute(self.command_options(), [], self.tool) | 108 self.command.execute(self.command_options(), [], self.tool) |
| 114 self.assertLog([ | 109 self.assertLog([ |
| 115 'INFO: Tests to rebaseline:\n', | |
| 116 'INFO: fast/dom/prototype-newtest.html: MOCK Try Win (5000)\n', | |
| 117 'INFO: svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation
-attr.html: MOCK Try Win (5000)\n', | |
| 118 'INFO: fast/dom/prototype-inheritance.html: MOCK Try Win (5000)\n'
, | |
| 119 'INFO: fast/dom/prototype-taco.html: MOCK Try Win (5000)\n', | |
| 120 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n', | 110 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n', |
| 121 'INFO: Rebaselining fast/dom/prototype-newtest.html\n', | 111 'INFO: Rebaselining fast/dom/prototype-newtest.html\n', |
| 122 'INFO: Rebaselining fast/dom/prototype-taco.html\n', | 112 'INFO: Rebaselining fast/dom/prototype-taco.html\n', |
| 123 'INFO: Rebaselining svg/dynamic-updates/SVGFEDropShadowElement-dom-s
tdDeviation-attr.html\n', | 113 'INFO: Rebaselining svg/dynamic-updates/SVGFEDropShadowElement-dom-s
tdDeviation-attr.html\n', |
| 124 ]) | 114 ]) |
| 125 | 115 |
| 126 def test_execute_with_only_changed_tests_option(self): | 116 def test_execute_with_only_changed_tests_option(self): |
| 127 self.command.execute(self.command_options(issue=11112222, only_changed_t
ests=True), [], self.tool) | 117 self.command.execute(self.command_options(issue=11112222, only_changed_t
ests=True), [], self.tool) |
| 128 # svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html | 118 # svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html |
| 129 # is in the list of failed tests, but not in the list of files modified | 119 # is in the list of failed tests, but not in the list of files modified |
| 130 # in the given CL; it should be included because all_tests is set to Tru
e. | 120 # in the given CL; it should be included because all_tests is set to Tru
e. |
| 131 self.assertLog([ | 121 self.assertLog([ |
| 132 'INFO: Tests to rebaseline:\n', | |
| 133 'INFO: fast/dom/prototype-inheritance.html: MOCK Try Win (5000)\n'
, | |
| 134 'INFO: fast/dom/prototype-taco.html: MOCK Try Win (5000)\n', | |
| 135 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n', | 122 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n', |
| 136 'INFO: Rebaselining fast/dom/prototype-taco.html\n', | 123 'INFO: Rebaselining fast/dom/prototype-taco.html\n', |
| 137 ]) | 124 ]) |
| 138 | 125 |
| 139 def test_execute_with_nonexistent_test(self): | 126 def test_execute_with_nonexistent_test(self): |
| 140 self.command.execute(self.command_options(issue=11112222), ['some/non/ex
istent/test.html'], self.tool) | 127 self.command.execute(self.command_options(issue=11112222), ['some/non/ex
istent/test.html'], self.tool) |
| 141 self.assertLog([ | 128 self.assertLog([ |
| 142 'WARNING: /test.checkout/LayoutTests/some/non/existent/test.html not
found, removing from list.\n', | 129 'WARNING: /test.checkout/LayoutTests/some/non/existent/test.html not
found, removing from list.\n', |
| 143 'INFO: No tests to rebaseline; exiting.\n', | 130 'INFO: No tests to rebaseline; exiting.\n', |
| 144 ]) | 131 ]) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 169 | 156 |
| 170 self.assertEqual( | 157 self.assertEqual( |
| 171 self.tool.executive.calls, | 158 self.tool.executive.calls, |
| 172 [ | 159 [ |
| 173 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi
xes', 'txt', | 160 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi
xes', 'txt', |
| 174 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac
o.html']], | 161 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac
o.html']], |
| 175 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't
xt', | 162 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't
xt', |
| 176 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac
o.html', '--build-number', '5000']], | 163 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac
o.html', '--build-number', '5000']], |
| 177 [['python', 'echo', 'optimize-baselines', '--suffixes', 'txt', '
fast/dom/prototype-taco.html']] | 164 [['python', 'echo', 'optimize-baselines', '--suffixes', 'txt', '
fast/dom/prototype-taco.html']] |
| 178 ]) | 165 ]) |
| OLD | NEW |