Skip to content

Instantly share code, notes, and snippets.

@davehunt
Created July 7, 2022 19:38
Show Gist options
  • Save davehunt/7d5e69bd88d38fb83b9fc11b2014e539 to your computer and use it in GitHub Desktop.
Save davehunt/7d5e69bd88d38fb83b9fc11b2014e539 to your computer and use it in GitHub Desktop.
Enable Raptor Browsertime tests on Safari (macOS)
diff --git a/testing/mozharness/external_tools/performance-artifact-schema.json b/testing/mozharness/external_tools/performance-artifact-schema.json
--- a/testing/mozharness/external_tools/performance-artifact-schema.json
+++ b/testing/mozharness/external_tools/performance-artifact-schema.json
@@ -12,7 +12,8 @@
"fennec",
"geckoview",
"refbrow",
- "fenix"
+ "fenix",
+ "safari"
],
"maxLength": 10,
"type": "string"
@@ -23,7 +24,9 @@
"type": "string"
}
},
- "required": ["name"],
+ "required": [
+ "name"
+ ],
"type": "object"
},
"framework_schema": {
@@ -206,7 +209,7 @@
"description": "Structure for submitting performance data as part of a job",
"id": "https://treeherder.mozilla.org/schemas/v1/performance-artifact.json#",
"properties": {
- "application":{
+ "application": {
"$ref": "#/definitions/application_schema"
},
"framework": {
@@ -227,4 +230,4 @@
],
"title": "Perfherder Schema",
"type": "object"
-}
+}
\ No newline at end of file
diff --git a/testing/raptor/raptor/browsertime/base.py b/testing/raptor/raptor/browsertime/base.py
--- a/testing/raptor/raptor/browsertime/base.py
+++ b/testing/raptor/raptor/browsertime/base.py
@@ -84,7 +84,8 @@ class Browsertime(Perftest):
def build_browser_profile(self):
super(Browsertime, self).build_browser_profile()
- self.remove_mozprofile_delimiters_from_profile()
+ if hasattr(self, "profile"):
+ self.remove_mozprofile_delimiters_from_profile()
def remove_mozprofile_delimiters_from_profile(self):
# Perftest.build_browser_profile uses mozprofile to create the profile and merge in prefs;
@@ -332,9 +333,10 @@ class Browsertime(Perftest):
# must happen before --firefox.profileTemplate and --resultDir
self.results_handler.remove_result_dir_for_test(test)
- priority1_options.extend(
- ["--firefox.profileTemplate", str(self.profile.profile)]
- )
+ if hasattr(self, "profile"):
+ priority1_options.extend(
+ ["--firefox.profileTemplate", str(self.profile.profile)]
+ )
priority1_options.extend(
["--resultDir", self.results_handler.result_dir_for_test(test)]
)
diff --git a/testing/raptor/raptor/cmdline.py b/testing/raptor/raptor/cmdline.py
--- a/testing/raptor/raptor/cmdline.py
+++ b/testing/raptor/raptor/cmdline.py
@@ -10,7 +10,7 @@ import platform
from mozlog.commandline import add_logging_group
-(FIREFOX, CHROME, CHROMIUM) = DESKTOP_APPS = ["firefox", "chrome", "chromium"]
+(FIREFOX, CHROME, CHROMIUM, SAFARI) = DESKTOP_APPS = ["firefox", "chrome", "chromium", "safari"]
(GECKOVIEW, REFBROW, FENIX, CHROME_ANDROID) = FIREFOX_ANDROID_APPS = [
"geckoview",
"refbrow",
@@ -23,6 +23,7 @@ APPS = {
FIREFOX: {"long_name": "Firefox Desktop"},
CHROME: {"long_name": "Google Chrome Desktop"},
CHROMIUM: {"long_name": "Google Chromium Desktop"},
+ SAFARI: {"long_name": "Safari Desktop"},
GECKOVIEW: {
"long_name": "Firefox GeckoView on Android",
"default_activity": "org.mozilla.geckoview_example.GeckoViewActivity",
diff --git a/testing/raptor/raptor/perftest.py b/testing/raptor/raptor/perftest.py
--- a/testing/raptor/raptor/perftest.py
+++ b/testing/raptor/raptor/perftest.py
@@ -379,7 +379,9 @@ class Perftest(object):
return self.conditioned_profile_copy
def build_browser_profile(self):
- if (
+ if self.config["app"] in ["safari"]:
+ return
+ elif (
self.config["app"] in ["chrome", "chromium", "chrome-m"]
or self.config.get("conditioned_profile") is None
):
diff --git a/testing/raptor/raptor/raptor.py b/testing/raptor/raptor/raptor.py
--- a/testing/raptor/raptor/raptor.py
+++ b/testing/raptor/raptor/raptor.py
@@ -28,7 +28,7 @@ from mozlog import commandline
from mozprofile.cli import parse_preferences, parse_key_value
from browsertime import BrowsertimeDesktop, BrowsertimeAndroid
-from cmdline import parse_args, CHROMIUM_DISTROS
+from cmdline import parse_args, CHROMIUM_DISTROS, DESKTOP_APPS
from logger.logger import RaptorLogger
from manifest import get_raptor_test_list
from signal_handler import SignalHandler
@@ -95,7 +95,7 @@ def main(args=sys.argv[1:]):
if key.startswith("browsertime_"):
inner_kwargs[key] = outer_kwargs.get(key)
- if args.app == "firefox" or args.app in CHROMIUM_DISTROS:
+ if args.app in DESKTOP_APPS:
klass = BrowsertimeDesktop
else:
klass = BrowsertimeAndroid
diff --git a/testing/raptor/raptor/results.py b/testing/raptor/raptor/results.py
--- a/testing/raptor/raptor/results.py
+++ b/testing/raptor/raptor/results.py
@@ -585,13 +585,9 @@ class BrowsertimeResultsHandler(Perftest
for bt, raptor in conversion:
if measure is not None and bt not in measure:
continue
- # chrome we just measure fcp and loadtime; skip fnbpaint and dcf
+ # chrome and safari we just measure fcp and loadtime; skip fnbpaint and dcf
if (
- self.app
- and (
- "chrome" in self.app.lower()
- or "chromium" in self.app.lower()
- )
+ self.app.lower() in ["chrome", "chromium", "safari"]
and bt in ("fnbpaint", "dcf")
):
continue
diff --git a/testing/raptor/raptor/tests/benchmarks/speedometer-desktop.ini b/testing/raptor/raptor/tests/benchmarks/speedometer-desktop.ini
--- a/testing/raptor/raptor/tests/benchmarks/speedometer-desktop.ini
+++ b/testing/raptor/raptor/tests/benchmarks/speedometer-desktop.ini
@@ -6,12 +6,12 @@
[DEFAULT]
alert_threshold = 2.0
-apps = firefox, chrome, chromium
+apps = firefox, chrome, chromium, safari
gecko_profile_entries = 14000000
gecko_profile_interval = 1
lower_is_better = false
owner = SpiderMonkey Team
-page_cycles = 5
+page_cycles = 2
page_timeout = 180000
subtest_lower_is_better = true
subtest_unit = ms
diff --git a/testing/raptor/raptor/tests/tp6/desktop/browsertime-tp6.ini b/testing/raptor/raptor/tests/tp6/desktop/browsertime-tp6.ini
--- a/testing/raptor/raptor/tests/tp6/desktop/browsertime-tp6.ini
+++ b/testing/raptor/raptor/tests/tp6/desktop/browsertime-tp6.ini
@@ -7,13 +7,13 @@
[DEFAULT]
alert_on = fcp, loadtime, ContentfulSpeedIndex, PerceptualSpeedIndex, SpeedIndex, FirstVisualChange, LastVisualChange
alert_threshold = 2.0
-apps = firefox, chrome, chromium
-browser_cycles = 25
+apps = firefox, chrome, chromium, safari
+browser_cycles = 2
gecko_profile_entries = 14000000
gecko_profile_interval = 1
lower_is_better = true
owner = PerfTest Team
-page_cycles = 25
+page_cycles = 2
page_timeout = 60000
playback = mitmproxy
playback_pageset_manifest = mitm7-linux-firefox-{subtest}.manifest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment