Changeset 53661 in webkit


Ignore:
Timestamp:
Jan 21, 2010 5:07:46 PM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-01-21 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Make the EWS transactional
https://bugs.webkit.org/show_bug.cgi?id=33978

Now if the EWS gets interrupted in the middle of processing a patch,
the bots will re-process the patch.

  • Scripts/test-webkitpy:
  • Scripts/webkitpy/commands/queues.py:
  • Scripts/webkitpy/commands/queues_unittest.py:
  • Scripts/webkitpy/patchcollection.py:
  • Scripts/webkitpy/patchcollection_unittest.py: Added.
Location:
trunk/WebKitTools
Files:
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r53658 r53661  
     12010-01-21  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Make the EWS transactional
     6        https://bugs.webkit.org/show_bug.cgi?id=33978
     7
     8        Now if the EWS gets interrupted in the middle of processing a patch,
     9        the bots will re-process the patch.
     10
     11        * Scripts/test-webkitpy:
     12        * Scripts/webkitpy/commands/queues.py:
     13        * Scripts/webkitpy/commands/queues_unittest.py:
     14        * Scripts/webkitpy/patchcollection.py:
     15        * Scripts/webkitpy/patchcollection_unittest.py: Added.
     16
    1172010-01-21  Adam Barth  <abarth@webkit.org>
    218
  • trunk/WebKitTools/Scripts/test-webkitpy

    r53217 r53661  
    4545from webkitpy.multicommandtool_unittest import *
    4646from webkitpy.networktransaction_unittest import *
     47from webkitpy.patchcollection_unittest import *
    4748from webkitpy.queueengine_unittest import *
    4849from webkitpy.steps.steps_unittest import *
  • trunk/WebKitTools/Scripts/webkitpy/commands/queues.py

    r53609 r53661  
    235235        return self.tool.status_server
    236236
     237    def is_terminal_status(self, status):
     238        return status == "Pass" or status == "Fail" or status.startswith("Error:")
     239
    237240    # AbstractQueue methods
    238241
  • trunk/WebKitTools/Scripts/webkitpy/commands/queues_unittest.py

    r53298 r53661  
    4141
    4242
     43class TestReviewQueue(AbstractReviewQueue):
     44    name = "test-review-queue"
     45
     46
    4347class AbstractQueueTest(CommandsTest):
    4448    def _assert_log_progress_output(self, patch_ids, progress_output):
     
    6468
    6569
     70class AbstractReviewQueueTest(CommandsTest):
     71    def test_patch_collection_delegate_methods(self):
     72        queue = TestReviewQueue()
     73        tool = MockBugzillaTool()
     74        queue.bind_to_tool(tool)
     75        self.assertEquals(queue.collection_name(), "test-review-queue")
     76        self.assertEquals(queue.fetch_potential_patch_ids(), [103])
     77        queue.status_server()
     78        self.assertTrue(queue.is_terminal_status("Pass"))
     79        self.assertTrue(queue.is_terminal_status("Fail"))
     80        self.assertTrue(queue.is_terminal_status("Error: Your patch exploded"))
     81        self.assertFalse(queue.is_terminal_status("Foo"))
     82
     83
    6684class CommitQueueTest(QueuesTest):
    6785    def test_commit_queue(self):
  • trunk/WebKitTools/Scripts/webkitpy/patchcollection.py

    r52430 r53661  
    3838        raise NotImplementedError, "subclasses must implement"
    3939
     40    def is_terminal_status(self, status):
     41        raise NotImplementedError, "subclasses must implement"
     42
    4043
    4144class PersistentPatchCollection:
     
    5154            return cached
    5255        status = self._status.patch_status(self._name, patch_id)
    53         if status:
     56        if status and self._delegate.is_terminal_status(status):
    5457            self._status_cache[patch_id] = status
    5558        return status
     
    5962        for patch_id in patch_ids:
    6063            status = self._cached_status(patch_id)
    61             if not status:
     64            if not status or not self._delegate.is_terminal_status(status):
    6265                return patch_id
    63 
  • trunk/WebKitTools/Scripts/webkitpy/patchcollection_unittest.py

    r53658 r53661  
    2828# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2929
    30 class PersistentPatchCollectionDelegate:
     30import unittest
     31
     32from webkitpy.mock import Mock
     33from webkitpy.patchcollection import PersistentPatchCollection, PersistentPatchCollectionDelegate
     34
     35
     36class TestPersistentPatchCollectionDelegate(PersistentPatchCollectionDelegate):
    3137    def collection_name(self):
    32         raise NotImplementedError, "subclasses must implement"
     38        return "test-collection"
    3339
    3440    def fetch_potential_patch_ids(self):
    35         raise NotImplementedError, "subclasses must implement"
     41        return [42, 192, 87]
    3642
    3743    def status_server(self):
    38         raise NotImplementedError, "subclasses must implement"
     44        return Mock()
     45
     46    def is_terminal_status(self, status):
     47        return False
    3948
    4049
    41 class PersistentPatchCollection:
    42     def __init__(self, delegate):
    43         self._delegate = delegate
    44         self._name = self._delegate.collection_name()
    45         self._status = self._delegate.status_server()
    46         self._status_cache = {}
    47 
    48     def _cached_status(self, patch_id):
    49         cached = self._status_cache.get(patch_id)
    50         if cached:
    51             return cached
    52         status = self._status.patch_status(self._name, patch_id)
    53         if status:
    54             self._status_cache[patch_id] = status
    55         return status
    56 
    57     def next(self):
    58         patch_ids = self._delegate.fetch_potential_patch_ids()
    59         for patch_id in patch_ids:
    60             status = self._cached_status(patch_id)
    61             if not status:
    62                 return patch_id
    63 
     50class PersistentPatchCollectionTest(unittest.TestCase):
     51    def test_next(self):
     52        collection = PersistentPatchCollection(TestPersistentPatchCollectionDelegate())
     53        collection.next()
Note: See TracChangeset for help on using the changeset viewer.