[LFC] Update the block box/container list
[WebKit-https.git] / Tools / Scripts / webkitpy / tool / commands / download_unittest.py
1 # Copyright (C) 2009, 2011 Google Inc. All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are
5 # met:
6 #
7 #    * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 #    * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer
11 # in the documentation and/or other materials provided with the
12 # distribution.
13 #    * Neither the name of Google Inc. nor the names of its
14 # contributors may be used to endorse or promote products derived from
15 # this software without specific prior written permission.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 import logging
30 import unittest
31
32 from webkitpy.thirdparty.mock import Mock
33 from webkitpy.tool.commands.commandtest import CommandsTest
34 from webkitpy.tool.commands.download import *
35 from webkitpy.tool.mocktool import MockOptions, MockTool
36 from webkitpy.common.checkout.checkout_mock import MockCheckout
37
38 from webkitcorepy import OutputCapture
39
40
41 class AbstractRevertPrepCommandTest(unittest.TestCase):
42     def test_commit_info(self):
43         command = AbstractRevertPrepCommand()
44         tool = MockTool()
45         command.bind_to_tool(tool)
46
47         with OutputCapture(level=logging.INFO) as captured:
48             commit_info = command._commit_info(1234)
49         self.assertEqual(captured.root.log.getvalue(), 'Preparing revert for bug 50000.\n')
50         self.assertTrue(commit_info)
51
52         mock_commit_info = Mock()
53         mock_commit_info.bug_id = lambda: None
54         tool._checkout.commit_info_for_revision = lambda revision: mock_commit_info
55         with OutputCapture(level=logging.INFO) as captured:
56             commit_info = command._commit_info(1234)
57         self.assertEqual(captured.root.log.getvalue(), 'Unable to parse bug number from diff.\n')
58         self.assertEqual(commit_info, mock_commit_info)
59
60     def test_prepare_state(self):
61         command = AbstractRevertPrepCommand()
62         mock_commit_info = MockCheckout().commit_info_for_revision(123)
63         command._commit_info = lambda revision: mock_commit_info
64
65         state = command._prepare_state(None, ["124 123 125", "Reason"], None)
66         self.assertEqual(123, state["revision"])
67         self.assertEqual([123, 124, 125], state["revision_list"])
68
69         self.assertRaises(ScriptError, command._prepare_state, options=None, args=["125 r122  123", "Reason"], tool=None)
70         self.assertRaises(ScriptError, command._prepare_state, options=None, args=["125 foo 123", "Reason"], tool=None)
71
72         command._commit_info = lambda revision: None
73         state = command._prepare_state(None, ["124 123 125", "Reason"], None)
74         self.assertEqual(123, state["revision"])
75         self.assertEqual([123, 124, 125], state["revision_list"])
76
77
78 class DownloadCommandsTest(CommandsTest):
79     def _default_options(self):
80         options = MockOptions()
81         options.build = True
82         options.build_style = "release"
83         options.check_style = True
84         options.check_style_filter = None
85         options.clean = True
86         options.close_bug = True
87         options.comment_bug = True
88         options.force_clean = False
89         options.non_interactive = False
90         options.parent_command = 'MOCK parent command'
91         options.quiet = False
92         options.test = True
93         options.update = True
94         options.architecture = 'MOCK ARCH'
95         options.iterate_on_new_tests = 0
96         options.group = None
97         options.sort_xcode_project = False
98         return options
99
100     def test_build(self):
101         expected_logs = "Updating working directory\nBuilding WebKit\n"
102         self.assert_execute_outputs(Build(), [], options=self._default_options(), expected_logs=expected_logs)
103
104     def test_build_and_test(self):
105         expected_logs = """Updating working directory
106 Building WebKit
107 Running Python unit tests
108 Running Perl unit tests
109 Running JavaScriptCore tests
110 Running run-webkit-tests
111 """
112         self.assert_execute_outputs(BuildAndTest(), [], options=self._default_options(), expected_logs=expected_logs)
113
114     def test_apply_attachment(self):
115         options = self._default_options()
116         options.update = True
117         options.local_commit = True
118         expected_logs = "Updating working directory\nProcessing 1 patch from 1 bug.\nProcessing patch 10000 from bug 50000.\n"
119         self.assert_execute_outputs(ApplyAttachment(), [10000], options=options, expected_logs=expected_logs)
120
121     def test_apply_from_bug(self):
122         options = self._default_options()
123         options.update = True
124         options.local_commit = True
125
126         expected_logs = "Updating working directory\n0 reviewed patches found on bug 50001.\nNo reviewed patches found, looking for unreviewed patches.\n1 patch found on bug 50001.\nProcessing 1 patch from 1 bug.\nProcessing patch 10002 from bug 50001.\n"
127         self.assert_execute_outputs(ApplyFromBug(), [50001], options=options, expected_logs=expected_logs)
128
129         expected_logs = "Updating working directory\n2 reviewed patches found on bug 50000.\nProcessing 2 patches from 1 bug.\nProcessing patch 10000 from bug 50000.\nProcessing patch 10001 from bug 50000.\n"
130         self.assert_execute_outputs(ApplyFromBug(), [50000], options=options, expected_logs=expected_logs)
131
132     def test_apply_watch_list(self):
133         expected_logs = """Processing 1 patch from 1 bug.
134 Updating working directory
135 MOCK run_and_throw_if_fail: ['mock-update-webkit'], cwd=/mock-checkout
136 Processing patch 10000 from bug 50000.
137 MockWatchList: determine_cc_and_messages
138 No bug was updated because no id was given.
139 Result of watchlist: cc "abarth@webkit.org, eric@webkit.org, levin@chromium.org" messages "Message1.
140
141 Message2."
142 """
143         self.assert_execute_outputs(ApplyWatchList(), [10000], options=self._default_options(), expected_logs=expected_logs, tool=MockTool(log_executive=True))
144
145     def test_land(self):
146         expected_logs = """Building WebKit
147 Running Python unit tests
148 Running Perl unit tests
149 Running JavaScriptCore tests
150 Running run-webkit-tests
151 Committed r49824: <https://commits.webkit.org/r49824>
152 Adding comment and closing bug 50000
153 """
154         mock_tool = MockTool()
155         mock_tool.scm().create_patch = Mock(return_value="Patch1\nMockPatch\n")
156         mock_tool.checkout().modified_changelogs = Mock(return_value=[])
157         self.assert_execute_outputs(Land(), [50000], options=self._default_options(), expected_logs=expected_logs, tool=mock_tool)
158         # Make sure we're not calling expensive calls too often.
159         self.assertEqual(mock_tool.scm().create_patch.call_count, 0)
160         self.assertEqual(mock_tool.checkout().modified_changelogs.call_count, 1)
161
162     def test_land_cowhand(self):
163         expected_logs = """MOCK run_and_throw_if_fail: ['mock-prepare-ChangeLog', '--email=MOCK email', '--merge-base=None', 'MockFile1'], cwd=/mock-checkout
164 MOCK run_and_throw_if_fail: ['mock-check-webkit-style', '--git-commit', 'MOCK git commit', '--diff-files', 'MockFile1', '--filter', '-changelog'], cwd=/mock-checkout
165 MOCK run_command: ['ruby', '-I', '/mock-checkout/Websites/bugs.webkit.org/PrettyPatch', '/mock-checkout/Websites/bugs.webkit.org/PrettyPatch/prettify.rb'], cwd=None, input=Patch1
166 MOCK: user.open_url: file://...
167 Was that diff correct?
168 Building WebKit
169 MOCK run_and_throw_if_fail: ['mock-build-webkit', 'ARCHS=MOCK ARCH'], cwd=/mock-checkout, env={'MOCK_ENVIRON_COPY': '1', 'TERM': 'dumb'}
170 Running Python unit tests
171 MOCK run_and_throw_if_fail: ['mock-test-webkitpy'], cwd=/mock-checkout
172 Running Perl unit tests
173 MOCK run_and_throw_if_fail: ['mock-test-webkitperl'], cwd=/mock-checkout
174 Running JavaScriptCore tests
175 MOCK run_and_throw_if_fail: ['mock-run-javacriptcore-tests'], cwd=/mock-checkout
176 Running run-webkit-tests
177 MOCK run_and_throw_if_fail: ['mock-run-webkit-tests', '--quiet'], cwd=/mock-checkout
178 Committed r49824: <https://commits.webkit.org/r49824>
179 Committed r49824: <https://commits.webkit.org/r49824>
180 No bug id provided.
181 """
182         mock_tool = MockTool(log_executive=True)
183         self.assert_execute_outputs(LandCowhand(), [50000], options=self._default_options(), expected_logs=expected_logs, tool=mock_tool)
184
185         expected_logs = "land-cowboy is deprecated, use land-cowhand instead.\n" + expected_logs
186         self.assert_execute_outputs(LandCowboy(), [50000], options=self._default_options(), expected_logs=expected_logs, tool=mock_tool)
187
188     def test_land_red_builders(self):
189         expected_logs = """Building WebKit
190 Running Python unit tests
191 Running Perl unit tests
192 Running JavaScriptCore tests
193 Running run-webkit-tests
194 Committed r49824: <https://commits.webkit.org/r49824>
195 Adding comment and closing bug 50000
196 """
197         mock_tool = MockTool()
198         mock_tool.buildbot.light_tree_on_fire()
199         self.assert_execute_outputs(Land(), [50000], options=self._default_options(), expected_logs=expected_logs, tool=mock_tool)
200
201     def test_check_style(self):
202         expected_logs = """Processing 1 patch from 1 bug.
203 Updating working directory
204 MOCK run_and_throw_if_fail: ['mock-update-webkit'], cwd=/mock-checkout
205 Processing patch 10000 from bug 50000.
206 MOCK run_and_throw_if_fail: ['mock-check-webkit-style', '--git-commit', 'MOCK git commit', '--diff-files', 'MockFile1'], cwd=/mock-checkout
207 """
208         self.assert_execute_outputs(CheckStyle(), [10000], options=self._default_options(), expected_logs=expected_logs, tool=MockTool(log_executive=True))
209
210     def test_build_attachment(self):
211         expected_logs = "Processing 1 patch from 1 bug.\nUpdating working directory\nProcessing patch 10000 from bug 50000.\nBuilding WebKit\n"
212         self.assert_execute_outputs(BuildAttachment(), [10000], options=self._default_options(), expected_logs=expected_logs)
213
214     def test_land_attachment(self):
215         # FIXME: This expected result is imperfect, notice how it's seeing the same patch as still there after it thought it would have cleared the flags.
216         expected_logs = """Processing 1 patch from 1 bug.
217 Updating working directory
218 Processing patch 10000 from bug 50000.
219 Building WebKit
220 Running Python unit tests
221 Running Perl unit tests
222 Running JavaScriptCore tests
223 Running run-webkit-tests
224 Committed r49824: <https://commits.webkit.org/r49824>
225 Not closing bug 50000 as attachment 10000 has review=+.  Assuming there are more patches to land from this bug.
226 """
227         self.assert_execute_outputs(LandAttachment(), [10000], options=self._default_options(), expected_logs=expected_logs)
228
229     def test_land_from_bug(self):
230         # FIXME: This expected result is imperfect, notice how it's seeing the same patch as still there after it thought it would have cleared the flags.
231         expected_logs = """2 reviewed patches found on bug 50000.
232 Processing 2 patches from 1 bug.
233 Updating working directory
234 Processing patch 10000 from bug 50000.
235 Building WebKit
236 Running Python unit tests
237 Running Perl unit tests
238 Running JavaScriptCore tests
239 Running run-webkit-tests
240 Committed r49824: <https://commits.webkit.org/r49824>
241 Not closing bug 50000 as attachment 10000 has review=+.  Assuming there are more patches to land from this bug.
242 Updating working directory
243 Processing patch 10001 from bug 50000.
244 Building WebKit
245 Running Python unit tests
246 Running Perl unit tests
247 Running JavaScriptCore tests
248 Running run-webkit-tests
249 Committed r49824: <https://commits.webkit.org/r49824>
250 Not closing bug 50000 as attachment 10000 has review=+.  Assuming there are more patches to land from this bug.
251 """
252         self.assert_execute_outputs(LandFromBug(), [50000], options=self._default_options(), expected_logs=expected_logs)
253
254     def test_land_from_url(self):
255         # FIXME: This expected result is imperfect, notice how it's seeing the same patch as still there after it thought it would have cleared the flags.
256         expected_logs = """2 patches found on bug 50000.
257 Processing 2 patches from 1 bug.
258 Updating working directory
259 Processing patch 10000 from bug 50000.
260 Building WebKit
261 Running Python unit tests
262 Running Perl unit tests
263 Running JavaScriptCore tests
264 Running run-webkit-tests
265 Committed r49824: <https://commits.webkit.org/r49824>
266 Not closing bug 50000 as attachment 10000 has review=+.  Assuming there are more patches to land from this bug.
267 Updating working directory
268 Processing patch 10001 from bug 50000.
269 Building WebKit
270 Running Python unit tests
271 Running Perl unit tests
272 Running JavaScriptCore tests
273 Running run-webkit-tests
274 Committed r49824: <https://commits.webkit.org/r49824>
275 Not closing bug 50000 as attachment 10000 has review=+.  Assuming there are more patches to land from this bug.
276 """
277         self.assert_execute_outputs(LandFromURL(), ["https://bugs.webkit.org/show_bug.cgi?id=50000"], options=self._default_options(), expected_logs=expected_logs)
278
279     def test_land_no_comment(self):
280         expected_logs = """Building WebKit
281 Running Python unit tests
282 Running Perl unit tests
283 Running JavaScriptCore tests
284 Running run-webkit-tests
285 Committed r49824: <https://commits.webkit.org/r49824>
286 Not updating bug 50000
287 """
288         options = self._default_options()
289         options.comment_bug = False
290         self.assert_execute_outputs(Land(), [50000], options=options, expected_logs=expected_logs)
291
292     def test_land_no_close(self):
293         expected_logs = """Building WebKit
294 Running Python unit tests
295 Running Perl unit tests
296 Running JavaScriptCore tests
297 Running run-webkit-tests
298 Committed r49824: <https://commits.webkit.org/r49824>
299 Commenting without closing bug 50000
300 MOCK bug comment: bug_id=50000, cc=None, see_also=None
301 --- Begin comment ---
302 Committed r49824: <https://commits.webkit.org/r49824>
303 --- End comment ---
304
305 """
306         options = self._default_options()
307         options.close_bug = False
308         self.assert_execute_outputs(Land(), [50000], options=options, expected_logs=expected_logs)
309
310     def test_land_no_comment_no_close(self):
311         expected_logs = """Building WebKit
312 Running Python unit tests
313 Running Perl unit tests
314 Running JavaScriptCore tests
315 Running run-webkit-tests
316 Committed r49824: <https://commits.webkit.org/r49824>
317 Not updating bug 50000
318 """
319         options = self._default_options()
320         options.comment_bug = False
321         options.close_bug = False
322         self.assert_execute_outputs(Land(), [50000], options=options, expected_logs=expected_logs)
323
324     def test_prepare_revert(self):
325         expected_logs = "Preparing revert for bug 50000.\nUpdating working directory\n"
326         self.assert_execute_outputs(PrepareRevert(), [852, "Reason"], options=self._default_options(), expected_logs=expected_logs)
327
328         expected_logs = "prepare-rollout is deprecated, use prepare-revert instead.\n" + expected_logs
329         self.assert_execute_outputs(PrepareRollout(), [852, "Reason"], options=self._default_options(), expected_logs=expected_logs)
330
331     def test_create_revert(self):
332         expected_logs = """Preparing revert for bug 50000.
333 Updating working directory
334 MOCK create_bug
335 bug_title: REGRESSION(r852): Reason
336 bug_description: https://commits.webkit.org/r852 broke the build:
337 Reason
338 component: MOCK component
339 cc: MOCK cc
340 blocked: 50000
341 MOCK add_patch_to_bug: bug_id=60001, description=REVERT of r852, mark_for_review=False, mark_for_commit_queue=True, mark_for_landing=False
342 -- Begin comment --
343 Any committer can land this patch automatically by marking it commit-queue+.  The commit-queue will build and test the patch before landing to ensure that the revert will be successful.  This process takes approximately 15 minutes.
344
345 If you would like to land the revert faster, you can use the following command:
346
347   webkit-patch land-attachment ATTACHMENT_ID
348
349 where ATTACHMENT_ID is the ID of this attachment.
350 -- End comment --
351 """
352         self.assert_execute_outputs(CreateRevert(), [852, "Reason"], options=self._default_options(), expected_logs=expected_logs)
353
354         expected_logs = "create-rollout is deprecated, use create-revert instead.\n" + expected_logs
355         self.assert_execute_outputs(CreateRollout(), [852, "Reason"], options=self._default_options(), expected_logs=expected_logs)
356
357     def test_create_revert_multiple_revision(self):
358         expected_logs = """Preparing revert for bug 50000.
359 Preparing revert for bug 50000.
360 Unable to parse bug number from diff.
361 Updating working directory
362 MOCK create_bug
363 bug_title: REGRESSION(r852): Reason
364 bug_description: https://commits.webkit.org/r852 broke the build:
365 Reason
366 component: MOCK component
367 cc: MOCK cc
368 blocked: 50000, 50000
369 MOCK add_patch_to_bug: bug_id=60001, description=REVERT of r852, mark_for_review=False, mark_for_commit_queue=True, mark_for_landing=False
370 -- Begin comment --
371 Any committer can land this patch automatically by marking it commit-queue+.  The commit-queue will build and test the patch before landing to ensure that the revert will be successful.  This process takes approximately 15 minutes.
372
373 If you would like to land the revert faster, you can use the following command:
374
375   webkit-patch land-attachment ATTACHMENT_ID
376
377 where ATTACHMENT_ID is the ID of this attachment.
378 -- End comment --
379 """
380         self.assert_execute_outputs(CreateRevert(), ["855 852 854", "Reason"], options=self._default_options(), expected_logs=expected_logs)
381
382     def test_create_revert_multiple_revision_with_one_resolved(self):
383         expected_logs = """Preparing revert for bug 50000.
384 Unable to parse bug number from diff.
385 Preparing revert for bug 50004.
386 Updating working directory
387 MOCK create_bug
388 bug_title: REGRESSION(r852): Reason
389 bug_description: https://commits.webkit.org/r852 broke the build:
390 Reason
391 component: MOCK component
392 cc: MOCK cc
393 blocked: 50000, 50004
394 MOCK reopen_bug 50004 with comment 'Re-opened since this is blocked by bug 60001'
395 MOCK add_patch_to_bug: bug_id=60001, description=REVERT of r852, mark_for_review=False, mark_for_commit_queue=True, mark_for_landing=False
396 -- Begin comment --
397 Any committer can land this patch automatically by marking it commit-queue+.  The commit-queue will build and test the patch before landing to ensure that the revert will be successful.  This process takes approximately 15 minutes.
398
399 If you would like to land the revert faster, you can use the following command:
400
401   webkit-patch land-attachment ATTACHMENT_ID
402
403 where ATTACHMENT_ID is the ID of this attachment.
404 -- End comment --
405 """
406         self.assert_execute_outputs(CreateRevert(), ["855 852 3001", "Reason"], options=self._default_options(), expected_logs=expected_logs)
407
408     def test_create_revert_resolved(self):
409         expected_logs = """Preparing revert for bug 50004.
410 Updating working directory
411 MOCK create_bug
412 bug_title: REGRESSION(r3001): Reason
413 bug_description: https://commits.webkit.org/r3001 broke the build:
414 Reason
415 component: MOCK component
416 cc: MOCK cc
417 blocked: 50004
418 MOCK reopen_bug 50004 with comment 'Re-opened since this is blocked by bug 60001'
419 MOCK add_patch_to_bug: bug_id=60001, description=REVERT of r3001, mark_for_review=False, mark_for_commit_queue=True, mark_for_landing=False
420 -- Begin comment --
421 Any committer can land this patch automatically by marking it commit-queue+.  The commit-queue will build and test the patch before landing to ensure that the revert will be successful.  This process takes approximately 15 minutes.
422
423 If you would like to land the revert faster, you can use the following command:
424
425   webkit-patch land-attachment ATTACHMENT_ID
426
427 where ATTACHMENT_ID is the ID of this attachment.
428 -- End comment --
429 """
430         self.assert_execute_outputs(CreateRevert(), [3001, "Reason"], options=self._default_options(), expected_logs=expected_logs)
431
432     def test_create_revert_multiple_resolved(self):
433         expected_logs = """Preparing revert for bug 50005.
434 Preparing revert for bug 50006.
435 Preparing revert for bug 50004.
436 Updating working directory
437 MOCK create_bug
438 bug_title: REGRESSION(r963): Reason
439 bug_description: https://commits.webkit.org/r963 broke the build:
440 Reason
441 component: MOCK component
442 cc: MOCK cc
443 blocked: 50005, 50006, 50004
444 MOCK reopen_bug 50005 with comment 'Re-opened since this is blocked by bug 60001'
445 MOCK reopen_bug 50006 with comment 'Re-opened since this is blocked by bug 60001'
446 MOCK reopen_bug 50004 with comment 'Re-opened since this is blocked by bug 60001'
447 MOCK add_patch_to_bug: bug_id=60001, description=REVERT of r963, mark_for_review=False, mark_for_commit_queue=True, mark_for_landing=False
448 -- Begin comment --
449 Any committer can land this patch automatically by marking it commit-queue+.  The commit-queue will build and test the patch before landing to ensure that the revert will be successful.  This process takes approximately 15 minutes.
450
451 If you would like to land the revert faster, you can use the following command:
452
453   webkit-patch land-attachment ATTACHMENT_ID
454
455 where ATTACHMENT_ID is the ID of this attachment.
456 -- End comment --
457 """
458         self.assert_execute_outputs(CreateRevert(), ["987 3001 963", "Reason"], options=self._default_options(), expected_logs=expected_logs)
459
460     def test_revert(self):
461         expected_logs = """Preparing revert for bug 50000.
462 Updating working directory
463 MOCK: user.open_url: file://...
464 Was that diff correct?
465 Building WebKit
466 Committed r49824: <https://commits.webkit.org/r49824>
467 MOCK reopen_bug 50000 with comment 'Reverted r852 for reason:
468
469 Reason
470
471 Committed r49824: <https://commits.webkit.org/r49824>'
472 """
473         self.assert_execute_outputs(Revert(), [852, "Reason", "Description"], options=self._default_options(), expected_logs=expected_logs)
474
475         expected_logs = "rollout is deprecated, use revert instead.\n" + expected_logs
476         self.assert_execute_outputs(Rollout(), [852, "Reason", "Description"], options=self._default_options(), expected_logs=expected_logs)
477
478     def test_revert_two_revisions(self):
479         expected_logs = """Preparing revert for bug 50000.
480 Preparing revert for bug 50005.
481 Updating working directory
482 MOCK: user.open_url: file://...
483 Was that diff correct?
484 Building WebKit
485 Committed r49824: <https://commits.webkit.org/r49824>
486 MOCK reopen_bug 50000 with comment 'Reverted r852 and r963 for reason:
487
488 Reason
489
490 Committed r49824: <https://commits.webkit.org/r49824>'
491 MOCK reopen_bug 50005 with comment 'Reverted r852 and r963 for reason:
492
493 Reason
494
495 Committed r49824: <https://commits.webkit.org/r49824>'
496 """
497         self.assert_execute_outputs(Revert(), ["852 963", "Reason", "Description"], options=self._default_options(), expected_logs=expected_logs)
498
499     def test_revert_multiple_revisions(self):
500         expected_logs = """Preparing revert for bug 50000.
501 Preparing revert for bug 50005.
502 Preparing revert for bug 50004.
503 Updating working directory
504 MOCK: user.open_url: file://...
505 Was that diff correct?
506 Building WebKit
507 Committed r49824: <https://commits.webkit.org/r49824>
508 MOCK reopen_bug 50000 with comment 'Reverted r852, r963, and r3001 for reason:
509
510 Reason
511
512 Committed r49824: <https://commits.webkit.org/r49824>'
513 MOCK reopen_bug 50005 with comment 'Reverted r852, r963, and r3001 for reason:
514
515 Reason
516
517 Committed r49824: <https://commits.webkit.org/r49824>'
518 MOCK reopen_bug 50004 with comment 'Reverted r852, r963, and r3001 for reason:
519
520 Reason
521
522 Committed r49824: <https://commits.webkit.org/r49824>'
523 """
524         self.assert_execute_outputs(Revert(), ["852 3001 963", "Reason", "Description"], options=self._default_options(), expected_logs=expected_logs)
525
526     def test_revert_multiple_revisions_with_a_missing_bug_id(self):
527         expected_logs = """Preparing revert for bug 50000.
528 Preparing revert for bug 50005.
529 Unable to parse bug number from diff.
530 Updating working directory
531 MOCK: user.open_url: file://...
532 Was that diff correct?
533 Building WebKit
534 Committed r49824: <https://commits.webkit.org/r49824>
535 MOCK reopen_bug 50000 with comment 'Reverted r852, r963, and r999 for reason:
536
537 Reason
538
539 Committed r49824: <https://commits.webkit.org/r49824>'
540 MOCK reopen_bug 50005 with comment 'Reverted r852, r963, and r999 for reason:
541
542 Reason
543
544 Committed r49824: <https://commits.webkit.org/r49824>'
545 """
546         self.assert_execute_outputs(Revert(), ["852 999 963", "Reason", "Description"], options=self._default_options(), expected_logs=expected_logs)