[webkit-patch] Use identifiers when posting to bugzilla
[WebKit-https.git] / Tools / Scripts / webkitpy / tool / commands / download_unittest.py
index 26841b0b10805296db90b45cacdf84a07aa10bc4..6b168c13f17eef78afb455bb09a253592efbeca8 100644 (file)
@@ -26,7 +26,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-import logging
 import unittest
 
 from webkitpy.thirdparty.mock import Mock
@@ -36,6 +35,7 @@ from webkitpy.tool.mocktool import MockOptions, MockTool
 from webkitpy.common.checkout.checkout_mock import MockCheckout
 
 from webkitcorepy import OutputCapture
+from webkitscmpy import mocks, Commit
 
 
 class AbstractRevertPrepCommandTest(unittest.TestCase):
@@ -97,6 +97,23 @@ class DownloadCommandsTest(CommandsTest):
         options.sort_xcode_project = False
         return options
 
+    def mock_svn_remote(self):
+        repo = mocks.remote.Svn('svn.webkit.org/repository/webkit')
+        repo.commits['trunk'].append(Commit(
+            author=dict(name='Dmitry Titov', emails=['dimich@chromium.org']),
+            identifier='5@trunk',
+            revision=49824,
+            timestamp=1601668000,
+            message=
+                'Manual Test for crash caused by JS accessing DOMWindow which is disconnected from the Frame.\n'
+                'https://bugs.webkit.org/show_bug.cgi?id=30544\n'
+                '\n'
+                'Reviewed by Darin Adler.\n'
+                '\n'
+                '    manual-tests/crash-on-accessing-domwindow-without-frame.html: Added.\n',
+        ))
+        return repo
+
     def test_build(self):
         expected_logs = "Updating working directory\nBuilding WebKit\n"
         self.assert_execute_outputs(Build(), [], options=self._default_options(), expected_logs=expected_logs)
@@ -151,13 +168,14 @@ Running run-webkit-tests
 Committed r49824: <https://commits.webkit.org/r49824>
 Adding comment and closing bug 50000
 """
-        mock_tool = MockTool()
-        mock_tool.scm().create_patch = Mock(return_value="Patch1\nMockPatch\n")
-        mock_tool.checkout().modified_changelogs = Mock(return_value=[])
-        self.assert_execute_outputs(Land(), [50000], options=self._default_options(), expected_logs=expected_logs, tool=mock_tool)
-        # Make sure we're not calling expensive calls too often.
-        self.assertEqual(mock_tool.scm().create_patch.call_count, 0)
-        self.assertEqual(mock_tool.checkout().modified_changelogs.call_count, 1)
+        with self.mock_svn_remote():
+            mock_tool = MockTool()
+            mock_tool.scm().create_patch = Mock(return_value="Patch1\nMockPatch\n")
+            mock_tool.checkout().modified_changelogs = Mock(return_value=[])
+            self.assert_execute_outputs(Land(), [50000], options=self._default_options(), expected_logs=expected_logs, tool=mock_tool)
+            # Make sure we're not calling expensive calls too often.
+            self.assertEqual(mock_tool.scm().create_patch.call_count, 0)
+            self.assertEqual(mock_tool.checkout().modified_changelogs.call_count, 1)
 
     def test_land_cowhand(self):
         expected_logs = """MOCK run_and_throw_if_fail: ['mock-prepare-ChangeLog', '--email=MOCK email', '--merge-base=None', 'MockFile1'], cwd=/mock-checkout
@@ -176,14 +194,15 @@ MOCK run_and_throw_if_fail: ['mock-run-javacriptcore-tests'], cwd=/mock-checkout
 Running run-webkit-tests
 MOCK run_and_throw_if_fail: ['mock-run-webkit-tests', '--quiet'], cwd=/mock-checkout
 Committed r49824: <https://commits.webkit.org/r49824>
-Committed r49824: <https://commits.webkit.org/r49824>
+Committed 5@main: <https://commits.webkit.org/5@main>
 No bug id provided.
 """
-        mock_tool = MockTool(log_executive=True)
-        self.assert_execute_outputs(LandCowhand(), [50000], options=self._default_options(), expected_logs=expected_logs, tool=mock_tool)
+        with self.mock_svn_remote():
+            mock_tool = MockTool(log_executive=True)
+            self.assert_execute_outputs(LandCowhand(), [50000], options=self._default_options(), expected_logs=expected_logs, tool=mock_tool)
 
-        expected_logs = "land-cowboy is deprecated, use land-cowhand instead.\n" + expected_logs
-        self.assert_execute_outputs(LandCowboy(), [50000], options=self._default_options(), expected_logs=expected_logs, tool=mock_tool)
+            expected_logs = "land-cowboy is deprecated, use land-cowhand instead.\n" + expected_logs
+            self.assert_execute_outputs(LandCowboy(), [50000], options=self._default_options(), expected_logs=expected_logs, tool=mock_tool)
 
     def test_land_red_builders(self):
         expected_logs = """Building WebKit
