Title: [118547] trunk/Tools
Revision
118547
Author
[email protected]
Date
2012-05-25 12:05:23 -0700 (Fri, 25 May 2012)

Log Message

[NRWT] Add unit testing for perf tests on locked shards
https://bugs.webkit.org/show_bug.cgi?id=87489

Patch by Thiago Marcos P. Santos <[email protected]> on 2012-05-25
Reviewed by Dirk Pranke.

Adding utests that makes sure that perf tests are running in locked
shards and by passing --no-http won't break NRWT (r118421).

* Scripts/webkitpy/layout_tests/controllers/manager_unittest.py:
(ShardingTests):
(ShardingTests.test_shard_by_dir):
(ShardingTests.test_shard_every_file):
(ShardingTests.test_shard_in_two):
(ShardingTests.test_multiple_locked_shards):
(LockCheckingManager):
(LockCheckingManager.__init__):
(LockCheckingManager.handle_finished_list):
(ManagerTest.test_http_locking):
(ManagerTest):
(ManagerTest.test_perf_locking):
* Scripts/webkitpy/layout_tests/port/test.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (118546 => 118547)


--- trunk/Tools/ChangeLog	2012-05-25 19:04:28 UTC (rev 118546)
+++ trunk/Tools/ChangeLog	2012-05-25 19:05:23 UTC (rev 118547)
@@ -1,3 +1,27 @@
+2012-05-25  Thiago Marcos P. Santos  <[email protected]>
+
+        [NRWT] Add unit testing for perf tests on locked shards
+        https://bugs.webkit.org/show_bug.cgi?id=87489
+
+        Reviewed by Dirk Pranke.
+
+        Adding utests that makes sure that perf tests are running in locked
+        shards and by passing --no-http won't break NRWT (r118421).
+
+        * Scripts/webkitpy/layout_tests/controllers/manager_unittest.py:
+        (ShardingTests):
+        (ShardingTests.test_shard_by_dir):
+        (ShardingTests.test_shard_every_file):
+        (ShardingTests.test_shard_in_two):
+        (ShardingTests.test_multiple_locked_shards):
+        (LockCheckingManager):
+        (LockCheckingManager.__init__):
+        (LockCheckingManager.handle_finished_list):
+        (ManagerTest.test_http_locking):
+        (ManagerTest):
+        (ManagerTest.test_perf_locking):
+        * Scripts/webkitpy/layout_tests/port/test.py:
+
 2012-05-25  Jessie Berlin  <[email protected]>
 
         [Win] fast/events/keydown-leftright-keys.html failing since introduction in r118001

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py (118546 => 118547)


--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py	2012-05-25 19:04:28 UTC (rev 118546)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py	2012-05-25 19:05:23 UTC (rev 118547)
@@ -73,6 +73,7 @@
         "dom/html/level2/html/HTMLAnchorElement03.html",
         "ietestcenter/_javascript_/11.1.5_4-4-c-1.html",
         "dom/html/level2/html/HTMLAnchorElement06.html",
+        "perf/object-keys.html",
     ]
 
     def get_shards(self, num_workers, fully_parallel, test_list=None, max_locked_shards=None):
@@ -95,7 +96,8 @@
               ['http/tests/security/view-source-no-refresh.html',
                'http/tests/websocket/tests/unicode.htm',
                'http/tests/websocket/tests/websocket-protocol-ignored.html',
-               'http/tests/xmlhttprequest/supported-xml-content-types.html'])])
+               'http/tests/xmlhttprequest/supported-xml-content-types.html',
+               'perf/object-keys.html'])])
         self.assertEquals(unlocked,
             [TestShard('animations',
                        ['animations/keyframes.html']),
@@ -113,7 +115,8 @@
             [TestShard('.', ['http/tests/websocket/tests/unicode.htm']),
              TestShard('.', ['http/tests/security/view-source-no-refresh.html']),
              TestShard('.', ['http/tests/websocket/tests/websocket-protocol-ignored.html']),
-             TestShard('.', ['http/tests/xmlhttprequest/supported-xml-content-types.html'])])
+             TestShard('.', ['http/tests/xmlhttprequest/supported-xml-content-types.html']),
+             TestShard('.', ['perf/object-keys.html'])]),
         self.assertEquals(unlocked,
             [TestShard('.', ['animations/keyframes.html']),
              TestShard('.', ['fast/css/display-none-inline-style-change-crash.html']),
@@ -128,7 +131,8 @@
                        ['http/tests/websocket/tests/unicode.htm',
                         'http/tests/security/view-source-no-refresh.html',
                         'http/tests/websocket/tests/websocket-protocol-ignored.html',
-                        'http/tests/xmlhttprequest/supported-xml-content-types.html'])])
+                        'http/tests/xmlhttprequest/supported-xml-content-types.html',
+                        'perf/object-keys.html'])])
         self.assertEquals(unlocked,
             [TestShard('unlocked_tests',
                        ['animations/keyframes.html',
@@ -157,7 +161,8 @@
                         'http/tests/websocket/tests/unicode.htm',
                         'http/tests/websocket/tests/websocket-protocol-ignored.html']),
              TestShard('locked_shard_2',
-                        ['http/tests/xmlhttprequest/supported-xml-content-types.html'])])
+                        ['http/tests/xmlhttprequest/supported-xml-content-types.html',
+                         'perf/object-keys.html'])])
 
         locked, unlocked = self.get_shards(num_workers=4, fully_parallel=False)
         self.assertEquals(locked,
@@ -165,9 +170,31 @@
                        ['http/tests/security/view-source-no-refresh.html',
                         'http/tests/websocket/tests/unicode.htm',
                         'http/tests/websocket/tests/websocket-protocol-ignored.html',
-                        'http/tests/xmlhttprequest/supported-xml-content-types.html'])])
+                        'http/tests/xmlhttprequest/supported-xml-content-types.html',
+                        'perf/object-keys.html'])])
 
 
+class LockCheckingManager(Manager):
+    def __init__(self, port, options, printer, tester, http_lock):
+        super(LockCheckingManager, self).__init__(port, options, printer)
+        self._finished_list_called = False
+        self._tester = tester
+        self._should_have_http_lock = http_lock
+
+    def handle_finished_list(self, source, list_name, num_tests, elapsed_time):
+        if not self._finished_list_called:
+            self._tester.assertEquals(list_name, 'locked_tests')
+            self._tester.assertTrue(self._remaining_locked_shards)
+            self._tester.assertTrue(self._has_http_lock is self._should_have_http_lock)
+
+        super(LockCheckingManager, self).handle_finished_list(source, list_name, num_tests, elapsed_time)
+
+        if not self._finished_list_called:
+            self._tester.assertEquals(self._remaining_locked_shards, [])
+            self._tester.assertFalse(self._has_http_lock)
+            self._finished_list_called = True
+
+
 class ManagerTest(unittest.TestCase):
     def get_options(self):
         return MockOptions(pixel_tests=False, new_baseline=False, time_out_ms=6000, slow_time_out_ms=30000, worker_model='inline')
@@ -192,36 +219,31 @@
         self.assertTrue('Baseline search path: test-mac-leopard -> test-mac-snowleopard -> generic' in printer.output)
 
     def test_http_locking(tester):
-        class LockCheckingManager(Manager):
-            def __init__(self, port, options, printer):
-                super(LockCheckingManager, self).__init__(port, options, printer)
-                self._finished_list_called = False
-
-            def handle_finished_list(self, source, list_name, num_tests, elapsed_time):
-                if not self._finished_list_called:
-                    tester.assertEquals(list_name, 'locked_tests')
-                    tester.assertTrue(self._remaining_locked_shards)
-                    tester.assertTrue(self._has_http_lock)
-
-                super(LockCheckingManager, self).handle_finished_list(source, list_name, num_tests, elapsed_time)
-
-                if not self._finished_list_called:
-                    tester.assertEquals(self._remaining_locked_shards, [])
-                    tester.assertFalse(self._has_http_lock)
-                    self._finished_list_called = True
-
         options, args = run_webkit_tests.parse_args(['--platform=test', '--print=nothing', 'http/tests/passes', 'passes'])
         host = MockHost()
         port = host.port_factory.get(port_name=options.platform, options=options)
         run_webkit_tests._set_up_derived_options(port, options)
         printer = printing.Printer(port, options, StringIO.StringIO(), StringIO.StringIO())
-        manager = LockCheckingManager(port, options, printer)
+        manager = LockCheckingManager(port, options, printer, tester, True)
         manager.collect_tests(args)
         manager.parse_expectations()
         num_unexpected_results = manager.run()
         printer.cleanup()
         tester.assertEquals(num_unexpected_results, 0)
 
+    def test_perf_locking(tester):
+        options, args = run_webkit_tests.parse_args(['--platform=test', '--print=nothing', '--no-http', 'passes', 'perf/'])
+        host = MockHost()
+        port = host.port_factory.get(port_name=options.platform, options=options)
+        run_webkit_tests._set_up_derived_options(port, options)
+        printer = printing.Printer(port, options, StringIO.StringIO(), StringIO.StringIO())
+        manager = LockCheckingManager(port, options, printer, tester, False)
+        manager.collect_tests(args)
+        manager.parse_expectations()
+        num_unexpected_results = manager.run()
+        printer.cleanup()
+        tester.assertEquals(num_unexpected_results, 0)
+
     def test_interrupt_if_at_failure_limits(self):
         port = Mock()  # FIXME: This should be a tighter mock.
         port.TEST_PATH_SEPARATOR = '/'

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py (118546 => 118547)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py	2012-05-25 19:04:28 UTC (rev 118546)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py	2012-05-25 19:05:23 UTC (rev 118547)
@@ -222,6 +222,10 @@
     tests.add('platform/test-snow-leopard/http/test.html')
     tests.add('platform/test-snow-leopard/websocket/test.html')
 
+    # For testing if perf tests are running in a locked shard.
+    tests.add('perf/foo/test.html')
+    tests.add('perf/foo/test-ref.html')
+
     return tests
 
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to