Mobile/Fennec Xpcshell: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 12: Line 12:


==Porting tests to N800==
==Porting tests to N800==
With changes from {{bug421611}} we have made this process much simpler. 
If following [[Mobile/Build/Fennec#Running Fennec on Maemo|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:
If following [[Mobile/Build/Fennec#Running Fennec on Maemo|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:


<pre>
<pre>
cp $(topsrcdir)/testing/xpcshell/* $(xul_objdir)/_tests/
cd $(xul_objdir)
cd $(xul_objdir)/_tests
make package-tests
tar -chf xpcshell.tar xpcshell/ xpcshell-simple/
cd dist
bunzip2 xulrunner-*tests.tar.bz2
scp xulrunner-*tests.tar root@<deviceip>:/media/mmc1
</pre>
</pre>
In addition, we need to copy all the unit/ directories which contain data files, include files and other support scripts.  We have developed a script [[http://people.mozilla.org/~jmaher/fennec/xpctest-extract.py xpctest-extract.py]] which will create a xpcfiles.tar for you to copy and untar in the root of your xpcshell test directory
Transfer tar files to device via scp and untar it in a _tests/ directory.
NOTE: the _tests directory needs to be ../../ from the xulrunner directory.  So if you have a fennec/xulrunner/ directory which contains the xulrunner application, you would need to put the _tests/ folder adjacent to the fennec folder.  This is because some tests like test_extensionmanager reference files in ../../_tests/test_extensionmanager/unit from the appdir.
NOTE: it would be nice if the build script (make) would copy the test harness and support files from the source tree to the xulrunner directory.


==Running the tests==
==Running the tests==

Revision as of 15:07, 27 March 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

With changes from Template:Bug421611 we have made this process much simpler.

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:

cd $(xul_objdir)
make package-tests
cd dist
bunzip2 xulrunner-*tests.tar.bz2
scp xulrunner-*tests.tar root@<deviceip>:/media/mmc1

Running the tests

The tests are normally ran via "make check" from the root of the objdir. In this case, we are running the tests on the device and there is no source tree.

Inspecting the test_all.sh script in harness/xpcshell, you can run the test from the command line by doing this:

Run the tests from the directory where you unzipped them like so:

./run-mozilla.sh xpcshell  -f /media/mmc1/unittests/xpcshell/xpcshell/head.js  -f /media/mmc1/unittests/xpcshell/xpcshell-simple/test_update/unit/test_0051_general.js  -f /media/mmc1/unittests/xpcshell/xpcshell/tail.js  -f /media/mmc1/unittests/xpcshell/xpcshell/execute_test.js

This is a cumbersome process, and to make this reasonable, we have created [xpctest.py] to run the tests. This script needs to be edited to point to the xpcshell executable as well as the root of the test harness and test directories. It will iterate the tests and build up a list of test_ files to run tests against, then run the above command for you.

TODO's

I will start tracking test failures/bugs [here]. This doesn't line up with what is below as there is data from fennec desktop and fennec maemo which adds to the mix.

NOTE: this runs 525 tests where there are 548 tests which run on Firefox (in release only, debug core dumps on assertions at test 223).