Commit c91e4970 authored by eric@webkit.org's avatar eric@webkit.org

2010-12-10 Eric Seidel <eric@webkit.org>

        Reviewed by Tony Chang.

        commit-queue should report port/platform information when commenting on flaky test bugs
        https://bugs.webkit.org/show_bug.cgi?id=50839

        This was a suggestion from Tony Chang this morning.
        I added a platform.py class so I could easily mock the platform call,
        but that may not be the final solution for this mocking.
        We'll try it and see.

        * Scripts/webkitpy/common/system/platform.py: Added.
        * Scripts/webkitpy/tool/bot/flakytestreporter.py:
        * Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py:
        * Scripts/webkitpy/tool/commands/queues_unittest.py:
        * Scripts/webkitpy/tool/main.py:
        * Scripts/webkitpy/tool/mocktool.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73798 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0572ec78
2010-12-10 Eric Seidel <eric@webkit.org>
Reviewed by Tony Chang.
commit-queue should report port/platform information when commenting on flaky test bugs
https://bugs.webkit.org/show_bug.cgi?id=50839
This was a suggestion from Tony Chang this morning.
I added a platform.py class so I could easily mock the platform call,
but that may not be the final solution for this mocking.
We'll try it and see.
* Scripts/webkitpy/common/system/platform.py: Added.
* Scripts/webkitpy/tool/bot/flakytestreporter.py:
* Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py:
* Scripts/webkitpy/tool/commands/queues_unittest.py:
* Scripts/webkitpy/tool/main.py:
* Scripts/webkitpy/tool/mocktool.py:
2010-12-10 Krithigassree Sambamurthy <krithigassree.sambamurthy@nokia.com> 2010-12-10 Krithigassree Sambamurthy <krithigassree.sambamurthy@nokia.com>
Reviewed by Joseph Pecoraro. Reviewed by Joseph Pecoraro.
......
# 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.
import platform
# We use this instead of calls to platform directly so allow mocking.
# It's unclear if we should allow instantiation of multiple of these
# objects (like we do Ports for rebaseline commands, etc.),
# or if it should just be a mocking layer for python's platform.py
class Platform(object):
def display_name(self):
return platform.platform(aliased=1, terse=1)
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import logging import logging
import platform
from webkitpy.common.net.layouttestresults import path_for_layout_test, LayoutTestResults from webkitpy.common.net.layouttestresults import path_for_layout_test, LayoutTestResults
from webkitpy.common.config import urls from webkitpy.common.config import urls
...@@ -96,11 +97,20 @@ If you would like to track this test fix with another bug, please close this bug ...@@ -96,11 +97,20 @@ If you would like to track this test fix with another bug, please close this bug
authors_string = join_with_separators(sorted(author_emails)) authors_string = join_with_separators(sorted(author_emails))
return " (%s: %s)" % (heading_string, authors_string) return " (%s: %s)" % (heading_string, authors_string)
def _bot_information(self):
bot_id = self._tool.status_server.bot_id
bot_id_string = "Bot Id: %s " % (bot_id) if bot_id else ""
return "%sPort: %s OS: %s" % (bot_id_string, self._tool.port().name(), self._tool.platform.display_name())
def _latest_flake_message(self, flaky_test, patch):
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 report_flaky_tests(self, flaky_tests, patch): 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()) 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: for flaky_test in flaky_tests:
bug = self._lookup_bug_for_flaky_test(flaky_test) bug = self._lookup_bug_for_flaky_test(flaky_test)
latest_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()) latest_flake_message = self._latest_flake_message(flaky_test, patch)
author_emails = self._author_emails_for_test(flaky_test) author_emails = self._author_emails_for_test(flaky_test)
if not bug: if not bug:
self._create_bug_for_flaky_test(flaky_test, author_emails, latest_flake_message) self._create_bug_for_flaky_test(flaky_test, author_emails, latest_flake_message)
......
...@@ -31,7 +31,7 @@ import unittest ...@@ -31,7 +31,7 @@ import unittest
from webkitpy.common.config.committers import Committer from webkitpy.common.config.committers import Committer
from webkitpy.common.system.outputcapture import OutputCapture from webkitpy.common.system.outputcapture import OutputCapture
from webkitpy.tool.bot.flakytestreporter import FlakyTestReporter from webkitpy.tool.bot.flakytestreporter import FlakyTestReporter
from webkitpy.tool.mocktool import MockTool from webkitpy.tool.mocktool import MockTool, MockStatusServer
# Creating fake CommitInfos is a pain, so we use a mock one here. # Creating fake CommitInfos is a pain, so we use a mock one here.
...@@ -79,4 +79,10 @@ If you would like to track this test fix with another bug, please close this bug ...@@ -79,4 +79,10 @@ 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@test.com'], 'FLAKE_MESSAGE'], expected_stderr=expected_stderr) OutputCapture().assert_outputs(self, reporter._create_bug_for_flaky_test, ['foo/bar.html', ['test@test.com'], 'FLAKE_MESSAGE'], expected_stderr=expected_stderr)
def test_bot_information(self):
tool = MockTool()
tool.status_server = MockStatusServer("MockBotId")
reporter = FlakyTestReporter(tool, 'dummy-queue')
self.assertEqual(reporter._bot_information(), "Bot Id: MockBotId Port: MockPort OS: MockPlatform 1.0")
# report_flaky_tests is tested by queues_unittest # report_flaky_tests is tested by queues_unittest
...@@ -327,11 +327,13 @@ MOCK: release_work_item: commit-queue 197 ...@@ -327,11 +327,13 @@ MOCK: release_work_item: commit-queue 197
expected_stderr = """MOCK bug comment: bug_id=42, cc=None expected_stderr = """MOCK bug comment: bug_id=42, cc=None
--- Begin comment --- --- Begin comment ---
The commit-queue just saw foo/bar.html flake while processing attachment 197 on bug 42. The commit-queue just saw foo/bar.html flake while processing attachment 197 on bug 42.
Port: MockPort OS: MockPlatform 1.0
--- End comment --- --- End comment ---
MOCK bug comment: bug_id=42, cc=None MOCK bug comment: bug_id=42, cc=None
--- Begin comment --- --- Begin comment ---
The commit-queue just saw bar/baz.html flake while processing attachment 197 on bug 42. The commit-queue just saw bar/baz.html flake while processing attachment 197 on bug 42.
Port: MockPort OS: MockPlatform 1.0
--- End comment --- --- End comment ---
MOCK bug comment: bug_id=42, cc=None MOCK bug comment: bug_id=42, cc=None
......
...@@ -41,6 +41,7 @@ from webkitpy.common.net.buildbot import BuildBot ...@@ -41,6 +41,7 @@ from webkitpy.common.net.buildbot import BuildBot
from webkitpy.common.net.irc.ircproxy import IRCProxy from webkitpy.common.net.irc.ircproxy import IRCProxy
from webkitpy.common.net.statusserver import StatusServer from webkitpy.common.net.statusserver import StatusServer
from webkitpy.common.system.executive import Executive from webkitpy.common.system.executive import Executive
from webkitpy.common.system.platform import Platform
from webkitpy.common.system.user import User from webkitpy.common.system.user import User
from webkitpy.layout_tests import port from webkitpy.layout_tests import port
from webkitpy.tool.multicommandtool import MultiCommandTool from webkitpy.tool.multicommandtool import MultiCommandTool
...@@ -62,6 +63,10 @@ class WebKitPatch(MultiCommandTool): ...@@ -62,6 +63,10 @@ class WebKitPatch(MultiCommandTool):
self._path = path self._path = path
self.wakeup_event = threading.Event() self.wakeup_event = threading.Event()
# FIXME: All of these shared objects should move off onto a
# separate "Tool" object. WebKitPatch should inherit from
# "Tool" and all these objects should use getters/setters instead of
# manual getter functions (e.g. scm()).
self.bugs = Bugzilla() self.bugs = Bugzilla()
self.buildbot = BuildBot() self.buildbot = BuildBot()
self.executive = Executive() self.executive = Executive()
...@@ -72,6 +77,7 @@ class WebKitPatch(MultiCommandTool): ...@@ -72,6 +77,7 @@ class WebKitPatch(MultiCommandTool):
self._checkout = None self._checkout = None
self.status_server = StatusServer() self.status_server = StatusServer()
self.port_factory = port.factory self.port_factory = port.factory
self.platform = Platform()
def scm(self): def scm(self):
# Lazily initialize SCM to not error-out before command line parsing (or when running non-scm commands). # Lazily initialize SCM to not error-out before command line parsing (or when running non-scm commands).
......
...@@ -613,6 +613,10 @@ class MockOptions(object): ...@@ -613,6 +613,10 @@ class MockOptions(object):
self.__dict__[key] = value self.__dict__[key] = value
class MockPort(Mock):
def name(self):
return "MockPort"
class MockTestPort1(object): class MockTestPort1(object):
def skips_layout_test(self, test_name): def skips_layout_test(self, test_name):
...@@ -631,6 +635,11 @@ class MockPortFactory(object): ...@@ -631,6 +635,11 @@ class MockPortFactory(object):
return {"test_port1": MockTestPort1(), "test_port2": MockTestPort2()} return {"test_port1": MockTestPort1(), "test_port2": MockTestPort2()}
class MockPlatform(object):
def display_name(self):
return "MockPlatform 1.0"
class MockTool(object): class MockTool(object):
def __init__(self, log_executive=False): def __init__(self, log_executive=False):
...@@ -645,6 +654,7 @@ class MockTool(object): ...@@ -645,6 +654,7 @@ class MockTool(object):
self.status_server = MockStatusServer() self.status_server = MockStatusServer()
self.irc_password = "MOCK irc password" self.irc_password = "MOCK irc password"
self.port_factory = MockPortFactory() self.port_factory = MockPortFactory()
self.platform = MockPlatform()
def scm(self): def scm(self):
return self._scm return self._scm
...@@ -663,7 +673,7 @@ class MockTool(object): ...@@ -663,7 +673,7 @@ class MockTool(object):
return "echo" return "echo"
def port(self): def port(self):
return Mock() return MockPort()
class MockBrowser(object): class MockBrowser(object):
......
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