2010-05-04 Dirk Pranke <dpranke@chromium.org>
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 May 2010 00:16:49 +0000 (00:16 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 May 2010 00:16:49 +0000 (00:16 +0000)
        Reviewed by Eric Seidel.

        new-run-webkit-tests: turn off threading on the Chromium Mac port until
        we can stabilize the port more and figure out why it is hanging so
        frequently.

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

        * Scripts/webkitpy/layout_tests/port/chromium_mac.py:
          - override default_child_processes() and log a warning
        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
          - fix a typo that caused us to print a method object instead of the
            value the method object returns in the case where there is only
            one child process.
        * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:
          - Add unit tests for the output of run_webkit_tests - in this case,
            the handling of --child-processes and --print config

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

WebKitTools/ChangeLog
WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py

index 2713dccc2fda96ed7aec67d43e3afe8c29d8d24c..71834eda635a78b04f8d8a1b8a4f26305433ea42 100644 (file)
@@ -1,3 +1,23 @@
+2010-05-04  Dirk Pranke  <dpranke@chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        new-run-webkit-tests: turn off threading on the Chromium Mac port until
+        we can stabilize the port more and figure out why it is hanging so
+        frequently.
+
+        https://bugs.webkit.org/show_bug.cgi?id=38553
+
+        * Scripts/webkitpy/layout_tests/port/chromium_mac.py:
+          - override default_child_processes() and log a warning
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+          - fix a typo that caused us to print a method object instead of the
+            value the method object returns in the case where there is only
+            one child process.
+        * Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py:
+          - Add unit tests for the output of run_webkit_tests - in this case,
+            the handling of --child-processes and --print config
+
 2010-05-04  Timothy Hatcher  <timothy@apple.com>
 
         Fix the find command in extract-localizable-strings so skip
index 0d1d27bb117e870da62687990b77bd36b0a6a126..4ead26fc3032c32fb6f944cceabcb13b8469a52d 100644 (file)
@@ -67,6 +67,15 @@ class ChromiumMacPort(chromium.ChromiumPort):
                        'MacBuildInstructions')
         return result
 
+    def default_child_processes(self):
+        # FIXME: we need to run single-threaded for now. See
+        # https://bugs.webkit.org/show_bug.cgi?id=38553. Unfortunately this
+        # routine is called right before the logger is configured, so if we
+        # try to _log.warning(), it gets thrown away.
+        import sys
+        sys.stderr.write("Defaulting to one child - see https://bugs.webkit.org/show_bug.cgi?id=38553\n")
+        return 1
+
     def driver_name(self):
         """name for this port's equivalent of DumpRenderTree."""
         if self._options.use_drt:
index 490b0fc0edd227203879660794b2d03b3ef43f31..77fda72eb96fbd5f2f64c40cce2c012b94a26197 100755 (executable)
@@ -1232,15 +1232,18 @@ def read_test_files(files):
     return tests
 
 
-def run(port_obj, options, args):
+def run(port_obj, options, args, regular_output=sys.stderr,
+        buildbot_output=sys.stdout):
     """Run the tests.
 
     Args:
       port_obj: Port object for port-specific behavior
       options: a dictionary of command line options
       args: a list of sub directories or files to test
-      print_results: whether or not to log anything to stdout.
-          Set to false by the unit tests
+      regular_output: a stream-like object that we can send logging/debug
+          output to
+      buildbot_output: a stream-like object that we can write all output that
+          is intended to be parsed by the buildbot to
     Returns:
       the number of unexpected results that occurred, or -1 if there is an
           error.
@@ -1253,8 +1256,8 @@ def run(port_obj, options, args):
         # FIXME: Investigate perf/flakiness impact of using cpu_count + 1.
         options.child_processes = port_obj.default_child_processes()
 
-    printer = printing.Printer(port_obj, options, regular_output=sys.stderr,
-        buildbot_output=sys.stdout,
+    printer = printing.Printer(port_obj, options, regular_output=regular_output,
+        buildbot_output=buildbot_output,
         child_processes=int(options.child_processes),
         is_fully_parallel=options.experimental_fully_parallel)
     if options.help_printing:
@@ -1316,7 +1319,7 @@ def run(port_obj, options, args):
                    (options.time_out_ms, options.slow_time_out_ms))
 
     if int(options.child_processes) == 1:
-        printer.print_config("Running one %s" % port_obj.driver_name)
+        printer.print_config("Running one %s" % port_obj.driver_name())
     else:
         printer.print_config("Running %s %ss in parallel" % (
                        options.child_processes, port_obj.driver_name()))
index 6123e80636cc5a77b5cdf817193e84e06fb68e59..dfe691e0e428c395a5f419d4146000da937a5a88 100644 (file)
@@ -39,6 +39,29 @@ from webkitpy.layout_tests import run_webkit_tests
 from webkitpy.thirdparty.mock import Mock
 
 
+class ArrayStream(object):
+    def __init__(self):
+        self._contents = []
+
+    def write(self, msg):
+        self._contents.append(msg)
+
+    def get(self):
+        return self._contents
+
+    def reset(self):
+        self._contents = []
+
+    def empty(self):
+        return (len(self._contents) == 0)
+
+    def flush(self):
+        pass
+
+    def __repr__(self):
+        return '<ArrayStream: ' + str(self._contents) + '>'
+
+
 def passing_run(args, port_obj=None, logging_included=False):
     if not logging_included:
         args.extend(['--print', 'nothing'])
@@ -48,6 +71,16 @@ def passing_run(args, port_obj=None, logging_included=False):
     res = run_webkit_tests.run(port_obj, options, args)
     return res == 0
 
+def logging_run(args):
+    options, args = run_webkit_tests.parse_args(args)
+    port_obj = port.get(options.platform, options)
+    buildbot_output = ArrayStream()
+    regular_output = ArrayStream()
+    res = run_webkit_tests.run(port_obj, options, args,
+                               buildbot_output=buildbot_output,
+                               regular_output=regular_output)
+    return (res, buildbot_output, regular_output)
+
 
 class MainTest(unittest.TestCase):
     def test_fast(self):
@@ -63,6 +96,20 @@ class MainTest(unittest.TestCase):
                                      '--print', 'unexpected',
                                      'fast/html']))
 
+    def test_child_processes(self):
+        (res, buildbot_output, regular_output) = logging_run(
+             ['--platform', 'test', '--print', 'config', '--child-processes',
+              '1', 'fast/html'])
+        self.assertTrue('Running one DumpRenderTree\n'
+                        in regular_output.get())
+
+        (res, buildbot_output, regular_output) = logging_run(
+             ['--platform', 'test', '--print', 'config', '--child-processes',
+              '2', 'fast/html'])
+        self.assertTrue('Running 2 DumpRenderTrees in parallel\n'
+                        in regular_output.get())
+
+
 
 class TestRunnerTest(unittest.TestCase):
     def test_results_html(self):