Bug 1445624 - [test] Make sure verbose logging is enabled when running a single test, r=gbrown

This sets verbose=True (used by the mach formatter) and compact=False (used by tbplformatter) if
only a single test is specified with either |mach test| or |mach mochitest|.

This way all TEST_STATUS and log lines will be visible when developers are writing a new test.

MozReview-Commit-ID: 2nuKs9DLnx0

--HG--
extra : rebase_source : 1fc594b465a2a94dfcd85d56d042969af47f6f65
This commit is contained in:
Andrew Halberstadt 2018-03-19 16:04:02 -04:00
Родитель c30792183c
Коммит 20f38147c2
2 изменённых файлов: 20 добавлений и 13 удалений

Просмотреть файл

@ -122,10 +122,13 @@ class Test(MachCommandBase):
return 1
# Create shared logger
format_args = {'level': self._mach_context.settings['test']['level']}
if not run_suites and len(run_tests) == 1:
format_args['verbose'] = True
format_args['compact'] = False
default_format = self._mach_context.settings['test']['format']
default_level = self._mach_context.settings['test']['level']
log = setup_logging('mach-test', log_args, {default_format: sys.stdout},
{'level': default_level})
log = setup_logging('mach-test', log_args, {default_format: sys.stdout}, format_args)
for handler in log.handlers:
if isinstance(handler, StreamHandler):
handler.formatter.inner.summary_on_shutdown = True

Просмотреть файл

@ -300,16 +300,6 @@ class MachCommands(MachCommandBase):
else:
flavors = [f for f, v in ALL_FLAVORS.iteritems() if buildapp in v['enabled_apps']]
if not kwargs.get('log'):
# Create shared logger
default_format = self._mach_context.settings['test']['format']
default_level = self._mach_context.settings['test']['level']
kwargs['log'] = setup_logging('mach-mochitest', kwargs, {default_format: sys.stdout},
{'level': default_level})
for handler in kwargs['log'].handlers:
if isinstance(handler, StreamHandler):
handler.formatter.inner.summary_on_shutdown = True
from mozbuild.controller.building import BuildDriver
self._ensure_state_subdir_exists('.')
@ -321,6 +311,20 @@ class MachCommands(MachCommandBase):
if resolve_tests:
tests = mochitest.resolve_tests(test_paths, test_objects, cwd=self._mach_context.cwd)
if not kwargs.get('log'):
# Create shared logger
format_args = {'level': self._mach_context.settings['test']['level']}
if len(tests) == 1:
format_args['verbose'] = True
format_args['compact'] = False
default_format = self._mach_context.settings['test']['format']
kwargs['log'] = setup_logging('mach-mochitest', kwargs, {default_format: sys.stdout},
format_args)
for handler in kwargs['log'].handlers:
if isinstance(handler, StreamHandler):
handler.formatter.inner.summary_on_shutdown = True
driver = self._spawn(BuildDriver)
driver.install_tests(tests)