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 13 matching lines...) Expand all Loading... |
24 LoggingTestCase.setUp(self) | 24 LoggingTestCase.setUp(self) |
25 web = MockWeb(urls={ | 25 web = MockWeb(urls={ |
26 'https://codereview.chromium.org/api/11112222': json.dumps({ | 26 'https://codereview.chromium.org/api/11112222': json.dumps({ |
27 'patchsets': [1, 2], | 27 'patchsets': [1, 2], |
28 }), | 28 }), |
29 'https://codereview.chromium.org/api/11112222/2': json.dumps({ | 29 'https://codereview.chromium.org/api/11112222/2': json.dumps({ |
30 'try_job_results': [ | 30 'try_job_results': [ |
31 { | 31 { |
32 'builder': 'MOCK Try Win', | 32 'builder': 'MOCK Try Win', |
33 'buildnumber': 5000, | 33 'buildnumber': 5000, |
| 34 'result': 0, |
34 }, | 35 }, |
35 { | 36 { |
36 'builder': 'MOCK Mac Try', | 37 'builder': 'MOCK Try Mac', |
37 'buildnumber': 4000, | 38 'buildnumber': 4000, |
| 39 'result': 0, |
38 }, | 40 }, |
39 ], | 41 ], |
40 'files': { | 42 'files': { |
41 'third_party/WebKit/LayoutTests/fast/dom/prototype-inheritan
ce.html': {'status': 'M'}, | 43 'third_party/WebKit/LayoutTests/fast/dom/prototype-inheritan
ce.html': {'status': 'M'}, |
42 'third_party/WebKit/LayoutTests/fast/dom/prototype-taco.html
': {'status': 'M'}, | 44 'third_party/WebKit/LayoutTests/fast/dom/prototype-taco.html
': {'status': 'M'}, |
43 }, | 45 }, |
44 }), | 46 }), |
45 }) | 47 }) |
46 self.tool.builders = BuilderList({ | 48 self.tool.builders = BuilderList({ |
47 "MOCK Try Win": { | 49 "MOCK Try Win": { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 'INFO: Rebaselining svg/dynamic-updates/SVGFEDropShadowElement-dom-s
tdDeviation-attr.html\n', | 102 'INFO: Rebaselining svg/dynamic-updates/SVGFEDropShadowElement-dom-s
tdDeviation-attr.html\n', |
101 ]) | 103 ]) |
102 | 104 |
103 def test_execute_with_no_issue_number(self): | 105 def test_execute_with_no_issue_number(self): |
104 self.command.execute(self.command_options(), [], self.tool) | 106 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' | 107 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' | 108 '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
']) | 109 'option to download baselines for another existing CL.\n
']) |
108 | 110 |
109 def test_execute_with_issue_number_from_branch(self): | 111 def test_execute_with_issue_number_from_branch(self): |
110 git_cl = GitCL(MockExecutive2()) | 112 git_cl = GitCL(self.tool) |
111 git_cl.get_issue_number = lambda: '11112222' | 113 git_cl.get_issue_number = lambda: '11112222' |
112 self.command.git_cl = lambda: git_cl | 114 self.command.git_cl = lambda: git_cl |
113 self.command.execute(self.command_options(), [], self.tool) | 115 self.command.execute(self.command_options(), [], self.tool) |
114 self.assertLog([ | 116 self.assertLog([ |
115 'INFO: Tests to rebaseline:\n', | 117 'INFO: Tests to rebaseline:\n', |
116 'INFO: fast/dom/prototype-newtest.html: MOCK Try Win (5000)\n', | 118 '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', | 119 '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'
, | 120 'INFO: fast/dom/prototype-inheritance.html: MOCK Try Win (5000)\n'
, |
119 'INFO: fast/dom/prototype-taco.html: MOCK Try Win (5000)\n', | 121 'INFO: fast/dom/prototype-taco.html: MOCK Try Win (5000)\n', |
120 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n', | 122 'INFO: Rebaselining fast/dom/prototype-inheritance.html\n', |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 171 |
170 self.assertEqual( | 172 self.assertEqual( |
171 self.tool.executive.calls, | 173 self.tool.executive.calls, |
172 [ | 174 [ |
173 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi
xes', 'txt', | 175 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi
xes', 'txt', |
174 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac
o.html']], | 176 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac
o.html']], |
175 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't
xt', | 177 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't
xt', |
176 '--builder', 'MOCK Try Win', '--test', 'fast/dom/prototype-tac
o.html', '--build-number', '5000']], | 178 '--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']] | 179 [['python', 'echo', 'optimize-baselines', '--suffixes', 'txt', '
fast/dom/prototype-taco.html']] |
178 ]) | 180 ]) |
| 181 |
| 182 def test_trigger_jobs_for_missing_builds_empty_list(self): |
| 183 # Passing in no builds implies that no try jobs were started. |
| 184 self.assertTrue(self.command.trigger_jobs_for_missing_builds([])) |
| 185 self.assertEqual( |
| 186 self.tool.executive.calls, |
| 187 [['git', 'cl', 'try', '-b', 'MOCK Try Linux'], ['git', 'cl', 'try',
'-b', 'MOCK Try Win']]) |
| 188 self.assertLog([ |
| 189 'INFO: Triggering try jobs for:\n', |
| 190 'INFO: MOCK Try Linux\n', |
| 191 'INFO: MOCK Try Win\n', |
| 192 ]) |
| 193 |
| 194 def test_trigger_jobs_for_missing_builds_started_and_successful(self): |
| 195 # A build number of None implies that a job has been started but not fin
ished yet. |
| 196 self.assertTrue(self.command.trigger_jobs_for_missing_builds([ |
| 197 Build('MOCK Try Linux', None), |
| 198 Build('MOCK Try Win', 123), |
| 199 ])) |
| 200 self.assertEqual(self.tool.executive.calls, []) |
| 201 self.assertLog([ |
| 202 'INFO: There are existing pending builds for:\n', |
| 203 'INFO: MOCK Try Linux\n', |
| 204 ]) |
| 205 |
| 206 def test_trigger_jobs_for_missing_builds_one_started(self): |
| 207 self.assertTrue(self.command.trigger_jobs_for_missing_builds([ |
| 208 Build('MOCK Try Linux', None), |
| 209 ])) |
| 210 self.assertEqual(self.tool.executive.calls, [['git', 'cl', 'try', '-b',
'MOCK Try Win']]) |
| 211 self.assertLog([ |
| 212 'INFO: There are existing pending builds for:\n', |
| 213 'INFO: MOCK Try Linux\n', |
| 214 'INFO: Triggering try jobs for:\n', |
| 215 'INFO: MOCK Try Win\n', |
| 216 ]) |
OLD | NEW |