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

abarth at webkit.org abarth at webkit.org
Wed Dec 22 13:50:54 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit c34ac996b9f8674b3866a661dc6ef69a1b656999
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 28 06:22:36 2010 +0000

    2010-09-27  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Eric Seidel.
    
            Expose more more failure information from Buildbot to SheriffBot
            https://bugs.webkit.org/show_bug.cgi?id=46697
    
            This patch moves the information about what tests failured closer to
            SheriffBot.  There are still a couple more patches to go before
            SheriffBot can post this information to bugs, but this is a step in
            that direction.  Yay for unit tests, which caught some bugs in earlier
            versions of this patch.
    
            * Scripts/webkitpy/common/net/buildbot.py:
            * Scripts/webkitpy/common/net/buildbot_unittest.py:
            * Scripts/webkitpy/common/net/regressionwindow.py: Added.
            * Scripts/webkitpy/tool/commands/queries.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68492 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 581e470..a832a73 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,21 @@
+2010-09-27  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        Expose more more failure information from Buildbot to SheriffBot
+        https://bugs.webkit.org/show_bug.cgi?id=46697
+
+        This patch moves the information about what tests failured closer to
+        SheriffBot.  There are still a couple more patches to go before
+        SheriffBot can post this information to bugs, but this is a step in
+        that direction.  Yay for unit tests, which caught some bugs in earlier
+        versions of this patch.
+
+        * Scripts/webkitpy/common/net/buildbot.py:
+        * Scripts/webkitpy/common/net/buildbot_unittest.py:
+        * Scripts/webkitpy/common/net/regressionwindow.py: Added.
+        * Scripts/webkitpy/tool/commands/queries.py:
+
 2010-09-27  Eric Seidel  <eric at webkit.org>
 
         Unreviewed.  Fixing 500 error seen in the status server.
diff --git a/WebKitTools/Scripts/webkitpy/common/net/buildbot.py b/WebKitTools/Scripts/webkitpy/common/net/buildbot.py
index 29f2228..91f6383 100644
--- a/WebKitTools/Scripts/webkitpy/common/net/buildbot.py
+++ b/WebKitTools/Scripts/webkitpy/common/net/buildbot.py
@@ -34,6 +34,7 @@ import urllib
 import urllib2
 import xmlrpclib
 
+from webkitpy.common.net.regressionwindow import RegressionWindow
 from webkitpy.common.system.logutils import get_logger
 from webkitpy.thirdparty.autoinstalled.mechanize import Browser
 from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup
@@ -145,9 +146,9 @@ class Builder(object):
             )
         return build
 
-    def find_failure_transition(self, red_build, look_back_limit=30):
+    def find_regression_window(self, red_build, look_back_limit=30):
         if not red_build or red_build.is_green():
-            return (None, None)
+            return RegressionWindow(None, None)
         common_failures = None
         current_build = red_build
         build_after_current_build = None
@@ -172,34 +173,25 @@ class Builder(object):
                     break
             look_back_count += 1
             if look_back_count > look_back_limit:
-                return (None, current_build)
+                return RegressionWindow(None, current_build, common_failures=common_failures)
             build_after_current_build = current_build
             current_build = current_build.previous_build()
         # We must iterate at least once because red_build is red.
         assert(build_after_current_build)
         # Current build must either be green or have no failures in common
         # with red build, so we've found our failure transition.
-        return (current_build, build_after_current_build)
-
-    # FIXME: This likely does not belong on Builder
-    def suspect_revisions_for_transition(self, last_good_build, first_bad_build):
-        suspect_revisions = range(first_bad_build.revision(),
-                                  last_good_build.revision(),
-                                  -1)
-        suspect_revisions.reverse()
-        return suspect_revisions
+        return RegressionWindow(current_build, build_after_current_build, common_failures=common_failures)
 
     def blameworthy_revisions(self, red_build_number, look_back_limit=30, avoid_flakey_tests=True):
         red_build = self.build(red_build_number)
-        (last_good_build, first_bad_build) = \
-            self.find_failure_transition(red_build, look_back_limit)
-        if not last_good_build:
+        regression_window = self.find_regression_window(red_build, look_back_limit)
+        if not regression_window.build_before_failure():
             return [] # We ran off the limit of our search
         # If avoid_flakey_tests, require at least 2 bad builds before we
         # suspect a real failure transition.
