Hunting the Shmoo

Screencasts and blog posts on workflow, productivity, tools, Mozilla and whatever else tickles my fancy.

Running B2G unittests with Mach

Before now running ‘classic’ unittests (mochitest, reftest, xpcshell, etc.) on B2G emulators has been a massive pain. The new recommended way of running them is through mach.

  1. Update B2G repo if you haven’t already: git pull
  2. Configure an emulator: BRANCH=master ./ emulator
  3. Build: ./
  4. Run: ./mach mochitest-remote

Substitute ‘mochitest’ with ‘reftest’, ‘crashtest’ or ‘xpcshell’ to run those test suites instead. By default all tests will be run, but you can pass in a test path like so:

./mach mochitest-remote gecko/dom/tests/mochitest/dom-level0

For more details and a full list of command arguments, run:

./mach help
./mach help mochitest-remote

Currently, these commands will not be available if your B2G repo is configured for anything other than an emulator. Bug 915810 tracks progress towards getting them working on a device, but I’m not sure when the ETA of that will be. For more information on running these tests, see Firefox OS automated testing.

Finally, if you come across any bugs, please file and cc me, ahal on irc. Or if you want to implement a B2G related mach command and don’t know where to start, feel free to give me a shout.




Szu-Yu Chen

In, about line 174, the script try to parse the
key/value pair from config file and set them into the enviornment.
However, we usually have some complicated logic like if/else in
.userconfig [1]. We will have problem in this case.

[1] https://developer.mozilla.o...


Thanks for pointing that out. For anyone following along, this is bug 920056.

Leave a comment

Your comment has been submitted and will be published once it has been approved.