commit 6f5b97c94f0e18e6fc9698b7fe7a9bcfe3a248fe
parent f1beabcd7dab5a8b8fc20d3a7f4b8a1d33459f32
Author: Florian Quèze <florian@queze.net>
Date: Mon, 6 Oct 2025 21:14:15 +0000
Bug 1992513 - On mach try fuzzy, --profiler should be a shortcut for --env MOZ_PROFILER_STARTUP=1, r=ahal.
Differential Revision: https://phabricator.services.mozilla.com/D267487
Diffstat:
6 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/testing/docs/browser-chrome/index.md b/testing/docs/browser-chrome/index.md
@@ -87,10 +87,10 @@ Profiling tests
The `./mach test` and `./mach mochitest` commands also support a `--profiler`
flag that will start the Firefox Profiler before running tests.
-It's possible to get a profile also on try with `--env MOZ_PROFILER_STARTUP=1`:
+It's possible to get a profile also on try with `--profiler`:
```
-./mach try fuzzy --env MOZ_PROFILER_STARTUP=1 <test directory>
+./mach try fuzzy --profiler <test directory>
```
The profile will be uploaded in case of a failure only, so make sure to add
diff --git a/testing/docs/debugging-intermittents/index.md b/testing/docs/debugging-intermittents/index.md
@@ -59,9 +59,9 @@ To use it locally, add the parameter `--profiler` to your test command:
./mach test <path to test> --profiler
```
-To do it in a try build it's possible to use the environment variables:
+To do it in a try build it's possible to use the `--profiler` flag:
```
-./mach try fuzzy --env MOZ_PROFILER_STARTUP=1 <test directory>
+./mach try fuzzy --profiler <test directory>
```
This will automatically upload profiles of failing tests.
diff --git a/testing/docs/mochitest-plain/index.md b/testing/docs/mochitest-plain/index.md
@@ -118,10 +118,9 @@ breakpoints or switch to the Netmonitor panel before starting the test.
## Debug using the Firefox Profiler
-Run the profiler locally with `--profiler`, and on try with
-`--env MOZ_PROFILER_STARTUP=1`. For the latter, only failures will generate
-and upload profiles, so make sure to add an assertion that fails the test you're
-interested in.
+Run the profiler with `--profiler` (both locally and on try). On try, only
+failures will generate and upload profiles, so make sure to add an assertion that
+fails the test you're interested in.
## Finding errors
diff --git a/tools/tryselect/task_config.py b/tools/tryselect/task_config.py
@@ -288,13 +288,22 @@ class Environment(TryConfig):
"help": "Get a screen recording of the tests where possible.",
},
],
+ [
+ ["--profiler"],
+ {
+ "action": "store_true",
+ "help": "Enable the profiler by setting MOZ_PROFILER_STARTUP=1.",
+ },
+ ],
]
- def try_config(self, env, record, **kwargs):
+ def try_config(self, env, record, profiler, **kwargs):
if env is None:
env = []
if record:
env.append("MOZ_RECORD_TEST=1")
+ if profiler:
+ env.append("MOZ_PROFILER_STARTUP=1")
if not env:
return
return {
diff --git a/tools/tryselect/test/test_task_configs.py b/tools/tryselect/test/test_task_configs.py
@@ -33,6 +33,22 @@ TASK_CONFIG_TESTS = {
["--env", "foo=bar", "--env", "num=10"],
{"try_task_config": {"env": {"foo": "bar", "num": "10"}}},
),
+ (
+ ["--profiler"],
+ {"try_task_config": {"env": {"MOZ_PROFILER_STARTUP": "1"}}},
+ ),
+ (
+ ["--record"],
+ {"try_task_config": {"env": {"MOZ_RECORD_TEST": "1"}}},
+ ),
+ (
+ ["--profiler", "--record"],
+ {
+ "try_task_config": {
+ "env": {"MOZ_PROFILER_STARTUP": "1", "MOZ_RECORD_TEST": "1"}
+ }
+ },
+ ),
],
"path": [
([], None),
diff --git a/xpcom/tests/unit/test_getTimers.js b/xpcom/tests/unit/test_getTimers.js
@@ -44,7 +44,7 @@ if (
Services.env.exists("MOZ_TEST_TIMEOUT_INTERVAL")
) {
// Ignore the timer used to upload profiles of test timeouts when running
- // the tests with --env MOZ_PROFILER_STARTUP=1.
+ // the tests with --profiler.
ignoredTimers.push("upload_test_timeout_profile");
}