tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 90107538e289ebacc74306fbc938769da767425a
parent 65b98c7a2cc2b785e06071316ae45f50b64c0757
Author: Florian Quèze <florian@queze.net>
Date:   Mon, 20 Oct 2025 14:59:20 +0000

Bug 1995058 - add support for setting the timeoutfactor per platform in xpcshell.yml, r=jmaher,taskgraph-reviewers.

Differential Revision: https://phabricator.services.mozilla.com/D269181

Diffstat:
Mtaskcluster/gecko_taskgraph/transforms/job/mozharness_test.py | 6++++++
Mtaskcluster/gecko_taskgraph/transforms/test/__init__.py | 6++++++
Mtaskcluster/kinds/test/xpcshell.yml | 3+++
Mtesting/mozharness/scripts/android_emulator_unittest.py | 13+++++++++++++
Mtesting/mozharness/scripts/desktop_unittest.py | 11+++++++++++
Mtesting/xpcshell/runxpcshelltests.py | 8++++++++
Mtesting/xpcshell/xpcshellcommandline.py | 7+++++++
7 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/taskcluster/gecko_taskgraph/transforms/job/mozharness_test.py b/taskcluster/gecko_taskgraph/transforms/job/mozharness_test.py @@ -239,6 +239,9 @@ def mozharness_test_on_docker(config, job, taskdesc): command.append("--total-chunk={}".format(test["chunks"])) command.append("--this-chunk={}".format(test["this-chunk"])) + if test.get("timeoutfactor"): + command.append("--timeout-factor={}".format(test["timeoutfactor"])) + if "download-symbols" in mozharness: download_symbols = mozharness["download-symbols"] download_symbols = {True: "true", False: "false"}.get( @@ -461,6 +464,9 @@ def mozharness_test_on_generic_worker(config, job, taskdesc): mh_command.append("--total-chunk={}".format(test["chunks"])) mh_command.append("--this-chunk={}".format(test["this-chunk"])) + if test.get("timeoutfactor"): + mh_command.append("--timeout-factor={}".format(test["timeoutfactor"])) + if is_try(config.params): env["TRY_COMMIT_MSG"] = config.params["message"] diff --git a/taskcluster/gecko_taskgraph/transforms/test/__init__.py b/taskcluster/gecko_taskgraph/transforms/test/__init__.py @@ -105,6 +105,11 @@ test_description_schema = Schema( Required("chunks"): optionally_keyed_by( "test-platform", "variant", Any(int, "dynamic") ), + # Timeout multiplier to apply to default test timeout values. Can be keyed + # by test platform. + Optional("timeoutfactor"): optionally_keyed_by( + "test-platform", Any(int, float) + ), # Custom 'test_manifest_loader' to use, overriding the one configured in the # parameters. When 'null', no test chunking will be performed. Can also # be used to disable "manifest scheduling". @@ -406,6 +411,7 @@ def resolve_keys(config, tasks): "suite", "suite.name", "test-manifest-loader", + "timeoutfactor", "use-caches", ) for task in tasks: diff --git a/taskcluster/kinds/test/xpcshell.yml b/taskcluster/kinds/test/xpcshell.yml @@ -120,6 +120,9 @@ xpcshell: linux1804-64.*/opt: 2 linux2404-64.*/opt: 2 default: 4 + timeoutfactor: + by-test-platform: + default: 1 max-run-time: by-variant: msix: 7200 diff --git a/testing/mozharness/scripts/android_emulator_unittest.py b/testing/mozharness/scripts/android_emulator_unittest.py @@ -65,6 +65,15 @@ class AndroidEmulatorTest( }, ], [ + ["--timeout-factor"], + { + "action": "store", + "dest": "timeout_factor", + "default": None, + "help": "Multiplier for test timeout values", + }, + ], + [ ["--enable-xorigin-tests"], { "action": "store_true", @@ -196,6 +205,7 @@ class AndroidEmulatorTest( self.test_suite = suite self.this_chunk = c.get("this_chunk") self.total_chunks = c.get("total_chunks") + self.timeout_factor = c.get("timeout_factor") self.xre_path = None self.device_serial = "emulator-5554" self.log_raw_level = c.get("log_raw_level") @@ -366,6 +376,9 @@ class AndroidEmulatorTest( if self.total_chunks is not None: cmd.extend(["--total-chunks", self.total_chunks]) + if self.timeout_factor is not None: + cmd.extend(["--timeout-factor", self.timeout_factor]) + if category not in SUITE_NO_E10S: if category in SUITE_DEFAULT_E10S and not c["e10s"]: cmd.append("--disable-e10s") diff --git a/testing/mozharness/scripts/desktop_unittest.py b/testing/mozharness/scripts/desktop_unittest.py @@ -195,6 +195,14 @@ class DesktopUnittest(TestingMixin, MercurialScript, MozbaseMixin, CodeCoverageM }, ], [ + ["--timeout-factor"], + { + "action": "store", + "dest": "timeout_factor", + "help": "Multiplier for test timeout values", + }, + ], + [ ["--filter"], { "action": "store", @@ -779,6 +787,9 @@ class DesktopUnittest(TestingMixin, MercurialScript, MozbaseMixin, CodeCoverageM ] ) + if c.get("timeout_factor"): + base_cmd.extend(["--timeout-factor", c["timeout_factor"]]) + if c["no_random"]: if suite_category == "mochitest": base_cmd.append("--bisect-chunk=default") diff --git a/testing/xpcshell/runxpcshelltests.py b/testing/xpcshell/runxpcshelltests.py @@ -1961,6 +1961,14 @@ class XPCShellTests: JSDebuggerInfo = namedtuple("JSDebuggerInfo", ["port"]) self.jsDebuggerInfo = JSDebuggerInfo(port=options["jsDebuggerPort"]) + # Apply timeout factor + timeout_factor = options.get("timeoutFactor", 1.0) + self.harness_timeout = int(HARNESS_TIMEOUT * timeout_factor) + self.log.info( + f"Using harness timeout of {self.harness_timeout}s " + f"(base={HARNESS_TIMEOUT}s, factor={timeout_factor})" + ) + self.app_binary = options.get("app_binary") self.xpcshell = options.get("xpcshell") self.http3ServerPath = options.get("http3server") diff --git a/testing/xpcshell/xpcshellcommandline.py b/testing/xpcshell/xpcshellcommandline.py @@ -271,6 +271,13 @@ def add_common_arguments(parser): "and CPU x 4 when running in automation", ) parser.add_argument( + "--timeout-factor", + type=float, + dest="timeoutFactor", + default=1.0, + help="multiplier for test timeout values", + ) + parser.add_argument( "--variant", action="store", default="",