Changeset 83614 in webkit


Ignore:
Timestamp:
Apr 12, 2011 11:30:17 AM (13 years ago)
Author:
eric@webkit.org
Message:

2011-04-12 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

commit-queue should upload failure diffs when tests fail
https://bugs.webkit.org/show_bug.cgi?id=58348

This change was mostly just plumbing. We were already saving
this information for flaky test reporting. I just made it possible
for normal failures to report archives as well.

I did a little abstraction work to try and share some code between
flakytestreporter.py and this new code. There is still more we could do.

In making this change I also went through and updated the various
places we have urls hard-coded in our python and pointed them at
common.config.urls.

  • Scripts/webkitpy/common/checkout/scm.py:
  • Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
  • Scripts/webkitpy/common/net/buildbot/buildbot.py:
  • Scripts/webkitpy/common/net/statusserver.py:
  • Scripts/webkitpy/layout_tests/port/base.py:
  • Scripts/webkitpy/tool/bot/botinfo.py: Added.
  • Scripts/webkitpy/tool/bot/botinfo_unittest.py: Added.
  • Scripts/webkitpy/tool/bot/commitqueuetask.py:
  • Scripts/webkitpy/tool/bot/flakytestreporter.py:
  • Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py:
  • Scripts/webkitpy/tool/commands/queues.py:
Location:
trunk/Tools
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r83603 r83614  
     12011-04-12  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        commit-queue should upload failure diffs when tests fail
     6        https://bugs.webkit.org/show_bug.cgi?id=58348
     7
     8        This change was mostly just plumbing.  We were already saving
     9        this information for flaky test reporting.  I just made it possible
     10        for normal failures to report archives as well.
     11
     12        I did a little abstraction work to try and share some code between
     13        flakytestreporter.py and this new code.  There is still more we could do.
     14
     15        In making this change I also went through and updated the various
     16        places we have urls hard-coded in our python and pointed them at
     17        common.config.urls.
     18
     19        * Scripts/webkitpy/common/checkout/scm.py:
     20        * Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
     21        * Scripts/webkitpy/common/net/buildbot/buildbot.py:
     22        * Scripts/webkitpy/common/net/statusserver.py:
     23        * Scripts/webkitpy/layout_tests/port/base.py:
     24        * Scripts/webkitpy/tool/bot/botinfo.py: Added.
     25        * Scripts/webkitpy/tool/bot/botinfo_unittest.py: Added.
     26        * Scripts/webkitpy/tool/bot/commitqueuetask.py:
     27        * Scripts/webkitpy/tool/bot/flakytestreporter.py:
     28        * Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py:
     29        * Scripts/webkitpy/tool/commands/queues.py:
     30
    1312011-04-12  Daniel Bates  <dbates@rim.com>
    232
  • trunk/Tools/Scripts/webkitpy/common/checkout/scm.py

    r83152 r83614  
    321321
    322322class SVN(SCM):
    323     # FIXME: We should move these values to a WebKit-specific config file.
     323    # FIXME: These belong in common.config.urls
    324324    svn_server_host = "svn.webkit.org"
    325325    svn_server_realm = "<http://svn.webkit.org:80> Mac OS Forge"
  • trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py

    r82766 r83614  
    221221        self.browser.set_handle_robots(False)
    222222
    223     # FIXME: Much of this should go into some sort of config module:
     223    # FIXME: Much of this should go into some sort of config module,
     224    # such as common.config.urls.
    224225    bug_server_host = "bugs.webkit.org"
    225226    bug_server_regex = "https?://%s/" % re.sub('\.', '\\.', bug_server_host)
  • trunk/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py

    r82313 r83614  
    268268
    269269class BuildBot(object):
    270     # FIXME: This should move into some sort of webkit_config.py
     270    # FIXME: This should move into common.config.urls.
    271271    default_host = "build.webkit.org"
    272272
  • trunk/Tools/Scripts/webkitpy/common/net/statusserver.py

    r75225 r83614  
    2626# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28#
     29# This the client designed to talk to Tools/QueueStatusServer.
    2830
    2931from webkitpy.common.net.networktransaction import NetworkTransaction
     
    4042
    4143class StatusServer:
     44    # FIXME: This should probably move to common.config.urls.
    4245    default_host = "queues.webkit.org"
    4346
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py

    r83475 r83614  
    130130        self._wdiff_available = True
    131131
     132        # FIXME: prettypatch.py knows this path, why is it copied here?
    132133        self._pretty_patch_path = self.path_from_webkit_base("Websites",
    133134            "bugs.webkit.org", "PrettyPatch", "prettify.rb")
  • trunk/Tools/Scripts/webkitpy/tool/bot/commitqueuetask.py

    r82484 r83614  
    6060        self._patch = patch
    6161        self._script_error = None
     62        self._results_archive_from_patch_test_run = None
    6263
    6364    def _validate(self):
     
    202203
    203204        if self._build_and_test_without_patch():
    204             return self.report_failure()  # The error from the previous ._test() run is real, report it.
     205            return self.report_failure(first_results_archive)  # The error from the previous ._test() run is real, report it.
    205206        return False  # Tree must be red, just retry later.
    206207
    207     def report_failure(self):
     208    def results_archive_from_patch_test_run(self, patch):
     209        assert(self._patch.id() == patch.id())  # CommitQueueTask is not currently re-useable.
     210        return self._results_archive_from_patch_test_run
     211
     212    def report_failure(self, results_archive=None):
    208213        if not self._validate():
    209214            return False
     215        self._results_archive_from_patch_test_run = results_archive
    210216        raise self._script_error
    211217
  • trunk/Tools/Scripts/webkitpy/tool/bot/flakytestreporter.py

    r78779 r83614  
    3434from webkitpy.common.net.layouttestresults import path_for_layout_test, LayoutTestResults
    3535from webkitpy.common.config import urls
     36from webkitpy.tool.bot.botinfo import BotInfo
    3637from webkitpy.tool.grammar import plural, pluralize, join_with_separators
    3738
     
    4344        self._tool = tool
    4445        self._bot_name = bot_name
     46        self._bot_info = BotInfo(tool)
    4547
    4648    def _author_emails_for_test(self, flaky_test):
     
    122124        return " (%s: %s)" % (heading_string, authors_string)
    123125
    124     def _bot_information(self):
    125         bot_id = self._tool.status_server.bot_id
    126         bot_id_string = "Bot: %s  " % (bot_id) if bot_id else ""
    127         return "%sPort: %s  Platform: %s" % (bot_id_string, self._tool.port().name(), self._tool.platform.display_name())
    128 
    129126    def _latest_flake_message(self, flaky_result, patch):
    130127        failure_messages = [failure.message() for failure in flaky_result.failures]
    131128        flake_message = "The %s just saw %s flake (%s) while processing attachment %s on bug %s." % (self._bot_name, flaky_result.filename, ", ".join(failure_messages), patch.id(), patch.bug_id())
    132         return "%s\n%s" % (flake_message, self._bot_information())
     129        return "%s\n%s" % (flake_message, self._bot_info.summary_text())
    133130
    134131    def _results_diff_path_for_test(self, test_path):
  • trunk/Tools/Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py

    r75583 r83614  
    9898        self.assertEqual(reporter._follow_duplicate_chain(bug).id(), 76)
    9999
    100     def test_bot_information(self):
    101         tool = MockTool()
    102         tool.status_server = MockStatusServer("MockBotId")
    103         reporter = FlakyTestReporter(tool, 'dummy-queue')
    104         self.assertEqual(reporter._bot_information(), "Bot: MockBotId  Port: MockPort  Platform: MockPlatform 1.0")
    105 
    106100    def test_report_flaky_tests_creating_bug(self):
    107101        tool = MockTool()
  • trunk/Tools/Scripts/webkitpy/tool/commands/queues.py

    r76071 r83614  
    4545from webkitpy.common.system.deprecated_logging import error, log
    4646from webkitpy.common.system.executive import ScriptError
     47from webkitpy.tool.bot.botinfo import BotInfo
    4748from webkitpy.tool.bot.commitqueuetask import CommitQueueTask, CommitQueueTaskDelegate
    4849from webkitpy.tool.bot.feeders import CommitQueueFeeder, EWSFeeder
     
    259260        return True
    260261
     262    # FIXME: This is not really specific to the commit-queue and could be shared.
     263    def _upload_results_archive_for_patch(self, patch, results_archive_zip):
     264        bot_id = self._tool.status_server.bot_id or "bot"
     265        description = "Archive of layout-test-results from %s" % bot_id
     266        # results_archive is a ZipFile object, grab the File object (.fp) to pass to Mechanize for uploading.
     267        results_archive_file = results_archive_zip.fp
     268        # Rewind the file object to start (since Mechanize won't do that automatically)
     269        # See https://bugs.webkit.org/show_bug.cgi?id=54593
     270        results_archive_file.seek(0)
     271        comment_text = "The attached test failures were seen while running run-webkit-tests on the %s.\n" % (self.name)
     272        # FIXME: We could easily list the test failures from the archive here.
     273        comment_text += BotInfo(self._tool).summary_text()
     274        self._tool.bugs.add_attachment_to_bug(patch.bug_id(), results_archive_file, description, filename="layout-test-results.zip", comment_text=comment_text)
     275
    261276    def process_work_item(self, patch):
    262277        self._cc_watchers(patch.bug_id())
     
    270285            validator = CommitterValidator(self._tool.bugs)
    271286            validator.reject_patch_from_commit_queue(patch.id(), self._error_message_for_bug(task.failure_status_id, e))
     287            results_archive = task.results_archive_from_patch_test_run(patch)
     288            if results_archive:
     289                self._upload_results_archive_for_patch(patch, results_archive)
    272290            self._did_fail(patch)
    273291
  • trunk/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py

    r82484 r83614  
    389389        queue.bind_to_tool(MockTool())
    390390        patch = queue._tool.bugs.fetch_attachment(128)
     391        # This is just to test that the method doesn't raise.
    391392        queue.archive_last_layout_test_results(patch)
     393
     394    def test_upload_results_archive_for_patch(self):
     395        queue = CommitQueue()
     396        queue.bind_to_tool(MockTool())
     397        patch = queue._tool.bugs.fetch_attachment(128)
     398        expected_stderr = """MOCK add_attachment_to_bug: bug_id=42, description=Archive of layout-test-results from bot filename=layout-test-results.zip
     399-- Begin comment --
     400The attached test failures were seen while running run-webkit-tests on the commit-queue.
     401Port: MockPort  Platform: MockPlatform 1.0
     402-- End comment --
     403"""
     404        OutputCapture().assert_outputs(self, queue._upload_results_archive_for_patch, [patch, Mock()], expected_stderr=expected_stderr)
    392405
    393406
Note: See TracChangeset for help on using the changeset viewer.