Commit bd1c0ed5 authored by abarth@webkit.org's avatar abarth@webkit.org

2010-09-28 Adam Barth <abarth@webkit.org>

        Reviewed by Eric Seidel.

        Move RegressionWindow further up the dependency chain
        https://bugs.webkit.org/show_bug.cgi?id=46698

        Baby steps towards pushing this information into bug posts.

        * Scripts/webkitpy/common/net/buildbot.py:
        * Scripts/webkitpy/common/net/buildbot_unittest.py:
        * Scripts/webkitpy/common/net/regressionwindow.py:
        * Scripts/webkitpy/tool/commands/queries.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68495 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 59669cdc
2010-09-28 Adam Barth <abarth@webkit.org>
Reviewed by Eric Seidel.
Move RegressionWindow further up the dependency chain
https://bugs.webkit.org/show_bug.cgi?id=46698
Baby steps towards pushing this information into bug posts.
* Scripts/webkitpy/common/net/buildbot.py:
* Scripts/webkitpy/common/net/buildbot_unittest.py:
* Scripts/webkitpy/common/net/regressionwindow.py:
* Scripts/webkitpy/tool/commands/queries.py:
2010-09-27 Daniel Bates <dbates@rim.com>
Reviewed by Adam Barth.
......
......@@ -182,16 +182,16 @@ class Builder(object):
# with red build, so we've found our failure transition.
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):
def find_blameworthy_regression_window(self, red_build_number, look_back_limit=30, avoid_flakey_tests=True):
red_build = self.build(red_build_number)
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
return None # 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 regression_window.failing_build() == red_build:
return []
return regression_window.suspect_revisions()
return None
return regression_window
# FIXME: This should be unified with all the layout test results code in the layout_tests package
......@@ -458,7 +458,8 @@ class BuildBot(object):
if builder_status["is_green"]:
continue
builder = self.builder_with_name(builder_status["name"])
revisions = builder.blameworthy_revisions(builder_status["build_number"])
regression_window = builder.find_blameworthy_regression_window(builder_status["build_number"])
revisions = regression_window.revisions() if regression_window else []
for revision in revisions:
failing_bots = revision_to_failing_bots.get(revision, [])
failing_bots.append(builder)
......
......@@ -93,14 +93,14 @@ class BuilderTest(unittest.TestCase):
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])
self.assertEqual(self.builder.blameworthy_revisions(10, look_back_limit=2), [])
def test_find_blameworthy_regression_window(self):
self.assertEqual(self.builder.find_blameworthy_regression_window(10).revisions(), [1004])
self.assertEqual(self.builder.find_blameworthy_regression_window(10, look_back_limit=2), None)
# Flakey test avoidance requires at least 2 red builds:
self.assertEqual(self.builder.blameworthy_revisions(4), [])
self.assertEqual(self.builder.blameworthy_revisions(4, avoid_flakey_tests=False), [1004])
self.assertEqual(self.builder.find_blameworthy_regression_window(4), None)
self.assertEqual(self.builder.find_blameworthy_regression_window(4, avoid_flakey_tests=False).revisions(), [1004])
# Green builder:
self.assertEqual(self.builder.blameworthy_revisions(3), [])
self.assertEqual(self.builder.find_blameworthy_regression_window(3), None)
def test_build_caching(self):
self.assertEqual(self.builder.build(10), self.builder.build(10))
......
......@@ -42,7 +42,7 @@ class RegressionWindow(object):
def common_failures(self):
return self._common_failures
def suspect_revisions(self):
def revisions(self):
revisions = range(self._failing_build.revision(), self._build_before_failure.revision(), -1)
revisions.reverse()
return revisions
......@@ -123,8 +123,6 @@ class WhatBroke(AbstractDeclarativeCommand):
def _print_builder_line(self, builder_name, max_name_width, status_message):
print "%s : %s" % (builder_name.ljust(max_name_width), status_message)
# FIXME: This is slightly different from Builder.suspect_revisions_for_green_to_red_transition
# due to needing to detect the "hit the limit" case an print a special message.
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"])
......@@ -136,12 +134,12 @@ class WhatBroke(AbstractDeclarativeCommand):
self._print_builder_line(builder.name(), name_width, "FAIL (blame-list: sometime before %s?)" % regression_window.failing_build().revision())
return
suspect_revisions = regression_window.suspect_revisions()
revisions = regression_window.revisions()
first_failure_message = ""
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:
self._print_builder_line(builder.name(), name_width, "FAIL (blame-list: %s%s)" % (revisions, first_failure_message))
for revision in revisions:
commit_info = self._tool.checkout().commit_info_for_revision(revision)
if commit_info:
print commit_info.blame_string(self._tool.bugs)
......@@ -201,10 +199,10 @@ class FailureReason(AbstractDeclarativeCommand):
def _print_blame_information_for_transition(self, green_build, red_build, failing_tests):
regression_window = RegressionWindow(green_build, red_build)
suspect_revisions = regression_window.suspect_revisions()
revisions = regression_window.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:
for revision in revisions:
commit_info = self._tool.checkout().commit_info_for_revision(revision)
if commit_info:
print commit_info.blame_string(self._tool.bugs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment