Mobile/Fennec Xpcshell: Difference between revisions
| Line 21: | Line 21: | ||
Transfer tar file to device via scp and untar it. | Transfer tar file to device via scp and untar it. | ||
NOTE: it would be nice if the build script (make) would copy the test harness from the source tree to the xulrunner directory. | |||
==Running the tests== | ==Running the tests== | ||
Revision as of 22:07, 30 January 2009
Getting the Tests
Edit your mozconfig to contain the following lines:
ac_add_options --enable-tests
Get the source and build according to instructions.
to learn more about the tests, visit the [MDC Guide]
Porting tests to N800
If following directions for running fennec on N800/N810 devices, you will need to package up the tests from the xulrunner directory and the test harness from the source tree:
cp $(topsrcdir)/harness/xpcshell/* $(xul_objdir)/_tests/ cd $(xul_objdir)/_tests tar -chf xpcshell.tar xpcshell/ xpcshell-simple/
Transfer tar file to device via scp and untar it.
NOTE: it would be nice if the build script (make) would copy the test harness from the source tree to the xulrunner directory.
Running the tests
Run the tests from the directory where you unzipped them like so:
python mochitest/runtests.py --appname=<absolute path to fennec>
where fennec executable is the absolute path to the fennec executable, /root/fennec/fennec, e.g. Additional arguments like individual test files can be specified, general Mochitest instructions can be found here [1].
note: The tests are sometimes unresponsive on mobile devices, so use the --test-path, --autorun, and --log-file options.
note: In order for the tests to run on the device successfully, we need to run them one directory at a time. We have a script [maemkit-chunked.py] (download the whole maemkit and configure the maemkit.cfg file to point to the correct paths) which will do this and stitch the logs up for you when you are all done.
Adding tests
Add a directory named "tests" to the component. In the Makefile.in for the tests directory add a _TEST_FILES section with a list of the files in this directory needed to run the mochitest (the mochitest html file itself and any helper files). Then add this line to the bottom of the Makefile.in:
if test is in central code:
libs:: $(_TEST_FILES) $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
if test is in mobile:
libs:: $(_TEST_FILES) $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/../xulrunner/_tests/testing/mochitest/tests/$(relativesrcdir)
When you build, the tests will be added to the xulrunner application's mochitest set.