Bug 1895092 - Ensure linux gtk theme is "Adwaita" for reftests. r=dholbert, a=dmeehan

Differential Revision: https://phabricator.services.mozilla.com/D209618
This commit is contained in:
Joel Maher 2024-05-09 21:10:11 +00:00
parent 1cfae0c14f
commit bfaa503c31

View File

@ -303,6 +303,7 @@ class RefTest(object):
self.outputHandler = None
self.testDumpFile = os.path.join(tempfile.gettempdir(), "reftests.json")
self.currentManifest = "No test started"
self.gtkTheme = self.getGtkTheme()
self.run_by_manifest = True
if suite in ("crashtest", "jstestbrowser"):
@ -329,6 +330,17 @@ class RefTest(object):
"reftest harness", options, {"tbpl": sys.stdout}, fmt_options
)
def getGtkTheme(self):
if not platform.system() == "Linux":
return ""
theme_cmd = "gsettings get org.gnome.desktop.interface gtk-theme"
theme = subprocess.check_output(theme_cmd, shell=True, universal_newlines=True)
if theme:
theme = theme.strip("\n")
theme = theme.strip("'")
return theme.strip()
def getFullPath(self, path):
"Get an absolute path relative to self.oldcwd."
return os.path.normpath(os.path.join(self.oldcwd, os.path.expanduser(path)))
@ -564,6 +576,9 @@ class RefTest(object):
browserEnv["TZ"] = "PST8PDT"
browserEnv["LC_ALL"] = "en_US.UTF-8"
# This should help with consistency
browserEnv["GTK_THEME"] = "Adwaita"
for v in options.environment:
ix = v.find("=")
if ix <= 0:
@ -1127,6 +1142,13 @@ class RefTest(object):
overall = 0
status = -1
for manifest, tests in tests_by_manifest.items():
if self.getGtkTheme() != self.gtkTheme:
self.log.error(
"Theme (%s) has changed to (%s), terminating job as this is unstable"
% (self.gtkTheme, self.getGtkTheme())
)
return 1
self.log.info("Running tests in {}".format(manifest))
self.currentManifest = manifest
status = run(tests=tests)