Closed Bug 613109 Opened 14 years ago Closed 13 years ago

Make it possible to run a mochitest-* test suite with an extension installed

Categories

(Testing :: Mochitest, defect)

defect
Not set
normal

Tracking

(status2.0 ?)

RESOLVED FIXED
mozilla5
Tracking Status
status2.0 --- ?

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

Details

Attachments

(1 file)

It would be really helpful to add a command line option to runtests.py to install an xpi file in the profile folder as a usable extension.  This will give us the ability to, for example, run a test with Firebug installed, which sometimes could save us hours of desperate printf debugging.  Another useful extension for this purpose is DOM Inspector, but I guess the command line option could be capable of installing any extension.
There is --extra-profile-file=foo, which you can use to copy random things into the profile. I don't know that copying a .xpi will work.

automation.py has an installExtension method that would definitely work (we use it to install the reftest bits):
http://mxr.mozilla.org/mozilla-central/source/build/automation.py.in#913

we just don't currently expose that as a cmdline option. Would be easy enough to fix that.
(In reply to comment #1)
> There is --extra-profile-file=foo, which you can use to copy random things into
> the profile. I don't know that copying a .xpi will work.

Mossop, do you know if it will work?

> automation.py has an installExtension method that would definitely work (we use
> it to install the reftest bits):
> http://mxr.mozilla.org/mozilla-central/source/build/automation.py.in#913

Hmm, I also found <http://mxr.mozilla.org/mozilla-central/source/layout/tools/reftest/runreftest.py#106> (registerExtension).  Is that also needed ater installExtension?

Also, the docs for installExtension say:

Copies an "installed" extension into the extensions directory of the given profile

What does "installed" mean in this context?

> we just don't currently expose that as a cmdline option. Would be easy enough
> to fix that.

Given the information above, I may give that a go!

Should I add the command line handling stuff in automation.py?
The registerExtension bit should no longer be necessary on trunk, since we don't require restarts.

The docstring there might just be out-of-date, I think it used to only support unpacked directories, but it clearly supports .xpi files now.

If you add the cmdline stuff in automation.py, we can use it in both Mochitest and Refest, but that means you'll have to do a little bit of implementation in both harnesses.
(In reply to comment #2)
> (In reply to comment #1)
> > There is --extra-profile-file=foo, which you can use to copy random things into
> > the profile. I don't know that copying a .xpi will work.
> 
> Mossop, do you know if it will work?

Just copying the raw XPI (naming it <id>.xpi) or the unpacked files from the xpi (in a directory named <id>) into <profile>/extensions should be all you need to do these days
Assignee: nobody → ehsan
So I made some changes to runtests.py.in and then did both of these:

make -C objdir/testing/mochitest
make -f client.mk build

And my changes have not yet been picked up in objdir/_test/testing/mochitest/runtests.py.  How can I correctly make the build system pick up my changes without blowing away my entire objdir?
There is no runtests.py.in anymore, since bug 576026. Are you editing the wrong thing? The mochitest/testing makefile should just be copying it into objdir/_tests/ directly.
Attached patch Patch (v1)Splinter Review
I almost forgot that I still have this in my queue!  This patch adds the --install-extension command line argument to runtests.py.  I've tested this for example to install Firebug in a mochitest profile.  Here's a sample command line that one should use:

python obj-ff-dbg/_tests/testing/mochitest/runtests.py --test-path=editor/libeditor/html/tests/test_bug635636.html --install-extension=firebug@software.joehewitt.com.xpi

I think this is going to be very useful for a lot of developers, so let's try to get it in the tree!
Attachment #518906 - Flags: review?
Comment on attachment 518906 [details] [diff] [review]
Patch (v1)

...and this time I forgot to set the requestee!  :-)
Attachment #518906 - Flags: review? → review?(khuey)
Comment on attachment 518906 [details] [diff] [review]
Patch (v1)

Going to punt this to ted since test harnesses aren't really my area.
Attachment #518906 - Flags: review?(khuey) → review?(ted.mielczarek)
Comment on attachment 518906 [details] [diff] [review]
Patch (v1)

The unittest harnesses aren't in the build config module, FWIW.
(In reply to comment #10)
> Comment on attachment 518906 [details] [diff] [review]
> Patch (v1)
> 
> The unittest harnesses aren't in the build config module, FWIW.

Does that mean that I should ask somebody else to review this?  I looked at <http://hg.mozilla.org/mozilla-central/log/tip/testing/mochitest/runtests.py> and I thought that Kyle might be less busy than you.  You guys are the only people who have reviewed that code...
Comment on attachment 518906 [details] [diff] [review]
Patch (v1)

It might be worthwhile to refactor some of this up into automation.py. There's an addCommonOptions function there for commandline options.
Attachment #518906 - Flags: review?(ted.mielczarek) → review+
And yeah, khuey is only listed as a reviewer there on a patch that renamed the file from .py.in to .py. We should probably get the unit test harness module ownership sorted out for real.
(In reply to comment #12)
> It might be worthwhile to refactor some of this up into automation.py. There's
> an addCommonOptions function there for commandline options.

Can this be done in a follow-up?
Depends on: post2.0
Sure, as long as you file it before landing. :)
Sure, filed bug 642983.
http://hg.mozilla.org/mozilla-central/rev/e4311825a9c7
Status: NEW → RESOLVED
Closed: 13 years ago
No longer depends on: post2.0
Resolution: --- → FIXED
Blocks: 647394
status2.0: --- → ?
OS: Mac OS X → All
Hardware: x86 → All
Target Milestone: --- → mozilla2.2
Depends on: 573263
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: