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