From 1ccd64df3de12fc3c6a2c6b935db521b51dcca80 Mon Sep 17 00:00:00 2001 From: "florin.bilt" Date: Tue, 14 May 2024 14:58:39 +0000 Subject: [PATCH] Bug 1883374 - screenshot-on-failure working on android performance tests r=perftest-reviewers,kshampur This patch will take a screenshot on android when a performance test fails. It will be very useful for debugging. Differential Revision: https://phabricator.services.mozilla.com/D208466 --- testing/raptor/raptor/browsertime/base.py | 30 +++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/testing/raptor/raptor/browsertime/base.py b/testing/raptor/raptor/browsertime/base.py index f06763e2ca0c..9456e2c29968 100644 --- a/testing/raptor/raptor/browsertime/base.py +++ b/testing/raptor/raptor/browsertime/base.py @@ -16,7 +16,7 @@ from copy import deepcopy import mozprocess import six from benchmark import Benchmark -from cmdline import CHROME_ANDROID_APPS, DESKTOP_APPS +from cmdline import CHROME_ANDROID_APPS, DESKTOP_APPS, FIREFOX_ANDROID_APPS from logger.logger import RaptorLogger from manifestparser.util import evaluate_list_from_string from perftest import GECKO_PROFILER_APPS, TRACE_APPS, Perftest @@ -830,26 +830,30 @@ class Browsertime(Perftest): proc.wait() def get_failure_screenshot(self): - if not ( - self.config.get("screenshot_on_failure") - and self.config["app"] in DESKTOP_APPS - ): + if not self.config.get("screenshot_on_failure"): return # Bug 1884178 # Temporarily disable on Windows + Chrom* applications. if self.config["app"] in TRACE_APPS and "win" in self.config["platform"]: return + if self.config["app"] in DESKTOP_APPS: + from mozscreenshot import dump_screen - from mozscreenshot import dump_screen + obj_dir = os.environ.get("MOZ_DEVELOPER_OBJ_DIR", None) + if obj_dir is None: + build_dir = pathlib.Path(os.environ.get("MOZ_UPLOAD_DIR")).parent + utility_path = pathlib.Path(build_dir, "tests", "bin") + else: + utility_path = os.path.join(obj_dir, "dist", "bin") + dump_screen(utility_path, LOG) - obj_dir = os.environ.get("MOZ_DEVELOPER_OBJ_DIR", None) - if obj_dir is None: - build_dir = pathlib.Path(os.environ.get("MOZ_UPLOAD_DIR")).parent - utility_path = pathlib.Path(build_dir, "tests", "bin") - else: - utility_path = os.path.join(obj_dir, "dist", "bin") - dump_screen(utility_path, LOG) + elif self.config["app"] in FIREFOX_ANDROID_APPS + CHROME_ANDROID_APPS: + from mozdevice import ADBDeviceFactory + from mozscreenshot import dump_device_screen + + device = ADBDeviceFactory(verbose=True) + dump_device_screen(device, LOG) def run_extra_profiler_run( self, test, timeout, proc_timeout, output_timeout, line_handler, env