Skip to content

Commit

Permalink
Allow test_runner to capture Ash logging for Lacros browser tests
Browse files Browse the repository at this point in the history
Added new parameter which collects Ash logging output for Lacros browser
tests if "--ash-logging-path=<path>" is specified.

Bug=-

Change-Id: Ia2508465c3ac5f5eeebfaa7ab4ec7eee4d375863
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3323842
Reviewed-by: Sven Zheng <svenzheng@chromium.org>
Commit-Queue: Stefan Kuhne <skuhne@chromium.org>
Auto-Submit: Stefan Kuhne <skuhne@chromium.org>
Cr-Commit-Position: refs/heads/main@{#949859}
  • Loading branch information
Stefan Kuhne authored and Chromium LUCI CQ committed Dec 9, 2021
1 parent bfb1d3e commit 7c91657
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion build/lacros/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,22 @@ def _RunTestWithAshChrome(args, forward_args):
ash_process_has_started = False
total_tries = 3
num_tries = 0

# Create a log file if the user wanted to have one.
log = None
if args.ash_logging_path:
log = open(args.ash_logging_path, 'a')

while not ash_process_has_started and num_tries < total_tries:
num_tries += 1
ash_process = subprocess.Popen(ash_cmd, env=ash_env)
if log is None:
ash_process = subprocess.Popen(ash_cmd, env=ash_env)
else:
ash_process = subprocess.Popen(ash_cmd,
env=ash_env,
stdout=log,
stderr=log)

ash_process_has_started = _WaitForAshChromeToStart(
tmp_xdg_dir_name, lacros_mojo_socket_file, enable_mojo_crosapi,
ash_ready_file)
Expand Down Expand Up @@ -583,6 +596,12 @@ def Main():
help='The same as --ash-chrome-path. But this will override '
'--ash-chrome-path or --ash-chrome-version if any of these '
'arguments exist.')
test_parser.add_argument(
'--ash-logging-path',
type=str,
help='File & path to ash-chrome logging output while running Lacros '
'browser tests. If not provided, no output will be generated.')

args = arg_parser.parse_known_args()
return args[0].func(args[0], args[1])

Expand Down

0 comments on commit 7c91657

Please sign in to comment.