Commit 8a0d7e94 authored by Kevin Marshall's avatar Kevin Marshall Committed by Commit Bot

Fuchsia: Include system logs in runner output by default.

System logs are included by default, unless they are deliberately
switched off by using the --no-system-logs flag.

-v now turns on DEBUG level logging and enables verbose mode for SSH.


Bug: 839662
Change-Id: I286dd33e3c76864154a98a9e4c07af49b036ec09
Reviewed-on: https://chromium-review.googlesource.com/1043453Reviewed-by: default avatarWez <wez@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556021}
parent ec3e0e33
...@@ -40,21 +40,17 @@ def AddCommonArgs(arg_parser): ...@@ -40,21 +40,17 @@ def AddCommonArgs(arg_parser):
common_args.add_argument('--ssh-config', '-F', common_args.add_argument('--ssh-config', '-F',
help='The path to the SSH configuration used for ' help='The path to the SSH configuration used for '
'connecting to the target device.') 'connecting to the target device.')
common_args.add_argument('--verbose', '-v', default=False, common_args.add_argument('--no-system-logs', default=False,
action='store_true', action='store_true',
help='Show more logging information.') help='Do not show system log data.')
common_args.add_argument('--really-verbose', '-vv', default=False, common_args.add_argument('--verbose', '-v', default=False,
action='store_true', action='store_true',
help='Show even more logging information, ' + help='Enable debug-level logging.')
'including SCP logs.')
def ConfigureLogging(args): def ConfigureLogging(args):
"""Configures the logging level based on command line |args|.""" """Configures the logging level based on command line |args|."""
if args.really_verbose:
args.verbose = True
logging.basicConfig(level=(logging.DEBUG if args.verbose else logging.INFO), logging.basicConfig(level=(logging.DEBUG if args.verbose else logging.INFO),
format='%(asctime)s:%(levelname)s:%(name)s:%(message)s') format='%(asctime)s:%(levelname)s:%(name)s:%(message)s')
...@@ -66,7 +62,7 @@ def ConfigureLogging(args): ...@@ -66,7 +62,7 @@ def ConfigureLogging(args):
# Verbose SCP output can be useful at times but oftentimes is just too noisy. # Verbose SCP output can be useful at times but oftentimes is just too noisy.
# Only enable it if -vv is passed. # Only enable it if -vv is passed.
logging.getLogger('ssh').setLevel( logging.getLogger('ssh').setLevel(
logging.DEBUG if args.really_verbose else logging.WARN) logging.DEBUG if args.verbose else logging.WARN)
def GetDeploymentTargetForArgs(args): def GetDeploymentTargetForArgs(args):
...@@ -74,7 +70,8 @@ def GetDeploymentTargetForArgs(args): ...@@ -74,7 +70,8 @@ def GetDeploymentTargetForArgs(args):
command line arguments.""" command line arguments."""
if not args.device: if not args.device:
return QemuTarget(args.output_directory, args.target_cpu) return QemuTarget(args.output_directory, args.target_cpu,
not args.no_system_logs)
else: else:
return DeviceTarget(args.output_directory, args.target_cpu, return DeviceTarget(args.output_directory, args.target_cpu,
args.host, args.port, args.ssh_config) args.host, args.port, args.ssh_config)
...@@ -33,14 +33,17 @@ def _GetAvailableTcpPort(): ...@@ -33,14 +33,17 @@ def _GetAvailableTcpPort():
class QemuTarget(target.Target): class QemuTarget(target.Target):
def __init__(self, output_dir, target_cpu, ram_size_mb=2048): def __init__(self, output_dir, target_cpu, system_logs,
ram_size_mb=2048):
"""output_dir: The directory which will contain the files that are """output_dir: The directory which will contain the files that are
generated to support the QEMU deployment. generated to support the QEMU deployment.
target_cpu: The emulated target CPU architecture. target_cpu: The emulated target CPU architecture.
Can be 'x64' or 'arm64'.""" Can be 'x64' or 'arm64'.
system_logs: If true, emit system log data."""
super(QemuTarget, self).__init__(output_dir, target_cpu) super(QemuTarget, self).__init__(output_dir, target_cpu)
self._qemu_process = None self._qemu_process = None
self._ram_size_mb = ram_size_mb self._ram_size_mb = ram_size_mb
self._system_logs = system_logs
def __enter__(self): def __enter__(self):
return self return self
...@@ -137,7 +140,7 @@ class QemuTarget(target.Target): ...@@ -137,7 +140,7 @@ class QemuTarget(target.Target):
logging.debug(' '.join(qemu_command)) logging.debug(' '.join(qemu_command))
stdio_flags = {'stdin': open(os.devnull)} stdio_flags = {'stdin': open(os.devnull)}
if logging.getLogger().getEffectiveLevel() != logging.DEBUG: if not self._system_logs:
# Output the Fuchsia debug log. # Output the Fuchsia debug log.
stdio_flags['stdout'] = open(os.devnull) stdio_flags['stdout'] = open(os.devnull)
stdio_flags['stderr'] = open(os.devnull) stdio_flags['stderr'] = open(os.devnull)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment