Closed Bug 797101 Opened 10 years ago Closed 10 years ago

Support running mochitests under the debugger

Categories

(Firefox Build System :: Mach Core, enhancement)

x86
macOS
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla20

People

(Reporter: ehsan.akhgari, Assigned: gps)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

We currently need to do this:

python objdir/_tests/testing/mochitest/runtests.py --debugger=gdb --test-path=...

This sucks big time.
+1 on adding a --debugger argument to mach
Yes, we should definitely add this feature.

The proper solution is to properly hook in the mochitest Python runner into mozbuild. The hacky solution (which I will r+ to avoid scope bloat) is to define the appropriate environment variable(s) when invoking make.

See also bug 795772 for similar improvements to the xpcshell runner (which already uses the Python driver, not the make targets).
We also want to get mochitest on mozbase, which will unify some of this a bit: https://bugzilla.mozilla.org/show_bug.cgi?id=746243 . I don't know how much overlap there would be here, but it feels like there could be some depending on how much of the mochitest harness should be modified to hook it into mozbuild
Attached patch Broken patch (obsolete) — Splinter Review
This kinda works, but the logging interferes with gdb.
Attachment #674207 - Flags: feedback?(gps)
Comment on attachment 674207 [details] [diff] [review]
Broken patch

Review of attachment 674207 [details] [diff] [review]:
-----------------------------------------------------------------

This seems fine. At some point we'll need to hook mach directly into the mochitest Python harness itself. But, I'm not going to bloat scope on you ;)

What about the logging breaks GDB?
Attachment #674207 - Flags: feedback?(gps) → feedback+
Basically, the "(gdb)" prompt and your own input are invisible until you hit return.
Depends on: 818366
Removed bit rot from existing patch. Added bug 818366 hook-in.

Ms2ger: since you are the primary author of this patch, I'll happily commit it under your name.
Assignee: nobody → gps
Attachment #674207 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #688593 - Flags: review?(Ms2ger)
Comment on attachment 688593 [details] [diff] [review]
Ability to run mochitests under debugger, v1

Review of attachment 688593 [details] [diff] [review]:
-----------------------------------------------------------------

::: testing/mochitest/mach_commands.py
@@ +22,5 @@
>  
>  generic_help = 'Test to run. Can be specified as a single file, a ' +\
>  'directory, or omitted. If omitted, the entire test suite is executed.'
>  
> +debugger_help = 'Debugger to use.'

Your help in the reftest patch is better, want to use it here too? :)

@@ +51,5 @@
>          self.run_plain_suite()
>          self.run_chrome_suite()
>          self.run_browser_chrome_suite()
>  
> +    def run_mochitest_test(self, suite=None, test_file=None, debugger=None):

Looks like I forgot to document the argument; want to add that?
Attachment #688593 - Flags: review?(Ms2ger) → review+
https://hg.mozilla.org/mozilla-central/rev/ba0ff949ba60

With nits addressed.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.