2011-05-27 Dirk Pranke <dpranke@chromium.org>
authordpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 May 2011 01:56:23 +0000 (01:56 +0000)
committerdpranke@chromium.org <dpranke@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 May 2011 01:56:23 +0000 (01:56 +0000)
        Reviewed by Ojan Vafai.

        NRWT: debug messages from the workers are being logged twice
        https://bugs.webkit.org/show_bug.cgi?id=60428

        It looks like when the workers are run in separate processes
        we end up getting two copies of every log message they print.
        This has to do with the multiprocessing module on UNIX cloning
        the log configuration in a way I wasn't expecting, and so two
        log handlers end up getting registered.

        * Scripts/webkitpy/layout_tests/layout_package/manager_worker_broker.py:
        * Scripts/webkitpy/layout_tests/layout_package/printing.py:
        * Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py:
        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:

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

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/layout_package/manager_worker_broker.py
Tools/Scripts/webkitpy/layout_tests/layout_package/printing.py
Tools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py
Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py

index ca07f57..e620cf8 100644 (file)
@@ -1,3 +1,21 @@
+2011-05-27  Dirk Pranke  <dpranke@chromium.org>
+
+        Reviewed by Ojan Vafai.
+
+        NRWT: debug messages from the workers are being logged twice
+        https://bugs.webkit.org/show_bug.cgi?id=60428
+
+        It looks like when the workers are run in separate processes
+        we end up getting two copies of every log message they print.
+        This has to do with the multiprocessing module on UNIX cloning
+        the log configuration in a way I wasn't expecting, and so two
+        log handlers end up getting registered.
+
+        * Scripts/webkitpy/layout_tests/layout_package/manager_worker_broker.py:
+        * Scripts/webkitpy/layout_tests/layout_package/printing.py:
+        * Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py:
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+
 2011-05-27  Adam Roben  <aroben@apple.com>
 
         Always decode tester names from location.hash
index 83e75d5..822608f 100755 (executable)
@@ -319,11 +319,18 @@ if multiprocessing:
         def run(self):
             options = self._options
             port_obj = port.get(self._platform_name, options)
+
+            # The unix multiprocessing implementation clones the
+            # log handler configuration into the child processes,
+            # but the win implementation doesn't.
+            configure_logging = (sys.platform == 'win32')
+
             # FIXME: this won't work if the calling process is logging
             # somewhere other than sys.stderr and sys.stdout, but I'm not sure
             # if this will be an issue in practice.
             printer = printing.Printer(port_obj, options, sys.stderr, sys.stdout,
-                int(options.child_processes), options.experimental_fully_parallel)
+                int(options.child_processes), options.experimental_fully_parallel,
+                configure_logging)
             self._client.run(port_obj)
             printer.cleanup()
 
index 80d5c59..472a746 100644 (file)
@@ -210,7 +210,7 @@ class Printer(object):
     By default the buildbot-parsed code gets logged to stdout, and regular
     output gets logged to stderr."""
     def __init__(self, port, options, regular_output, buildbot_output,
-                 child_processes, is_fully_parallel):
+                 child_processes, is_fully_parallel, configure_logging):
         """
         Args
           port               interface to port-specific routines
@@ -224,8 +224,9 @@ class Printer(object):
           is_fully_parallel  are the tests running in a single queue, or
                              in shards (usually controlled by
                              --experimental-fully-parallel)
+          configure_loggign  Whether a logging handler should be registered
 
-        Note that the last two args are separate rather than bundled into
+        Note that the fourth and fifth args are separate rather than bundled into
         the options structure so that this object does not assume any flags
         set in options that weren't returned from logging_options(), above.
         The two are used to determine whether or not we can sensibly use
@@ -244,8 +245,9 @@ class Printer(object):
 
         self._meter = metered_stream.MeteredStream(options.verbose,
                                                    regular_output)
-        self._logging_handler = _configure_logging(self._meter,
-            options.verbose)
+        self._logging_handler = None
+        if configure_logging:
+            self._logging_handler = _configure_logging(self._meter, options.verbose)
 
         self.switches = parse_print_options(options.print_options,
             options.verbose, child_processes, is_fully_parallel)
index e6ea117..658283e 100644 (file)
@@ -127,7 +127,8 @@ class  Testprinter(unittest.TestCase):
         buildbot_output = array_stream.ArrayStream()
         printer = printing.Printer(self._port, options, regular_output,
                                    buildbot_output, single_threaded,
-                                   is_fully_parallel)
+                                   is_fully_parallel,
+                                   configure_logging=True)
         return printer, regular_output, buildbot_output
 
     def get_result(self, test, result_type=test_expectations.PASS, run_time=0):
index 96384f4..7a37fd6 100755 (executable)
@@ -72,7 +72,8 @@ def run(port, options, args, regular_output=sys.stderr,
     warnings = _set_up_derived_options(port, options)
 
     printer = printing.Printer(port, options, regular_output, buildbot_output,
-        int(options.child_processes), options.experimental_fully_parallel)
+        int(options.child_processes), options.experimental_fully_parallel,
+        configure_logging=True)
     for w in warnings:
         _log.warning(w)