2011-02-01 Dirk Pranke <dpranke@chromium.org>
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Feb 2011 01:16:29 +0000 (01:16 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Feb 2011 01:16:29 +0000 (01:16 +0000)
        Reviewed by Tony Chang.

        new-run-webkit-tests: add first stub of test_runner2. This
        will add support for the 'inline', 'threads', and 'processes'
        flags to --worker-model, but for now the implementatios just
        fall back on the old ones.

        https://bugs.webkit.org/show_bug.cgi?id=53157

        * Scripts/webkitpy/layout_tests/layout_package/test_runner2.py:
        * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77341 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/layout_package/test_runner2.py [new file with mode: 0644]
Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py

index d5e1f6b8ceef03b6ac7f079c5bba6ffdd9a69427..0a50e835bebf7087aac77e0ccbc04a6ea54574e9 100644 (file)
@@ -1,3 +1,17 @@
+2011-02-01  Dirk Pranke  <dpranke@chromium.org>
+
+        Reviewed by Tony Chang.
+
+        new-run-webkit-tests: add first stub of test_runner2. This
+        will add support for the 'inline', 'threads', and 'processes'
+        flags to --worker-model, but for now the implementatios just
+        fall back on the old ones.
+
+        https://bugs.webkit.org/show_bug.cgi?id=53157
+
+        * Scripts/webkitpy/layout_tests/layout_package/test_runner2.py:
+        * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:
+
 2011-02-01  Mihai Parparita  <mihaip@chromium.org>
 
         Reviewed by James Robinson.
diff --git a/Tools/Scripts/webkitpy/layout_tests/layout_package/test_runner2.py b/Tools/Scripts/webkitpy/layout_tests/layout_package/test_runner2.py
new file mode 100644 (file)
index 0000000..eb78752
--- /dev/null
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+# Copyright (C) 2011 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.
+
+"""
+The TestRunner2 package is an alternate implementation of the TestRunner
+class. For now it is just a stub, but eventually it will use the
+message broker abstraction to pass messages to workers to run sets of
+tests and then process the completion messages accordingly.
+"""
+
+import logging
+
+import test_runner
+
+_log = logging.getLogger(__name__)
+
+
+class TestRunner2(test_runner.TestRunner):
+    def __init__(self, port, options, printer):
+
+        # FIXME: This'll get replaced with a real implementation soon enough.
+        if options.worker_model in ('inline', 'threads'):
+            options.worker_model = 'old-' + options.worker_model
+        if options.worker_model == 'processes':
+            raise ValueError("--worker-model=processes not supported yet")
+
+        test_runner.TestRunner.__init__(self, port, options, printer)
index 074d9c46db352930858cc8ea4859db3cbbcb5054..1971d54622c5c986f2260438697cffc6b926eb69 100755 (executable)
@@ -39,6 +39,7 @@ import sys
 
 from layout_package import printing
 from layout_package import test_runner
+from layout_package import test_runner2
 
 from webkitpy.common.system import user
 from webkitpy.thirdparty import simplejson
@@ -87,7 +88,11 @@ def run(port, options, args, regular_output=sys.stderr,
     # in a try/finally to ensure that we clean up the logging configuration.
     num_unexpected_results = -1
     try:
-        runner = test_runner.TestRunner(port, options, printer)
+        if options.worker_model in ('inline', 'threads', 'processes'):
+            runner = test_runner2.TestRunner2(port, options, printer)
+        else:
+            runner = test_runner.TestRunner(port, options, printer)
+
         runner._print_config()
 
         printer.print_update("Collecting tests ...")
@@ -129,9 +134,9 @@ def _set_up_derived_options(port_obj, options):
     if options.worker_model is None:
         options.worker_model = port_obj.default_worker_model()
 
-    if options.worker_model == 'old-inline':
+    if options.worker_model in ('inline', 'old-inline'):
         if options.child_processes and int(options.child_processes) > 1:
-            warnings.append("--worker-model=old-inline overrides --child-processes")
+            warnings.append("--worker-model=%s overrides --child-processes" % options.worker_model)
         options.child_processes = "1"
     if not options.child_processes:
         options.child_processes = os.environ.get("WEBKIT_TEST_CHILD_PROCESSES",
@@ -369,8 +374,8 @@ def parse_args(args=None):
             help="Number of DumpRenderTrees to run in parallel."),
         # FIXME: Display default number of child processes that will run.
         optparse.make_option("--worker-model", action="store",
-            default=None, help=("controls worker model. Valid values "
-                                "are 'old-inline', 'old-threads'.")),
+            default=None, help=("controls worker model. Valid values are 'old-inline', "
+                                "'old-threads', 'inline', 'threads', and 'processes'.")),
         optparse.make_option("--experimental-fully-parallel",
             action="store_true", default=False,
             help="run all tests in parallel"),
index 112e402794c9ebc7bd93bf8609eb3ffe35661a33..fff35771613170ffd28bcab4fbe2e59b33aa2f74 100644 (file)
@@ -452,11 +452,26 @@ class MainTest(unittest.TestCase):
         self.assertEqual(None, test_port.tolerance_used_for_diff_image)
 
     def test_worker_model__inline(self):
+        self.assertTrue(passing_run(['--worker-model', 'inline']))
+
+    def test_worker_model__old_inline_with_child_processes(self):
+        res, out, err, user = logging_run(['--worker-model', 'old-inline',
+                                           '--child-processes', '2'])
+        self.assertEqual(res, 0)
+        self.assertTrue('--worker-model=old-inline overrides --child-processes\n' in err.get())
+
+    def test_worker_model__old_inline(self):
         self.assertTrue(passing_run(['--worker-model', 'old-inline']))
 
-    def test_worker_model__threads(self):
+    def test_worker_model__old_threads(self):
         self.assertTrue(passing_run(['--worker-model', 'old-threads']))
 
+    def test_worker_model__processes(self):
+        self.assertRaises(ValueError, logging_run, ['--worker-model', 'processes'])
+
+    def test_worker_model__threads(self):
+        self.assertTrue(passing_run(['--worker-model', 'threads']))
+
     def test_worker_model__unknown(self):
         self.assertRaises(ValueError, logging_run,
                           ['--worker-model', 'unknown'])