def test_trivial(self):
     delegate = LoggingDelegate(self)
     work_queue = QueueEngine("trivial-queue", delegate)
     work_queue.run()
     self.assertEquals(delegate._callbacks, LoggingDelegate.expected_callbacks)
     self.assertTrue(os.path.exists(os.path.join(self.temp_dir, "queue_log_path")))
     self.assertTrue(os.path.exists(os.path.join(self.temp_dir, "work_log_path", "work_item.log")))
Exemple #2
0
 def handle_script_error(cls, tool, state, script_error):
     is_svn_apply = script_error.command_name() == "svn-apply"
     status_id = cls._update_status_for_script_error(tool, state, script_error, is_error=is_svn_apply)
     if is_svn_apply:
         QueueEngine.exit_after_handled_error(script_error)
     message = "Attachment %s did not pass %s:\n\n%s\n\nIf any of these errors are false positives, please file a bug against check-webkit-style." % (state["patch"].id(), cls.name, script_error.message_with_output(output_limit=3*1024))
     tool.bugs.post_comment_to_bug(state["patch"].bug_id(), message, cc=cls.watchers)
     exit(1)
Exemple #3
0
 def handle_script_error(cls, tool, state, script_error):
     is_svn_apply = script_error.command_name() == "svn-apply"
     status_id = cls._update_status_for_script_error(tool, state, script_error, is_error=is_svn_apply)
     if is_svn_apply:
         QueueEngine.exit_after_handled_error(script_error)
     message = "Attachment %s did not pass %s:\n\n%s\n\nIf any of these errors are false positives, please file a bug against check-webkit-style." % (state["patch"].id(), cls.name, script_error.message_with_output(output_limit=3*1024))
     tool.bugs.post_comment_to_bug(state["patch"].bug_id(), message, cc=cls.watchers)
     exit(1)
Exemple #4
0
 def handle_script_error(cls, tool, state, script_error):
     is_svn_apply = script_error.command_name() == "svn-apply"
     status_id = cls._update_status_for_script_error(tool, state, script_error, is_error=is_svn_apply)
     if is_svn_apply:
         QueueEngine.exit_after_handled_error(script_error)
     results_link = tool.status_server.results_url_for_status(status_id)
     message = "Attachment %s did not build on %s:\nBuild output: %s" % (state["patch"].id(), cls.port_name, results_link)
     tool.bugs.post_comment_to_bug(state["patch"].bug_id(), message, cc=cls.watchers)
     exit(1)
 def run_and_handle_errors(self, tool, options, state=None):
     if not state:
         state = {}
     try:
         self._run(tool, options, state)
     except CheckoutNeedsUpdate, e:
         log("Commit failed because the checkout is out of date.  Please update and try again.")
         log("You can pass --no-build to skip building/testing after update if you believe the new commits did not affect the results.")
         QueueEngine.exit_after_handled_error(e)
Exemple #6
0
 def run_and_handle_errors(self, tool, options, state=None):
     if not state:
         state = {}
     try:
         self._run(tool, options, state)
     except CheckoutNeedsUpdate, e:
         log("Commit failed because the checkout is out of date.  Please update and try again.")
         log("You can pass --no-build to skip building/testing after update if you believe the new commits did not affect the results.")
         QueueEngine.exit_after_handled_error(e)
 def test_unexpected_error(self):
     delegate = ThrowErrorDelegate(self, 3)
     work_queue = QueueEngine("error-queue", delegate)
     work_queue.run()
     expected_callbacks = LoggingDelegate.expected_callbacks[:]
     work_item_index = expected_callbacks.index('process_work_item')
     # The unexpected error should be handled right after process_work_item starts
     # but before any other callback.  Otherwise callbacks should be normal.
     expected_callbacks.insert(work_item_index + 1, 'handle_unexpected_error')
     self.assertEquals(delegate._callbacks, expected_callbacks)
Exemple #8
0
class StepSequence(object):
    def __init__(self, steps):
        self._steps = steps or []

    def options(self):
        collected_options = [
            steps.Options.parent_command,
            steps.Options.quiet,
        ]
        for step in self._steps:
            collected_options = collected_options + step.options()
        # Remove duplicates.
        collected_options = sorted(set(collected_options))
        return collected_options

    def _run(self, tool, options, state):
        for step in self._steps:
            step(tool, options).run(state)

    def run_and_handle_errors(self, tool, options, state=None):
        if not state:
            state = {}
        try:
            self._run(tool, options, state)
        except CheckoutNeedsUpdate, e:
            log("Commit failed because the checkout is out of date.  Please update and try again.")
            log("You can pass --no-build to skip building/testing after update if you believe the new commits did not affect the results.")
            QueueEngine.exit_after_handled_error(e)
        except ScriptError, e:
            if not options.quiet:
                log(e.message_with_output())
            if options.parent_command:
                command = tool.command_by_name(options.parent_command)
                command.handle_script_error(tool, state, e)
            QueueEngine.exit_after_handled_error(e)
 def __init__(self, delegate):
     QueueEngine.__init__(self, "fast-queue", delegate)
 def test_handled_error(self):
     delegate = ThrowErrorDelegate(self, QueueEngine.handled_error_code)
     work_queue = QueueEngine("handled-error-queue", delegate)
     work_queue.run()
     self.assertEquals(delegate._callbacks, LoggingDelegate.expected_callbacks)