Commit 4241e8ea authored by jonross's avatar jonross Committed by Commit Bot

Update Browser Restart for Pixel Tests

If a GPU Pixel Test crashes during init, it will attempt to close the non
existent browser, crashing the run.

Once a test ends, it restarts the browser, with the current command line. This
leads to command lines propagating between tests. Normally a test will then
restart the browser an additional time, with new command line args, if desired.

However if init is failing, this then persists for all subsequent tests.

This change updates the restart behaviour to detect failed init. Then to use
default args for the restart. To allow subsequent tests the change to succeed
at init.

Furthermore, ChromeBrowserBackend._GetDevToolsClient can timeout while we are
attempting to handle exceptions in _RunGpuTest. Leading to the test suite left
without an open browser. This error then cascades, leading to the next test to
also fail. (crbug.com/993379)

This change also updates _EnsureTabIsAvailable to create a browser with the
default options if we are ever in such a case. To prevent one failure from affecting
subsequent runs.

Bug: 985530
Change-Id: I7256fa01e9b1e5d84a65a7073b3fb625a716f13c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715778
Commit-Queue: Jonathan Ross <jonross@chromium.org>
Reviewed-by: default avatarBrian Sheedy <bsheedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686566}
parent e74bffd9
...@@ -157,9 +157,13 @@ class GpuIntegrationTest( ...@@ -157,9 +157,13 @@ class GpuIntegrationTest(
@classmethod @classmethod
def _RestartBrowser(cls, reason): def _RestartBrowser(cls, reason):
logging.warning('Restarting browser due to '+ reason) logging.warning('Restarting browser due to '+ reason)
cls.StopBrowser() if cls.browser is None:
cls.SetBrowserOptions(cls._finder_options) cls.SetBrowserOptions(cls._original_finder_options)
cls.StartBrowser() cls.StartBrowser()
else:
cls.StopBrowser()
cls.SetBrowserOptions(cls._finder_options)
cls.StartBrowser()
def _RunGpuTest(self, url, test_name, *args): def _RunGpuTest(self, url, test_name, *args):
expected_results, should_retry_on_failure = ( expected_results, should_retry_on_failure = (
...@@ -323,6 +327,14 @@ class GpuIntegrationTest( ...@@ -323,6 +327,14 @@ class GpuIntegrationTest(
@classmethod @classmethod
def _EnsureTabIsAvailable(cls): def _EnsureTabIsAvailable(cls):
try: try:
# If there is no browser, the previous run may have failed an additional
# time, while trying to recover from an initial failure.
# ChromeBrowserBackend._GetDevToolsClient can cause this if there is a
# crash during browser startup. If this has occurred, reset the options,
# and attempt to bring up a browser for this test. Otherwise failures
# begin to cascade between tests. https://crbug.com/993379
if cls.browser is None:
cls._RestartBrowser('failure in previous shutdown')
cls.tab = cls.browser.tabs[0] cls.tab = cls.browser.tabs[0]
except Exception: except Exception:
# restart the browser to make sure a failure in a test doesn't # restart the browser to make sure a failure in a test doesn't
......
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