From ce1aa289a23f20bf265dd40be84f6271aeffe1cc Mon Sep 17 00:00:00 2001 From: "dpranke@chromium.org" Date: Sat, 28 May 2011 01:56:23 +0000 Subject: [PATCH] 2011-05-27 Dirk Pranke 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 | 18 ++++++++++++++++++ .../layout_package/manager_worker_broker.py | 9 ++++++++- .../webkitpy/layout_tests/layout_package/printing.py | 10 ++++++---- .../layout_tests/layout_package/printing_unittest.py | 3 ++- .../Scripts/webkitpy/layout_tests/run_webkit_tests.py | 3 ++- 5 files changed, 36 insertions(+), 7 deletions(-) diff --git a/Tools/ChangeLog b/Tools/ChangeLog index ca07f57..e620cf8 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,21 @@ +2011-05-27 Dirk Pranke + + 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 Always decode tester names from location.hash diff --git a/Tools/Scripts/webkitpy/layout_tests/layout_package/manager_worker_broker.py b/Tools/Scripts/webkitpy/layout_tests/layout_package/manager_worker_broker.py index 83e75d5..822608f 100755 --- a/Tools/Scripts/webkitpy/layout_tests/layout_package/manager_worker_broker.py +++ b/Tools/Scripts/webkitpy/layout_tests/layout_package/manager_worker_broker.py @@ -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() diff --git a/Tools/Scripts/webkitpy/layout_tests/layout_package/printing.py b/Tools/Scripts/webkitpy/layout_tests/layout_package/printing.py index 80d5c59..472a746 100644 --- a/Tools/Scripts/webkitpy/layout_tests/layout_package/printing.py +++ b/Tools/Scripts/webkitpy/layout_tests/layout_package/printing.py @@ -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) diff --git a/Tools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py b/Tools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py index e6ea117..658283e 100644 --- a/Tools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/layout_package/printing_unittest.py @@ -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): diff --git a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py index 96384f4..7a37fd6 100755 --- a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py +++ b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py @@ -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) -- 2.7.4