-        if avoid_flakey_tests and first_bad_build == red_build:
+        if avoid_flakey_tests and regression_window.failing_build() == red_build:
             return []
-        return self.suspect_revisions_for_transition(last_good_build, first_bad_build)
+        return regression_window.suspect_revisions()
 
 
 # FIXME: This should be unified with all the layout test results code in the layout_tests package
diff --git a/WebKitTools/Scripts/webkitpy/common/net/buildbot_unittest.py b/WebKitTools/Scripts/webkitpy/common/net/buildbot_unittest.py
index a435b9b..fcc1426 100644
--- a/WebKitTools/Scripts/webkitpy/common/net/buildbot_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/common/net/buildbot_unittest.py
@@ -54,44 +54,44 @@ class BuilderTest(unittest.TestCase):
         self.builder = Builder(u"Test Builder \u2661", self.buildbot)
         self._install_fetch_build(lambda build_number: ["test1", "test2"])
 
-    def test_find_failure_transition(self):
-        (green_build, red_build) = self.builder.find_failure_transition(self.builder.build(10))
-        self.assertEqual(green_build.revision(), 1003)
-        self.assertEqual(red_build.revision(), 1004)
+    def test_find_regression_window(self):
+        regression_window = self.builder.find_regression_window(self.builder.build(10))
+        self.assertEqual(regression_window.build_before_failure().revision(), 1003)
+        self.assertEqual(regression_window.failing_build().revision(), 1004)
 
-        (green_build, red_build) = self.builder.find_failure_transition(self.builder.build(10), look_back_limit=2)
-        self.assertEqual(green_build, None)
-        self.assertEqual(red_build.revision(), 1008)
+        regression_window = self.builder.find_regression_window(self.builder.build(10), look_back_limit=2)
+        self.assertEqual(regression_window.build_before_failure(), None)
+        self.assertEqual(regression_window.failing_build().revision(), 1008)
 
     def test_none_build(self):
         self.builder._fetch_build = lambda build_number: None
-        (green_build, red_build) = self.builder.find_failure_transition(self.builder.build(10))
-        self.assertEqual(green_build, None)
-        self.assertEqual(red_build, None)
+        regression_window = self.builder.find_regression_window(self.builder.build(10))
+        self.assertEqual(regression_window.build_before_failure(), None)
+        self.assertEqual(regression_window.failing_build(), None)
 
     def test_flaky_tests(self):
         self._install_fetch_build(lambda build_number: ["test1"] if build_number % 2 else ["test2"])
-        (green_build, red_build) = self.builder.find_failure_transition(self.builder.build(10))
-        self.assertEqual(green_build.revision(), 1009)
-        self.assertEqual(red_build.revision(), 1010)
+        regression_window = self.builder.find_regression_window(self.builder.build(10))
+        self.assertEqual(regression_window.build_before_failure().revision(), 1009)
+        self.assertEqual(regression_window.failing_build().revision(), 1010)
 
     def test_failure_and_flaky(self):
         self._install_fetch_build(lambda build_number: ["test1", "test2"] if build_number % 2 else ["test2"])
-        (green_build, red_build) = self.builder.find_failure_transition(self.builder.build(10))
-        self.assertEqual(green_build.revision(), 1003)
-        self.assertEqual(red_build.revision(), 1004)
+        regression_window = self.builder.find_regression_window(self.builder.build(10))
+        self.assertEqual(regression_window.build_before_failure().revision(), 1003)
+        self.assertEqual(regression_window.failing_build().revision(), 1004)
 
     def test_no_results(self):
         self._install_fetch_build(lambda build_number: ["test1", "test2"] if build_number % 2 else ["test2"])
-        (green_build, red_build) = self.builder.find_failure_transition(self.builder.build(10))
-        self.assertEqual(green_build.revision(), 1003)
-        self.assertEqual(red_build.revision(), 1004)
+        regression_window = self.builder.find_regression_window(self.builder.build(10))
+        self.assertEqual(regression_window.build_before_failure().revision(), 1003)
+        self.assertEqual(regression_window.failing_build().revision(), 1004)
 
     def test_failure_after_flaky(self):
         self._install_fetch_build(lambda build_number: ["test1", "test2"] if build_number > 6 else ["test3"])
-        (green_build, red_build) = self.builder.find_failure_transition(self.builder.build(10))
-        self.assertEqual(green_build.revision(), 1006)
-        self.assertEqual(red_build.revision(), 1007)
+        regression_window = self.builder.find_regression_window(self.builder.build(10))
+        self.assertEqual(regression_window.build_before_failure().revision(), 1006)
+        self.assertEqual(regression_window.failing_build().revision(), 1007)
 
     def test_blameworthy_revisions(self):
         self.assertEqual(self.builder.blameworthy_revisions(10), [1004])
diff --git a/WebKitTools/Scripts/webkitpy/common/net/regressionwindow.py b/WebKitTools/Scripts/webkitpy/common/net/regressionwindow.py
new file mode 100644
index 0000000..7020f62
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/common/net/regressionwindow.py
@@ -0,0 +1,48 @@
+# Copyright (C) 2010 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+class RegressionWindow(object):
+    def __init__(self, build_before_failure, failing_build, common_failures=None):
+        self._build_before_failure = build_before_failure
+        self._failing_build = failing_build
+        self._common_failures = common_failures
+
+    def build_before_failure(self):
+        return self._build_before_failure
+
+    def failing_build(self):
+        return self._failing_build
+
+    def common_failures(self):
+        return self._common_failures
+
+    def suspect_revisions(self):
+        revisions = range(self._failing_build.revision(), self._build_before_failure.revision(), -1)
+        revisions.reverse()
+        return revisions
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/queries.py b/WebKitTools/Scripts/webkitpy/tool/commands/queries.py
index 08b12c9..73b889a 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/queries.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/queries.py
@@ -33,6 +33,7 @@ from optparse import make_option
 from webkitpy.common.checkout.commitinfo import CommitInfo
 from webkitpy.common.config.committers import CommitterList
 from webkitpy.common.net.buildbot import BuildBot
+from webkitpy.common.net.regressionwindow import RegressionWindow
 from webkitpy.common.system.user import User
 from webkitpy.tool.grammar import pluralize
 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
@@ -127,18 +128,17 @@ class WhatBroke(AbstractDeclarativeCommand):
     def _print_blame_information_for_builder(self, builder_status, name_width, avoid_flakey_tests=True):
         builder = self._tool.buildbot.builder_with_name(builder_status["name"])
         red_build = builder.build(builder_status["build_number"])
-        (last_green_build, first_red_build) = builder.find_failure_transition(red_build)
-        if not first_red_build:
+        regression_window = builder.find_regression_window(red_build)
+        if not regression_window.failing_build():
             self._print_builder_line(builder.name(), name_width, "FAIL (error loading build information)")
             return
-        if not last_green_build:
-            self._print_builder_line(builder.name(), name_width, "FAIL (blame-list: sometime before %s?)" % first_red_build.revision())
+        if not regression_window.build_before_failure():
+            self._print_builder_line(builder.name(), name_width, "FAIL (blame-list: sometime before %s?)" % regression_window.failing_build().revision())
             return
 
-        suspect_revisions = range(first_red_build.revision(), last_green_build.revision(), -1)
-        suspect_revisions.reverse()
+        suspect_revisions = regression_window.suspect_revisions()
         first_failure_message = ""
-        if (first_red_build == builder.build(builder_status["build_number"])):
+        if (regression_window.failing_build() == builder.build(builder_status["build_number"])):
             first_failure_message = " FIRST FAILURE, possibly a flaky test"
         self._print_builder_line(builder.name(), name_width, "FAIL (blame-list: %s%s)" % (suspect_revisions, first_failure_message))
         for revision in suspect_revisions:
@@ -200,7 +200,8 @@ class FailureReason(AbstractDeclarativeCommand):
     help_text = "Lists revisions where individual test failures started at %s" % BuildBot.default_host
 
     def _print_blame_information_for_transition(self, green_build, red_build, failing_tests):
-        suspect_revisions = green_build.builder().suspect_revisions_for_transition(green_build, red_build)
+        regression_window = RegressionWindow(green_build, red_build)
+        suspect_revisions = regression_window.suspect_revisions()
         print "SUCCESS: Build %s (r%s) was the first to show failures: %s" % (red_build._number, red_build.revision(), failing_tests)
         print "Suspect revisions:"
         for revision in suspect_revisions:

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list