summaryrefslogtreecommitdiffstats
path: root/python/mozperftest
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /python/mozperftest
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'python/mozperftest')
-rw-r--r--python/mozperftest/mozperftest/system/android_startup.py78
-rw-r--r--python/mozperftest/mozperftest/test/webpagetest.py4
-rw-r--r--python/mozperftest/mozperftest/tests/test_android_startup.py1
3 files changed, 55 insertions, 28 deletions
diff --git a/python/mozperftest/mozperftest/system/android_startup.py b/python/mozperftest/mozperftest/system/android_startup.py
index abf5b04d55..349178f6d3 100644
--- a/python/mozperftest/mozperftest/system/android_startup.py
+++ b/python/mozperftest/mozperftest/system/android_startup.py
@@ -11,11 +11,13 @@ import mozdevice
from .android import AndroidDevice
DATETIME_FORMAT = "%Y.%m.%d"
-PAGE_START = re.compile("GeckoSession: handleMessage GeckoView:PageStart uri=")
+PAGE_START_MOZ = re.compile("GeckoSession: handleMessage GeckoView:PageStart uri=")
PROD_FENIX = "fenix"
PROD_FOCUS = "focus"
-PROC_GVEX = "geckoview_example"
+PROD_GVEX = "geckoview_example"
+PROD_CHRM = "chrome-m"
+MOZILLA_PRODUCTS = [PROD_FENIX, PROD_FOCUS, PROD_GVEX]
KEY_NAME = "name"
KEY_PRODUCT = "product"
@@ -38,32 +40,44 @@ TEST_URI = "https://example.com"
BASE_URL_DICT = {
PROD_FENIX: (
"https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/"
+ "gecko.v2.mozilla-central.pushdate.{date}.latest.mobile.fenix-nightly"
+ "/artifacts/public%2Fbuild%2Ftarget.{architecture}.apk"
+ ),
+ PROD_FENIX
+ + "-pre-mono-repo": (
+ "https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/"
"mobile.v3.firefox-android.apks.fenix-nightly.{date}.latest.{architecture}/artifacts/"
"public%2Fbuild%2Ftarget.{architecture}.apk"
),
PROD_FENIX
+ "-latest": (
"https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/"
- "mobile.v3.firefox-android.apks.fenix-nightly.latest.{architecture}/artifacts/"
+ "gecko.v2.mozilla-central.latest.mobile.fenix-nightly/artifacts/"
"public%2Fbuild%2Ftarget.{architecture}.apk"
),
PROD_FOCUS: (
"https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/"
+ "gecko.v2.mozilla-central.pushdate.{date}.latest.mobile.focus-nightly"
+ "/artifacts/public%2Fbuild%2Ftarget.{architecture}.apk"
+ ),
+ PROD_FOCUS
+ + "-pre-mono-repo": (
+ "https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/"
"mobile.v3.firefox-android.apks.focus-nightly.{date}.latest.{architecture}"
"/artifacts/public%2Fbuild%2Ftarget.{architecture}.apk"
),
PROD_FOCUS
+ "-latest": (
"https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/"
- "mobile.v3.firefox-android.apks.focus-nightly.latest.{architecture}"
- "/artifacts/public%2Fbuild%2Ftarget.{architecture}.apk"
+ "gecko.v2.mozilla-central.latest.mobile.focus-nightly/artifacts/"
+ "public%2Fbuild%2Ftarget.{architecture}.apk"
),
- PROC_GVEX: (
+ PROD_GVEX: (
"https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/"
"gecko.v2.mozilla-central.pushdate.{date}.latest.mobile.android-"
"{architecture}-debug/artifacts/public%2Fbuild%2Fgeckoview_example.apk"
),
- PROC_GVEX
+ PROD_GVEX
+ "-latest": (
"https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/"
"gecko.v2.mozilla-central.shippable.latest.mobile.android-"
@@ -83,9 +97,12 @@ PROD_TO_CHANNEL_TO_PKGID = {
"release": "org.mozilla.focus",
"debug": "org.mozilla.focus.debug",
},
- PROC_GVEX: {
+ PROD_GVEX: {
"nightly": "org.mozilla.geckoview_example",
},
+ PROD_CHRM: {
+ "release": "com.android.chrome",
+ },
}
TEST_LIST = [
"cold_main_first_frame",
@@ -233,18 +250,18 @@ class AndroidStartUp(AndroidDevice):
def run_performance_analysis(self, apk_metadata):
# Installing the application on the device and getting ready to run the tests
install_path = apk_metadata[KEY_NAME]
+ self.apk_name = apk_metadata[KEY_NAME].split(".")[0]
if self.custom_apk_exists():
install_path = self.custom_apk_path
- self.device.uninstall_app(self.package_id)
- self.info(f"Installing {install_path}...")
- app_name = self.device.install_app(install_path)
- if self.device.is_app_installed(app_name):
- self.info(f"Successfully installed {app_name}")
- else:
- raise AndroidStartUpInstallError("The android app was not installed")
- self.apk_name = apk_metadata[KEY_NAME].split(".")[0]
-
+ if self.product in MOZILLA_PRODUCTS:
+ self.device.uninstall_app(self.package_id)
+ self.info(f"Installing {install_path}...")
+ app_name = self.device.install_app(install_path)
+ if self.device.is_app_installed(app_name):
+ self.info(f"Successfully installed {app_name}")
+ else:
+ raise AndroidStartUpInstallError("The android app was not installed")
return self.run_tests()
def run_tests(self):
@@ -285,12 +302,21 @@ class AndroidStartUp(AndroidDevice):
def get_measurement(self, test_name, stdout):
if test_name in [TEST_COLD_MAIN_FF, TEST_COLD_VIEW_FF]:
return self.get_measurement_from_am_start_log(stdout)
- elif test_name in [TEST_COLD_VIEW_NAV_START, TEST_COLD_MAIN_RESTORE]:
+ elif (
+ test_name in [TEST_COLD_VIEW_NAV_START, TEST_COLD_MAIN_RESTORE]
+ and self.product in MOZILLA_PRODUCTS
+ ):
# We must sleep until the Navigation::Start event occurs. If we don't
# the script will fail. This can take up to 14s on the G5
time.sleep(17)
proc = self.device.shell_output("logcat -d")
return self.get_measurement_from_nav_start_logcat(proc)
+ else:
+ raise Exception(
+ "invalid test settings selected, please double check that "
+ "the test name is valid and that the test is supported for "
+ "the browser you are testing"
+ )
def get_measurement_from_am_start_log(self, stdout):
total_time_prefix = "TotalTime: "
@@ -321,7 +347,7 @@ class AndroidStartUp(AndroidDevice):
return __line_to_datetime(proc_start_lines[0])
def __get_page_start_datetime():
- page_start_lines = [line for line in lines if PAGE_START.search(line)]
+ page_start_lines = [line for line in lines if PAGE_START_MOZ.search(line)]
page_start_line_count = len(page_start_lines)
page_start_assert_msg = "found len=" + str(page_start_line_count)
@@ -405,10 +431,10 @@ class AndroidStartUp(AndroidDevice):
TEST_COLD_MAIN_RESTORE,
}:
return
-
- # This sets mutable state so we only need to pass this flag once, before we start the test
- self.device.shell(
- f"am start-activity -W -a android.intent.action.MAIN --ez "
- f"performancetest true -n{self.package_id}/org.mozilla.fenix.App"
- )
- time.sleep(4) # ensure skip onboarding call has time to propagate.
+ if self.product == MOZILLA_PRODUCTS:
+ # This sets mutable state so we only need to pass this flag once, before we start the test
+ self.device.shell(
+ f"am start-activity -W -a android.intent.action.MAIN --ez "
+ f"performancetest true -n{self.package_id}/org.mozilla.fenix.App"
+ )
+ time.sleep(4) # ensure skip onboarding call has time to propagate.
diff --git a/python/mozperftest/mozperftest/test/webpagetest.py b/python/mozperftest/mozperftest/test/webpagetest.py
index 82e62efa8c..8a9bac9f19 100644
--- a/python/mozperftest/mozperftest/test/webpagetest.py
+++ b/python/mozperftest/mozperftest/test/webpagetest.py
@@ -255,7 +255,7 @@ class WebPageTest(Layer):
)
def request_with_timeout(self, url):
- request_header = {"Host": "www.webpagetest.org"}
+ request_header = {"Host": "www.webpagetest.org", "X-WPT-API-KEY": self.WPT_key}
requested_results = requests.get(url, headers=request_header)
results_of_request = json.loads(requested_results.text)
start = time.monotonic()
@@ -320,7 +320,7 @@ class WebPageTest(Layer):
for key_value_pair in list(options.items())[6:]:
test_parameters += "&{}={}".format(*key_value_pair)
return (
- f"https://webpagetest.org/runtest.php?url={website_to_be_tested}&k={self.WPT_key}&"
+ f"https://webpagetest.org/runtest.php?url={website_to_be_tested}&"
f"location={options['location']}:{options['browser']}.{options['connection']}&"
f"f=json{test_parameters}"
)
diff --git a/python/mozperftest/mozperftest/tests/test_android_startup.py b/python/mozperftest/mozperftest/tests/test_android_startup.py
index 9620a7d901..6bb24e5e0d 100644
--- a/python/mozperftest/mozperftest/tests/test_android_startup.py
+++ b/python/mozperftest/mozperftest/tests/test_android_startup.py
@@ -258,6 +258,7 @@ def test_custom_apk_startup(get_measurement_mock, time_sleep_mock, path_mock):
test = android_startup.AndroidStartUp(env, mach_cmd)
test.run_tests = lambda: True
test.package_id = "FakeID"
+ test.product = "fenix"
assert test.run_performance_analysis(SAMPLE_APK_METADATA)