зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1494308 - Use consistent logger in wpt commands r=ato
Before we were using a different logger for the manifest download and the actual test run. This caused timestamps to get reset in a confusing way. Now create the logger early and share it for all the subseteps. Depends on D7171 Differential Revision: https://phabricator.services.mozilla.com/D7172 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a11c998bf1
Коммит
7b657769c4
|
@ -129,7 +129,11 @@ class WebPlatformTestsRunnerSetup(MozbuildObject):
|
|||
|
||||
class WebPlatformTestsUpdater(MozbuildObject):
|
||||
"""Update web platform tests."""
|
||||
def run_update(self, **kwargs):
|
||||
def setup_logging(self, **kwargs):
|
||||
import update
|
||||
return update.setup_logging(kwargs, {"mach": sys.stdout})
|
||||
|
||||
def run_update(self, logger, **kwargs):
|
||||
import update
|
||||
from update import updatecommandline
|
||||
|
||||
|
@ -141,7 +145,6 @@ class WebPlatformTestsUpdater(MozbuildObject):
|
|||
kwargs["store_state"] = False
|
||||
|
||||
kwargs = updatecommandline.check_args(kwargs)
|
||||
logger = update.setup_logging(kwargs, {"mach": sys.stdout})
|
||||
|
||||
try:
|
||||
update.run_update(logger, **kwargs)
|
||||
|
@ -269,24 +272,26 @@ testing/web-platform/tests for tests that may be shared
|
|||
if proc:
|
||||
proc.wait()
|
||||
|
||||
context.commands.dispatch("wpt-manifest-update", context)
|
||||
|
||||
|
||||
class WPTManifestUpdater(MozbuildObject):
|
||||
def run_update(self, rebuild=False, **kwargs):
|
||||
import manifestupdate
|
||||
def setup_logging(self, **kwargs):
|
||||
from wptrunner import wptlogging
|
||||
logger = wptlogging.setup(kwargs, {"mach": sys.stdout})
|
||||
|
||||
def run_update(self, logger, rebuild=False, **kwargs):
|
||||
import manifestupdate
|
||||
wpt_dir = os.path.abspath(os.path.join(self.topsrcdir, 'testing', 'web-platform'))
|
||||
config_dir = os.path.abspath(os.path.join(self.topobjdir, '_tests', 'web-platform'))
|
||||
manifestupdate.update(logger, wpt_dir, rebuild, config_dir)
|
||||
|
||||
|
||||
class WPTManifestDownloader(MozbuildObject):
|
||||
def run_download(self, manifest_update=True, force=False, **kwargs):
|
||||
import manifestdownload
|
||||
def setup_logging(self, **kwargs):
|
||||
from wptrunner import wptlogging
|
||||
logger = wptlogging.setup(kwargs, {"mach": sys.stdout})
|
||||
|
||||
def run_download(self, logger, manifest_update=True, force=False, **kwargs):
|
||||
import manifestdownload
|
||||
wpt_dir = os.path.abspath(os.path.join(self.topobjdir, '_tests', 'web-platform'))
|
||||
manifestdownload.run(wpt_dir, self.topsrcdir, logger, force, manifest_update)
|
||||
|
||||
|
@ -347,11 +352,14 @@ class MachCommands(MachCommandBase):
|
|||
params["include"].append(item["name"])
|
||||
del params["test_objects"]
|
||||
|
||||
self.wpt_manifest_download(**params)
|
||||
params["manifest_update"] = False
|
||||
wpt_setup = self._spawn(WebPlatformTestsRunnerSetup)
|
||||
wpt_runner = WebPlatformTestsRunner(wpt_setup)
|
||||
return wpt_runner.run(**params)
|
||||
|
||||
logger = wpt_runner.setup_logging(**params)
|
||||
|
||||
self.wpt_manifest_download(logger, **params)
|
||||
params["manifest_update"] = False
|
||||
return wpt_runner.run(logger, **params)
|
||||
|
||||
@Command("wpt",
|
||||
category="testing",
|
||||
|
@ -368,8 +376,10 @@ class MachCommands(MachCommandBase):
|
|||
self.virtualenv_manager.install_pip_package('html5lib==1.0.1')
|
||||
self.virtualenv_manager.install_pip_package('ujson')
|
||||
self.virtualenv_manager.install_pip_package('requests')
|
||||
|
||||
wpt_updater = self._spawn(WebPlatformTestsUpdater)
|
||||
return wpt_updater.run_update(**params)
|
||||
logger = wpt_updater.setup_logging(**params)
|
||||
return wpt_updater.run_update(logger, **params)
|
||||
|
||||
@Command("wpt-update",
|
||||
category="testing",
|
||||
|
@ -398,12 +408,17 @@ class MachCommands(MachCommandBase):
|
|||
self.setup()
|
||||
self.wpt_manifest_download(**params)
|
||||
wpt_manifest_updater = self._spawn(WPTManifestUpdater)
|
||||
return wpt_manifest_updater.run_update(**params)
|
||||
logger = wpt_manifest_updater.setup_logging(**params)
|
||||
self.wpt_manifest_download(logger, **params)
|
||||
return wpt_manifest_updater.run_update(logger, **params)
|
||||
|
||||
@Command("wpt-manifest-download",
|
||||
category="testing",
|
||||
parser=create_parser_manifest_download)
|
||||
def wpt_manifest_download(self, **params):
|
||||
def wpt_manifest_download(self, logger=None, **params):
|
||||
self.setup()
|
||||
if logger is None:
|
||||
from wptrunner import wptlogging
|
||||
logger = wptlogging.setup(params, {"mach": sys.stdout})
|
||||
wpt_manifest_downloader = self._spawn(WPTManifestDownloader)
|
||||
return wpt_manifest_downloader.run_download(**params)
|
||||
return wpt_manifest_downloader.run_download(logger, **params)
|
||||
|
|
|
@ -16,7 +16,11 @@ class WebPlatformTestsRunner(object):
|
|||
def __init__(self, setup):
|
||||
self.setup = setup
|
||||
|
||||
def run(self, **kwargs):
|
||||
def setup_logging(self, **kwargs):
|
||||
from wptrunner import wptrunner
|
||||
return wptrunner.setup_logging(kwargs, {self.setup.default_log_type: sys.stdout})
|
||||
|
||||
def run(self, logger, **kwargs):
|
||||
from wptrunner import wptrunner
|
||||
if kwargs["product"] in ["firefox", None]:
|
||||
kwargs = self.setup.kwargs_firefox(kwargs)
|
||||
|
@ -27,6 +31,5 @@ class WebPlatformTestsRunner(object):
|
|||
kwargs = self.setup.kwargs_wptrun(kwargs)
|
||||
else:
|
||||
raise ValueError("Unknown product %s" % kwargs["product"])
|
||||
logger = wptrunner.setup_logging(kwargs, {self.setup.default_log_type: sys.stdout})
|
||||
result = wptrunner.start(**kwargs)
|
||||
return int(not result)
|
||||
|
|
Загрузка…
Ссылка в новой задаче