[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

eric at webkit.org eric at webkit.org
Wed Dec 22 18:27:04 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 0f763c81512ce0165e0e551e34f822bb75e9d55a
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Dec 11 01:35:42 2010 +0000

    2010-12-10  Eric Seidel  <eric at webkit.org>
    
            Reviewed by Adam Barth.
    
            Teach webkitpy how to follow duplicate chains when posting comments on flake bugs
            https://bugs.webkit.org/show_bug.cgi?id=50853
    
            I also discovered when doing this that the code was posting
            the comment on the wrong bug, but that's fixed here too.
    
            * Scripts/webkitpy/common/net/bugzilla/bug.py:
            * Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
            * Scripts/webkitpy/tool/bot/flakytestreporter.py:
            * Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py:
            * Scripts/webkitpy/tool/commands/queues_unittest.py:
            * Scripts/webkitpy/tool/mocktool.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73823 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 2f238b1..3de173c 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,20 @@
+2010-12-10  Eric Seidel  <eric at webkit.org>
+
+        Reviewed by Adam Barth.
+
+        Teach webkitpy how to follow duplicate chains when posting comments on flake bugs
+        https://bugs.webkit.org/show_bug.cgi?id=50853
+
+        I also discovered when doing this that the code was posting
+        the comment on the wrong bug, but that's fixed here too.
+
+        * Scripts/webkitpy/common/net/bugzilla/bug.py:
+        * Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
+        * Scripts/webkitpy/tool/bot/flakytestreporter.py:
+        * Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py:
+        * Scripts/webkitpy/tool/commands/queues_unittest.py:
+        * Scripts/webkitpy/tool/mocktool.py:
+
 2010-12-10  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by John Sullivan.
diff --git a/WebKitTools/Scripts/webkitpy/common/net/bugzilla/bug.py b/WebKitTools/Scripts/webkitpy/common/net/bugzilla/bug.py
index 2cb4bc8..855049e 100644
--- a/WebKitTools/Scripts/webkitpy/common/net/bugzilla/bug.py
+++ b/WebKitTools/Scripts/webkitpy/common/net/bugzilla/bug.py
@@ -72,6 +72,9 @@ class Bug(object):
     def is_closed(self):
         return not self.is_open()
 
+    def duplicate_of(self):
+        return self.bug_dictionary.get('dup_id', None)
+
     # Rarely do we actually want obsolete attachments
     def attachments(self, include_obsolete=False):
         attachments = self.bug_dictionary["attachments"]
diff --git a/WebKitTools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py b/WebKitTools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
index 2e6b7e8..b370fc1 100644
--- a/WebKitTools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
+++ b/WebKitTools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py
@@ -302,10 +302,12 @@ class Bugzilla(object):
         bug["id"] = int(soup.find("bug_id").string)
         bug["title"] = self._string_contents(soup.find("short_desc"))
         bug["bug_status"] = self._string_contents(soup.find("bug_status"))
+        dup_id = soup.find("dup_id")
+        if dup_id:
+            bug["dup_id"] = self._string_contents(dup_id)
         bug["reporter_email"] = self._string_contents(soup.find("reporter"))
         bug["assigned_to_email"] = self._string_contents(soup.find("assigned_to"))
-        bug["cc_emails"] = [self._string_contents(element)
-                            for element in soup.findAll('cc')]
+        bug["cc_emails"] = [self._string_contents(element) for element in soup.findAll('cc')]
         bug["attachments"] = [self._parse_attachment_element(element, bug["id"]) for element in soup.findAll('attachment')]
         return bug
 
diff --git a/WebKitTools/Scripts/webkitpy/tool/bot/flakytestreporter.py b/WebKitTools/Scripts/webkitpy/tool/bot/flakytestreporter.py
index 81d8a6e..6dd0aab 100644
--- a/WebKitTools/Scripts/webkitpy/tool/bot/flakytestreporter.py
+++ b/WebKitTools/Scripts/webkitpy/tool/bot/flakytestreporter.py
@@ -63,12 +63,15 @@ class FlakyTestReporter(object):
             _log.warn("Found %s %s matching '%s' from the %s (%s), using the first." % (pluralize('bug', len(bugs)), bugs, flaky_test, self._bot_name, bot_email))
         return bugs[0]
 
+    def _view_source_url_for_test(self, test_path):
+        return urls.view_source_url("LayoutTests/%s" % test_path)
+
     def _create_bug_for_flaky_test(self, flaky_test, author_emails, latest_flake_message):
         format_values = {
             'test': flaky_test,
             'authors': join_with_separators(sorted(author_emails)),
             'flake_message': latest_flake_message,
-            'test_url': urls.view_source_url(flaky_test),
+            'test_url': self._view_source_url_for_test(flaky_test),
             'bot_name': self._bot_name,
         }
         title = "Flaky Test: %(test)s" % format_values
@@ -106,6 +109,18 @@ If you would like to track this test fix with another bug, please close this bug
         flake_message = "The %s just saw %s flake while processing attachment %s on bug %s." % (self._bot_name, flaky_test, patch.id(), patch.bug_id())
         return "%s\n%s" % (flake_message, self._bot_information())
 
+    def _follow_duplicate_chain(self, bug):
+        while bug.is_closed() and bug.duplicate_of():
+            bug = self._tool.bugs.fetch_bug(bug.duplicate_of())
+        return bug
+
+    # Maybe this logic should move into Bugzilla? a reopen=True arg to post_comment?
+    def _update_bug_for_flaky_test(self, bug, latest_flake_message):
+        if bug.is_closed():
+            self._tool.bugs.reopen_bug(bug.id(), latest_flake_message)
+        else:
+            self._tool.bugs.post_comment_to_bug(bug.id(), latest_flake_message)
+
     def report_flaky_tests(self, flaky_tests, patch):
         message = "The %s encountered the following flaky tests while processing attachment %s:\n\n" % (self._bot_name, patch.id())
         for flaky_test in flaky_tests:
@@ -115,11 +130,10 @@ If you would like to track this test fix with another bug, please close this bug
             if not bug:
                 self._create_bug_for_flaky_test(flaky_test, author_emails, latest_flake_message)
             else:
-                # FIXME: If the bug is closed we should follow the duplicate chain to the last bug,
-                # and then re-open the last bug if that too is closed.
-                self._tool.bugs.post_comment_to_bug(patch.bug_id(), latest_flake_message)
+                bug = self._follow_duplicate_chain(bug)
+                self._update_bug_for_flaky_test(bug, latest_flake_message)
 
-            message += "%s bug %s%s\n" % (flaky_test, patch.bug_id(), self._optional_author_string(author_emails))
+            message += "%s bug %s%s\n" % (flaky_test, bug.id(), self._optional_author_string(author_emails))
 
         message += "The %s is continuing to process your patch." % self._bot_name
         self._tool.bugs.post_comment_to_bug(patch.bug_id(), message)
diff --git a/WebKitTools/Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py b/WebKitTools/Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py
index 51ef626..0b73861 100644
--- a/WebKitTools/Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py
@@ -68,7 +68,7 @@ bug_description: This is an automatically generated bug from the dummy-queue.
 foo/bar.html has been flaky on the dummy-queue.
 
 foo/bar.html was authored by test at test.com.
-http://trac.webkit.org/browser/trunk/foo/bar.html
+http://trac.webkit.org/browser/trunk/LayoutTests/foo/bar.html
 
 FLAKE_MESSAGE
 
@@ -79,6 +79,12 @@ If you would like to track this test fix with another bug, please close this bug
 """
         OutputCapture().assert_outputs(self, reporter._create_bug_for_flaky_test, ['foo/bar.html', ['test at test.com'], 'FLAKE_MESSAGE'], expected_stderr=expected_stderr)
 
+    def test_follow_duplicate_chain(self):
+        tool = MockTool()
+        reporter = FlakyTestReporter(tool, 'dummy-queue')
+        bug = tool.bugs.fetch_bug(78)
+        self.assertEqual(reporter._follow_duplicate_chain(bug).id(), 76)
+
     def test_bot_information(self):
         tool = MockTool()
         tool.status_server = MockStatusServer("MockBotId")
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py b/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
index 0a4722e..4b00668 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/queues_unittest.py
@@ -324,13 +324,13 @@ MOCK: release_work_item: commit-queue 197
     def test_report_flaky_tests(self):
         queue = CommitQueue()
         queue.bind_to_tool(MockTool())
-        expected_stderr = """MOCK bug comment: bug_id=42, cc=None
+        expected_stderr = """MOCK bug comment: bug_id=76, cc=None
 --- Begin comment ---
 The commit-queue just saw foo/bar.html flake while processing attachment 197 on bug 42.
 Port: MockPort OS: MockPlatform 1.0
 --- End comment ---
 
-MOCK bug comment: bug_id=42, cc=None
+MOCK bug comment: bug_id=76, cc=None
 --- Begin comment ---
 The commit-queue just saw bar/baz.html flake while processing attachment 197 on bug 42.
 Port: MockPort OS: MockPlatform 1.0
@@ -340,8 +340,8 @@ MOCK bug comment: bug_id=42, cc=None
 --- Begin comment ---
 The commit-queue encountered the following flaky tests while processing attachment 197:
 
-foo/bar.html bug 42 (author: abarth at webkit.org)
-bar/baz.html bug 42 (author: abarth at webkit.org)
+foo/bar.html bug 76 (author: abarth at webkit.org)
+bar/baz.html bug 76 (author: abarth at webkit.org)
 The commit-queue is continuing to process your patch.
 --- End comment ---
 
diff --git a/WebKitTools/Scripts/webkitpy/tool/mocktool.py b/WebKitTools/Scripts/webkitpy/tool/mocktool.py
index 7328359..31510c5 100644
--- a/WebKitTools/Scripts/webkitpy/tool/mocktool.py
+++ b/WebKitTools/Scripts/webkitpy/tool/mocktool.py
@@ -187,6 +187,16 @@ _bug4 = {
 }
 
 
+_bug5 = {
+    "id": 78,
+    "title": "The fifth bug",
+    "assigned_to_email": "foo at foo.com",
+    "attachments": [],
+    "bug_status": "RESOLVED",
+    "dup_id": 76,
+}
+
+
 # FIXME: This should not inherit from Mock
 class MockBugzillaQueries(Mock):
 
@@ -226,7 +236,7 @@ class MockBugzillaQueries(Mock):
         return sum([bug.reviewed_patches() for bug in self._all_bugs()], [])
 
     def fetch_bugs_matching_search(self, search_string, author_email=None):
-        return [self.bugzilla.fetch_bug(76), self.bugzilla.fetch_bug(77)]
+        return [self._bugzilla.fetch_bug(78), self._bugzilla.fetch_bug(77)]
 
 _mock_reviewer = Reviewer("Foo Bar", "foo at bar.com")
 
@@ -239,7 +249,7 @@ class MockBugzilla(Mock):
 
     bug_server_url = "http://example.com"
 
-    bug_cache = _id_to_object_dictionary(_bug1, _bug2, _bug3, _bug4)
+    bug_cache = _id_to_object_dictionary(_bug1, _bug2, _bug3, _bug4, _bug5)
 
     attachment_cache = _id_to_object_dictionary(_patch1,
                                                 _patch2,

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list