Changeset 85504 in webkit


Ignore:
Timestamp:
May 2, 2011 12:42:27 PM (13 years ago)
Author:
abarth@webkit.org
Message:

2011-05-02 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Add base case for a test-running EWS
https://bugs.webkit.org/show_bug.cgi?id=59920

Later I will subclass this to run the Chromium Linux EWS.

  • Scripts/webkitpy/tool/bot/earlywarningsystemtask.py: Added.
  • Scripts/webkitpy/tool/commands/earlywarningsystem.py:
  • Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py:
Location:
trunk/Tools
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r85498 r85504  
     12011-05-02  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Add base case for a test-running EWS
     6        https://bugs.webkit.org/show_bug.cgi?id=59920
     7
     8        Later I will subclass this to run the Chromium Linux EWS.
     9
     10        * Scripts/webkitpy/tool/bot/earlywarningsystemtask.py: Added.
     11        * Scripts/webkitpy/tool/commands/earlywarningsystem.py:
     12        * Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py:
     13
    1142011-05-02  Anders Carlsson  <andersca@apple.com>
    215
  • trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py

    r85472 r85504  
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828
    29 from webkitpy.tool.commands.queues import AbstractReviewQueue
    3029from webkitpy.common.config.committers import CommitterList
    3130from webkitpy.common.config.ports import WebKitPort
     31from webkitpy.common.system.deprecated_logging import error, log
    3232from webkitpy.common.system.executive import ScriptError
     33from webkitpy.tool.bot.expectedfailures import ExpectedFailures
     34from webkitpy.tool.bot.layouttestresultsreader import LayoutTestResultsReader
    3335from webkitpy.tool.bot.queueengine import QueueEngine
     36from webkitpy.tool.bot.earlywarningsystemtask import EarlyWarningSystemTask, EarlyWarningSystemTaskDelegate, UnableToApplyPatch
     37from webkitpy.tool.commands.queues import AbstractReviewQueue
    3438
    3539
     
    106110        exit(1)
    107111
     112# FIXME: This should merge with AbstractEarlyWarningSystem once all the EWS
     113# bots run tests.
     114class AbstractTestingEWS(AbstractEarlyWarningSystem):
     115    def begin_work_queue(self):
     116        # FIXME: This violates abstraction
     117        self._tool._port = self.port
     118        AbstractEarlyWarningSystem.begin_work_queue(self)
     119        self._expected_failures = ExpectedFailures()
     120        self._layout_test_results_reader = LayoutTestResultsReader(self._tool, self._log_directory())
     121
     122    def review_patch(self, patch):
     123        task = EarlyWarningSystemTask(self, patch)
     124        if not task.validate():
     125            self._did_error(patch, "%s did not process patch." % self.name)
     126            return False
     127        try:
     128            return task.run()
     129        except UnableToApplyPatch, e:
     130            self._did_error(patch, "%s unable to apply patch." % self.name)
     131            return False
     132        except ScriptError, e:
     133            # FIXME: We should upload the results archive on failure.
     134            results_link = self._tool.status_server.results_url_for_status(task.failure_status_id)
     135            message = "Attachment %s did not pass %s:\nOutput: %s" % (patch.id(), self.name, results_link)
     136            results = task.results_from_patch_test_run(patch)
     137            unexpected_failures = self._expected_failures.unexpected_failures(results)
     138            if unexpected_failures:
     139                message += "\nNew failing tests:\n%s" % "\n".join(unexpected_failures)
     140            self._tool.bugs.post_comment_to_bug(patch.bug_id(), message, cc=self.watchers)
     141            raise
     142
     143    # EarlyWarningSystemDelegate methods
     144
     145    def parent_command(self):
     146        return self.name
     147
     148    def run_command(self, command):
     149        self.run_webkit_patch(command + [self.port.flag()])
     150
     151    def command_passed(self, message, patch):
     152        pass
     153
     154    def command_failed(self, message, script_error, patch):
     155        failure_log = self._log_from_script_error_for_upload(script_error)
     156        return self._update_status(message, patch=patch, results_file=failure_log)
     157
     158    def expected_failures(self):
     159        return self._expected_failures
     160
     161    def layout_test_results(self):
     162        return self._layout_test_results_reader.results()
     163
     164    def archive_last_layout_test_results(self, patch):
     165        return self._layout_test_results_reader.archive(patch)
     166
     167    def refetch_patch(self, patch):
     168        return self._tool.bugs.fetch_attachment(patch.id())
     169
     170    def report_flaky_tests(self, patch, flaky_test_results, results_archive):
     171        pass
     172
     173    # StepSequenceErrorHandler methods
     174
     175    @classmethod
     176    def handle_script_error(cls, tool, state, script_error):
     177        log(script_error.message_with_output())
     178
    108179
    109180class GtkEWS(AbstractEarlyWarningSystem):
  • trunk/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py

    r85472 r85504  
    3434from webkitpy.tool.commands.earlywarningsystem import *
    3535from webkitpy.tool.commands.queuestest import QueuesTest
    36 from webkitpy.tool.mocktool import MockTool, MockOptions
     36from webkitpy.tool.mocktool import MockTool, MockOptions, MockPort
    3737
    3838
     
    109109        self.assert_queue_outputs(ews, expected_stderr=expected_stderr, expected_exceptions=expected_exceptions)
    110110
     111    def test_testing_ews(self):
     112        class ConcreteTestingEWS(AbstractTestingEWS):
     113            name = "mock-testing-ews-name"
     114            port_name = "mock-port"
     115        ews = ConcreteTestingEWS()
     116        ews.port = MockPort()
     117        expected_stderr = {
     118            "begin_work_queue": self._default_begin_work_queue_stderr(ews.name, MockTool().scm().checkout_root),
     119            "handle_unexpected_error": """Mock error message
     120""",
     121            "next_work_item": "",
     122            "process_work_item": """MOCK: update_status: mock-testing-ews-name Pass
     123MOCK: release_work_item: mock-testing-ews-name 197
     124""",
     125            "handle_script_error": """ScriptError error message
     126""",
     127        }
     128        self.assert_queue_outputs(ews, expected_stderr=expected_stderr)
     129
    111130    # FIXME: If all EWSes are going to output the same text, we
    112131    # could test them all in one method with a for loop over an array.
Note: See TracChangeset for help on using the changeset viewer.