Bug 1900471 - Fix Android CaR installation. r=perftest-reviewers,sparky

The custom Chromium-as-Release builds were not being correctly installed
before on android from the fetches. This patch fixes that by adding a
`install-chromium-android` method to install with adb via mozdevice.

Until now the logs were showing the correct `binary` and `app` so it was
easily missed. It was incorrectly implemented in the
`install-chromium-distributions` method but that only "installed" it on
the host Linux device, and not actually on the Android device

Differential Revision: https://phabricator.services.mozilla.com/D212598
This commit is contained in:
KS 2024-06-05 03:56:04 +00:00
parent 82e064164d
commit 0681ff940f
5 changed files with 35 additions and 8 deletions

View file

@ -13,6 +13,7 @@ config = {
"populate-webroot",
"create-virtualenv",
"install-chrome-android",
"install-chromium-android",
"install-chromium-distribution",
"install",
"run-tests",

View file

@ -13,6 +13,7 @@ config = {
"populate-webroot",
"create-virtualenv",
"install-chrome-android",
"install-chromium-android",
"install-chromium-distribution",
"run-tests",
],

View file

@ -644,6 +644,7 @@ class Raptor(
"populate-webroot",
"create-virtualenv",
"install-chrome-android",
"install-chromium-android",
"install-chromium-distribution",
"install-safari-technology-preview",
"install",
@ -805,7 +806,7 @@ class Raptor(
def install_chrome_android(self):
"""Install Google Chrome for Android in production from tooltool"""
if self.app not in ("chrome-m", "cstm-car-m"):
if self.app != "chrome-m":
self.info("Google Chrome for Android not required")
return
if self.config.get("run_local"):
@ -814,10 +815,30 @@ class Raptor(
"from tooltool when running locally"
)
return
self.info("Fetching and installing Google Chrome for Android")
self.device.shell_output("cmd package install-existing com.android.chrome")
self.info("Google Chrome for Android successfully installed")
def install_chromium_android(self):
"""Install custom Chromium-as-Release for Android from toolchain fetch"""
if self.app != "cstm-car-m":
self.info("Chromium-as-Release for Android not required")
return
if self.config.get("run_local"):
self.info(
"Chromium-as-Release for Android will not be installed "
"when running locally"
)
return
self.info("Installing Custom Chromium-as-Release for Android")
cstm_car_m_apk = pathlib.Path(
os.environ["MOZ_FETCHES_DIR"], "chromium", "apks", "ChromePublic.apk"
)
self.device.install_app(str(cstm_car_m_apk))
self.info("Custom Chromium-as-Release for Android successfully installed")
def download_chrome_android(self):
# Fetch the APK
tmpdir = tempfile.mkdtemp()
@ -862,16 +883,14 @@ class Raptor(
def install_chromium_distribution(self):
"""Install Google Chromium distribution in production"""
linux, mac, win = "linux", "mac", "win"
chrome, chromium_release, chromium_release_android = (
chrome, chromium_release = (
"chrome",
"custom-car",
"cstm-car-m",
)
available_chromium_dists = [
chrome,
chromium_release,
chromium_release_android,
]
binary_location = {
chromium_release: {
@ -879,9 +898,6 @@ class Raptor(
win: ["chromium", "Default", "chrome.exe"],
mac: ["chromium", "Chromium.app", "Contents", "MacOS", "chromium"],
},
chromium_release_android: {
linux: ["chromium", "apks", "ChromePublic.apk"],
},
}
if self.app not in available_chromium_dists:
@ -989,6 +1005,9 @@ class Raptor(
elif self.app == "safari-tp" and not self.run_local:
binary_path = "/Applications/Safari Technology Preview.app/Contents/MacOS/Safari Technology Preview"
kw_options["binary"] = binary_path
# Custom Chromium-as-Release for Android
elif self.app == "cstm-car-m":
kw_options["binary"] = "org.chromium.chrome"
# Running on Chromium
elif not self.run_local:
# When running locally we already set the Chromium binary above, in init.

View file

@ -98,6 +98,8 @@ class BrowsertimeAndroid(PerftestAndroid, Browsertime):
"chrome",
]
)
if self.config["app"] == "cstm-car-m":
args_list.extend(["--chrome.android.package", "org.chromium.chrome"])
else:
activity = self.config["activity"]
if self.config["app"] == "fenix":

View file

@ -695,7 +695,11 @@ class PerftestAndroid(Perftest):
device = ADBDeviceFactory(verbose=True)
# Chrome uses a specific binary that we don't set as a command line option
binary = "com.android.chrome"
binary = (
"com.android.chrome"
if self.config["app"] == "chrome-m"
else "org.chromium.chrome"
)
if self.config["app"] not in CHROME_ANDROID_APPS:
binary = self.config["binary"]