Commit b408165b authored by Greg Thompson's avatar Greg Thompson Committed by Commit Bot

More logging in test_installer.

- Log when the test waits for chrome.exe processes to exit.
- Wait until after chrome processes are gone before emitting their log.
- Emit chrome's log when the User Data dir cannot be deleted.

BUG=907979
R=rogerta@chromium.org

Change-Id: I3d142f4e3d23f79e67c367bee6b7477e66744a35
Reviewed-on: https://chromium-review.googlesource.com/c/1354452Reviewed-by: default avatarRoger Tawa <rogerta@chromium.org>
Commit-Queue: Greg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613113}
parent aadbebe5
......@@ -4,6 +4,7 @@
"""Common helper module for working with Chrome's processes and windows."""
import logging
import psutil
import re
import win32gui
......@@ -68,6 +69,8 @@ def WaitForChromeExit():
if not process:
# Pick any process to wait on if no top-level parent was found.
process = next(chrome_processes.itervalues())
logging.info(
'Waiting for %s chrome.exe processes to exit' % len(chrome_processes))
process.wait()
# Check for stragglers and keep waiting until all are gone.
chrome_processes = GetChromeProcesses()
......
......@@ -96,14 +96,14 @@ def CreateChromedriver(args):
chrome_options.add_argument('log-file=' + log_file)
chrome_options.add_argument('enable-logging')
chrome_options.add_argument('v=1')
emit_log = False
try:
driver = webdriver.Chrome(
args.chromedriver_path,
chrome_options=chrome_options)
yield driver
except:
with open(log_file) as fh:
logging.error(fh.read())
emit_log = True
raise
finally:
if driver:
......@@ -112,8 +112,16 @@ def CreateChromedriver(args):
# To help with local crash analysis, change None to tempfile.gettempdir().
# TODO(grt): Copy crash dumps into ${ISOLATED_OUTDIR}.
CollectCrashReports(user_data_dir, None)
DeleteWithRetry(log_file, os.remove)
DeleteWithRetry(user_data_dir, shutil.rmtree)
try:
DeleteWithRetry(user_data_dir, shutil.rmtree)
except:
emit_log = True
raise
finally:
if emit_log:
with open(log_file) as fh:
logging.error(fh.read())
DeleteWithRetry(log_file, os.remove)
def main():
......
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