Monthly Archives: March 2011

Running Firefox tests with extensions installed

When debugging a test, I’ve sometimes found it useful to have access to an extension such as DOM Inspector or Firebug to debug what’s going on with the test.  In the past, you could do this by a bunch of hacks to make sure that you get the extension inside the test profile folder in time so that the test harness doesn’t delete it for you.  But last week I landed a patch which enables you to do this more efficiently.  Here’s how the new setup works:

  1. You should download the extension’s XPI into your current directory.
  2. You should rename it into {addon-ID}.xpi, where addon-ID is the ID of the extension as specified in its install.rdf file.
  3. You should pass the name of the new XPI file to the –install-extension flag which runtests.py and runreftest.py scripts now accept.

For example, if you want to have Firebug when running the mochitest suite, here’s how you should start the suite:

python objdir/_tests/testing/mochitest/runtests.py --install-extension=firebug\@software.joehewitt.com.xpi

Happy debugging!

Tagged with: , ,
Posted in Blog

Let’s keep the blame history clean

I’ve started to believe that commit messages are a very important part of our code history.  I think that they should provide a clear description of what the change does, what’s the corresponding bug number, who reviewed and approved the patch, etc.  I think you should even include a lengthy description of why the patch does what it does, if needed, in a multiline commit message, like this.

We’ve started to use some magic tokens like CLOSED TREE and DONTBUILD which are not really part of the changeset you’re pushing, but instruct our automated tools to modify their behavior.  This is fine because it let’s us do things that we can’t do otherwise, but it messes the blame history up when somebody is looking at your changeset years from now.  I’ve started to use a solution which I think is elegant and cheap: using empty commit messages.  In order to use these tokens, you can create an empty changeset as the topmost changeset that you’re going to push, like this:

hg qnew -m 'Try to fix things so that we can reopen our CLOSED TREE' magictoken
hg qfinish .
hg push

It’s been some time that I’m switching over to this technique, and I thought I should share it in case others are interested in using it too.

Tagged with: ,
Posted in Blog