@@ -194,9 +213,10 @@ Running run-webkit-tests
 Committed r49824: <https://commits.webkit.org/r49824>
 Adding comment and closing bug 50000
 """
-        mock_tool = MockTool()
-        mock_tool.buildbot.light_tree_on_fire()
-        self.assert_execute_outputs(Land(), [50000], options=self._default_options(), expected_logs=expected_logs, tool=mock_tool)
+        with self.mock_svn_remote():
+            mock_tool = MockTool()
+            mock_tool.buildbot.light_tree_on_fire()
+            self.assert_execute_outputs(Land(), [50000], options=self._default_options(), expected_logs=expected_logs, tool=mock_tool)
 
     def test_check_style(self):
         expected_logs = """Processing 1 patch from 1 bug.
@@ -224,7 +244,8 @@ Running run-webkit-tests
 Committed r49824: <https://commits.webkit.org/r49824>
 Not closing bug 50000 as attachment 10000 has review=+.  Assuming there are more patches to land from this bug.
 """
-        self.assert_execute_outputs(LandAttachment(), [10000], options=self._default_options(), expected_logs=expected_logs)
+        with self.mock_svn_remote():
+            self.assert_execute_outputs(LandAttachment(), [10000], options=self._default_options(), expected_logs=expected_logs)
 
     def test_land_from_bug(self):
         # 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.
@@ -249,7 +270,8 @@ Running run-webkit-tests
 Committed r49824: <https://commits.webkit.org/r49824>
 Not closing bug 50000 as attachment 10000 has review=+.  Assuming there are more patches to land from this bug.
 """
-        self.assert_execute_outputs(LandFromBug(), [50000], options=self._default_options(), expected_logs=expected_logs)
+        with self.mock_svn_remote():
+            self.assert_execute_outputs(LandFromBug(), [50000], options=self._default_options(), expected_logs=expected_logs)
 
     def test_land_from_url(self):
         # 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.
@@ -274,7 +296,8 @@ Running run-webkit-tests
 Committed r49824: <https://commits.webkit.org/r49824>
 Not closing bug 50000 as attachment 10000 has review=+.  Assuming there are more patches to land from this bug.
 """
-        self.assert_execute_outputs(LandFromURL(), ["https://bugs.webkit.org/show_bug.cgi?id=50000"], options=self._default_options(), expected_logs=expected_logs)
+        with self.mock_svn_remote():
+            self.assert_execute_outputs(LandFromURL(), ["https://bugs.webkit.org/show_bug.cgi?id=50000"], options=self._default_options(), expected_logs=expected_logs)
 
     def test_land_no_comment(self):
         expected_logs = """Building WebKit
@@ -285,9 +308,10 @@ Running run-webkit-tests
 Committed r49824: <https://commits.webkit.org/r49824>
 Not updating bug 50000
 """
-        options = self._default_options()
-        options.comment_bug = False
-        self.assert_execute_outputs(Land(), [50000], options=options, expected_logs=expected_logs)
+        with self.mock_svn_remote():
+            options = self._default_options()
+            options.comment_bug = False
+            self.assert_execute_outputs(Land(), [50000], options=options, expected_logs=expected_logs)
 
     def test_land_no_close(self):
         expected_logs = """Building WebKit
@@ -299,13 +323,14 @@ Committed r49824: <https://commits.webkit.org/r49824>
 Commenting without closing bug 50000
 MOCK bug comment: bug_id=50000, cc=None, see_also=None
 --- Begin comment ---
-Committed r49824: <https://commits.webkit.org/r49824>
+Committed 5@main: <https://commits.webkit.org/5@main>
 --- End comment ---
 
 """
-        options = self._default_options()
-        options.close_bug = False
-        self.assert_execute_outputs(Land(), [50000], options=options, expected_logs=expected_logs)
+        with self.mock_svn_remote():
+            options = self._default_options()
+            options.close_bug = False
+            self.assert_execute_outputs(Land(), [50000], options=options, expected_logs=expected_logs)
 
     def test_land_no_comment_no_close(self):
         expected_logs = """Building WebKit
@@ -316,10 +341,11 @@ Running run-webkit-tests
 Committed r49824: <https://commits.webkit.org/r49824>
 Not updating bug 50000
 """
-        options = self._default_options()
-        options.comment_bug = False
-        options.close_bug = False
-        self.assert_execute_outputs(Land(), [50000], options=options, expected_logs=expected_logs)
+        with self.mock_svn_remote():
+            options = self._default_options()
+            options.comment_bug = False
+            options.close_bug = False
+            self.assert_execute_outputs(Land(), [50000], options=options, expected_logs=expected_logs)
 
     def test_prepare_revert(self):
         expected_logs = "Preparing revert for bug 50000.\nUpdating working directory\n"
@@ -468,12 +494,13 @@ MOCK reopen_bug 50000 with comment 'Reverted r852 for reason:
 
 Reason
 
-Committed r49824: <https://commits.webkit.org/r49824>'
+Committed 5@main: <https://commits.webkit.org/5@main>'
 """
-        self.assert_execute_outputs(Revert(), [852, "Reason", "Description"], options=self._default_options(), expected_logs=expected_logs)
+        with self.mock_svn_remote():
+            self.assert_execute_outputs(Revert(), [852, "Reason", "Description"], options=self._default_options(), expected_logs=expected_logs)
 
-        expected_logs = "rollout is deprecated, use revert instead.\n" + expected_logs
-        self.assert_execute_outputs(Rollout(), [852, "Reason", "Description"], options=self._default_options(), expected_logs=expected_logs)
+            expected_logs = "rollout is deprecated, use revert instead.\n" + expected_logs
+            self.assert_execute_outputs(Rollout(), [852, "Reason", "Description"], options=self._default_options(), expected_logs=expected_logs)
 
     def test_revert_two_revisions(self):
         expected_logs = """Preparing revert for bug 50000.
@@ -487,14 +514,15 @@ MOCK reopen_bug 50000 with comment 'Reverted r852 and r963 for reason:
 
 Reason
 
-Committed r49824: <https://commits.webkit.org/r49824>'
+Committed 5@main: <https://commits.webkit.org/5@main>'
 MOCK reopen_bug 50005 with comment 'Reverted r852 and r963 for reason:
 
 Reason
 
-Committed r49824: <https://commits.webkit.org/r49824>'
+Committed 5@main: <https://commits.webkit.org/5@main>'
 """
-        self.assert_execute_outputs(Revert(), ["852 963", "Reason", "Description"], options=self._default_options(), expected_logs=expected_logs)
+        with self.mock_svn_remote():
+            self.assert_execute_outputs(Revert(), ["852 963", "Reason", "Description"], options=self._default_options(), expected_logs=expected_logs)
 
     def test_revert_multiple_revisions(self):
         expected_logs = """Preparing revert for bug 50000.
@@ -509,19 +537,20 @@ MOCK reopen_bug 50000 with comment 'Reverted r852, r963, and r3001 for reason:
 
 Reason
 
-Committed r49824: <https://commits.webkit.org/r49824>'
+Committed 5@main: <https://commits.webkit.org/5@main>'
 MOCK reopen_bug 50005 with comment 'Reverted r852, r963, and r3001 for reason:
 
 Reason
 
-Committed r49824: <https://commits.webkit.org/r49824>'
+Committed 5@main: <https://commits.webkit.org/5@main>'
 MOCK reopen_bug 50004 with comment 'Reverted r852, r963, and r3001 for reason:
 
 Reason
 
-Committed r49824: <https://commits.webkit.org/r49824>'
+Committed 5@main: <https://commits.webkit.org/5@main>'
 """
-        self.assert_execute_outputs(Revert(), ["852 3001 963", "Reason", "Description"], options=self._default_options(), expected_logs=expected_logs)
+        with self.mock_svn_remote():
+            self.assert_execute_outputs(Revert(), ["852 3001 963", "Reason", "Description"], options=self._default_options(), expected_logs=expected_logs)
 
     def test_revert_multiple_revisions_with_a_missing_bug_id(self):
         expected_logs = """Preparing revert for bug 50000.
@@ -536,11 +565,12 @@ MOCK reopen_bug 50000 with comment 'Reverted r852, r963, and r999 for reason:
 
 Reason
 
-Committed r49824: <https://commits.webkit.org/r49824>'
+Committed 5@main: <https://commits.webkit.org/5@main>'
 MOCK reopen_bug 50005 with comment 'Reverted r852, r963, and r999 for reason:
 
 Reason
 
-Committed r49824: <https://commits.webkit.org/r49824>'
+Committed 5@main: <https://commits.webkit.org/5@main>'
 """
-        self.assert_execute_outputs(Revert(), ["852 999 963", "Reason", "Description"], options=self._default_options(), expected_logs=expected_logs)
+        with self.mock_svn_remote():
+            self.assert_execute_outputs(Revert(), ["852 999 963", "Reason", "Description"], options=self._default_options(), expected_logs=expected_logs)