commit c221107ad820d8d34a138f9170b37dca50132094
parent 2efb9540ff0bd24830cb58cf8527ad5ae2b9ee8b
Author: Florian Quèze <florian@queze.net>
Date: Tue, 21 Oct 2025 08:42:45 +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:
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",
@@ -205,6 +214,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")
@@ -379,6 +389,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="",