Closed Bug 1721427 Opened 3 years ago Closed 9 months ago

Have mochitest run test slowly or step by step

Categories

(DevTools :: General, enhancement)

enhancement

Tracking

(firefox125 fixed)

RESOLVED FIXED
125 Branch
Tracking Status
firefox125 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

Attachments

(7 files)

Opening a devtools bug as that's easily based on devtools APIs, but sounds rather like a mochitest feature.

This will pause on each frame of the mochitest file.

This is a proto to demonstrate how to leverage the Debugger API
to do a step over which pauses while running mochitests.

(It replaces the toggle toolbox key shortcut entirely)

Attachment #9232186 - Attachment description: Bug 1721427 - Prototype a slow motion mode for mochitests. → Bug 1721427 - Prototype a slow motion mode for mochitests controlled via DEBUG_SLOWDOWN=(number of ms of pause)
Attachment #9246871 - Attachment description: Bug 1721427 - [devtools] Prototype a JS tracer triggered when pressing the toggle toolbox key shortcut → Bug 1721427 - [devtools] Prototype a JS tracer triggered when pressing Alt+J
See Also: → 1794769

This feature is only exposed to internal usages of tracer.jsm, by passing traceStep boolean option:

startTracing({ global, traceSteps: true });

This will automatically log to stdout all traces, including each frame step within a function execution.
Without this flag, the tracer would only trace function calls and nothing more.
We would not know which line is being executed within the function execution.

Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED

This allow pausing the currently traced event loop for a given amount of time in ms.
This will pause accordingly to the tracer configuration.
If the tracer only track function calls, it will only pause function calls and not the code running within them.
If the tracer has traceSteps flag ON, it will also pause on each frame running within all functions.

This feature is to be considered very special if not dangerous.
The synchronous pause will pause the traced code by allowing all other event loops in the same thread to run.
This may cause behavior that are irreproducible without this very special feature!

This feature is only exposed to internal usages of tracer.jsm, by passing pauseOnStep number option:

startTracing({ global, pauseOnStep: 250 });

Each traced frame will be paused during 250ms.

This feature is only exposed to internal usages of tracer.jsm, by passing filterFrameSourceUrl string option:

startTracing({ global, filterFrameSourceUrl: "file.js" });

This will restrict the tracer to only log traces for the given file URL.
This is a loose URL check, so any source whose URL includes the passed string will be traced.

devtools/server/tracer/tracer.jsm should be used instead.

Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/dfb5d61dae1b [devtools] Trace each step in a function call. r=devtools-reviewers,nchevobbe https://hg.mozilla.org/integration/autoland/rev/eb31f3bf6511 [devtools] Allow the tracer to pause each frame step. r=devtools-reviewers,nchevobbe https://hg.mozilla.org/integration/autoland/rev/4df9caeb2073 [devtools] Allow filtering frames being processed by the JavaScript tracer. r=devtools-reviewers,nchevobbe https://hg.mozilla.org/integration/autoland/rev/5e2e7bcd9986 [devtools] Use the JavaScript Tracer to run mochitests in slow motion, while tracing the test script progress. r=devtools-reviewers,nchevobbe https://hg.mozilla.org/integration/autoland/rev/1a5f7a3c39bb [devtools] Remove now useless thread helpers (in favor of the JS Tracer). r=devtools-reviewers,bomsy
Blocks: 1883905
Blocks: js-tracer
Duplicate of this bug: 1835268
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: