Skip to content

Commit

Permalink
Bug 1492873 [wpt PR 13113] - Handle case where mozlog is not installe…
Browse files Browse the repository at this point in the history
…d., a=testonly

Automatic update from web-platform-testsHandle case where mozlog is not installed. (#13113)

In case that mozlog is present we need to ensure any lock it holds is
released in subprocesses. In case it's not present we don't need to do
anything, so don't fail if we can't import it.

Fixes web-platform-tests/wpt#13112.
--

wpt-commits: 1f8fa9e610d934490538812d6121a77baf646bfc
wpt-pr: 13113

UltraBlame original commit: ba995f8b27019322f6b01edc29c7d061145fba02
  • Loading branch information
marco-c committed Oct 3, 2019
1 parent dc0f174 commit 3289d3e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion testing/web-platform/meta/MANIFEST.json
Original file line number Diff line number Diff line change
Expand Up @@ -653146,7 +653146,7 @@
"support"
],
"tools/serve/serve.py": [
"e8c6af20857d210aef792f7d78aaddd3fdd8adcf",
"8f95bd492322a65a5bbb78430734b769730d9e35",
"support"
],
"tools/serve/test_functional.py": [
Expand Down
22 changes: 13 additions & 9 deletions testing/web-platform/tests/tools/serve/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from six.moves import reload_module

from manifest.sourcefile import read_script_metadata, js_meta_re, parse_variants
from mozlog.structuredlog import StructuredLogger
from wptserve import server as wptserve, handlers
from wptserve import stash
from wptserve import config
Expand Down Expand Up @@ -632,14 +631,22 @@ def stop(self):
self.server = None


def release_mozlog_lock():
try:
from mozlog import StructuredLogger
try:
StructuredLogger._lock.release()
except threading.ThreadError:
pass
except ImportError:
pass


def start_ws_server(host, port, paths, routes, bind_address, config, **kwargs):


reload_module(logging)
try:
StructuredLogger._lock.release()
except threading.ThreadError:
pass
release_mozlog_lock()
return WebSocketDaemon(host,
str(port),
repo_root,
Expand All @@ -653,10 +660,7 @@ def start_wss_server(host, port, paths, routes, bind_address, config, **kwargs):


reload_module(logging)
try:
StructuredLogger._lock.release()
except threading.ThreadError:
pass
release_mozlog_lock()
return WebSocketDaemon(host,
str(port),
repo_root,
Expand Down

0 comments on commit 3289d3e

Please sign in to comment.