Bug 1871064 [wpt PR 43752] - Retry firefox_android package install, a=testonly

Automatic update from web-platform-tests
Retry firefox_android package install

Instead of having a single very long timeout, retry the install from
the start up to 5 times.

It appears that when the install fails it's not running into a
timeout, but for some reason the emulator is in the wrong state. In
this case restarting the operation from scratch works. Locally three
attempts in total were sometimes required, but this allows up to 5
retries (six total attempts) since CI machines may be slower.

--

wpt-commits: ecf9566335f222a8a724edd3d19004cc5e1867f8
wpt-pr: 43752
This commit is contained in:
moz-wptsync-bot 2023-12-22 08:36:05 +00:00
Родитель 705c1070e2
Коммит b6bfa37e5b
1 изменённых файлов: 23 добавлений и 10 удалений

Просмотреть файл

@ -410,19 +410,32 @@ class FirefoxAndroid(BrowserSetup):
device = mozdevice.ADBDeviceFactory(adb=kwargs["adb_binary"],
device=device_serial)
self._logcat.start(device_serial)
max_retries = 5
last_exception = None
if self.browser.apk_path:
device.uninstall_app(app)
# device.install_app(self.browser.apk_path, timeout=600)
# Temporarily replace mozdevice function with custom code
# that passes in the `--no-incremental` option
cmd = ["install", "--no-incremental", self.browser.apk_path]
data = device.command_output(cmd, timeout=600)
if data.find("Success") == -1:
raise mozdevice.ADBError("install failed for %s. Got: %s" % (self.browser.apk_path,
data))
for i in range(max_retries + 1):
logger.info(f"Installing {app} on {device_serial} "
f"attempt {i + 1}/{max_retries + 1}")
try:
# Temporarily replace mozdevice function with custom code
# that passes in the `--no-incremental` option
cmd = ["install", "--no-incremental", self.browser.apk_path]
logger.debug(" ".join(cmd))
data = device.command_output(cmd, timeout=120)
if data.find("Success") == -1:
raise mozdevice.ADBError(f"Install failed for {self.browser.apk_path}."
f" Got: {data}")
except Exception as e:
last_exception = e
else:
break
else:
assert last_exception is not None
raise WptrunError(f"Failed to install {app} on device {device_serial} "
f"after {max_retries} retries") from last_exception
elif not device.is_app_installed(app):
raise WptrunError("app %s not installed on device %s" %
(app, device_serial))
raise WptrunError(f"app {app} not installed on device {device_serial}")
kwargs["enable_webtransport_h3"] = True