Mobile/Fennec Reftests: Difference between revisions

This page is out of date
(This page is out of date)
 
Line 1: Line 1:
==Getting the Tests==
Edit your mozconfig to contain the following lines:


<pre>
ac_add_options --enable-tests
</pre>
Get the source and build according to [[Mobile/Build/Fennec|instructions]].
An overview of what [[https://developer.mozilla.org/En/Mozilla_automated_testing#Reftest reftests]] are.
==Running from the objdir==
When you have a local build, there is no need to make a test package and unpack it.  You can just run the tests from the objdir.
<pre>
cd $(objdir)/xulrunner/_tests/reftest
python runreftests.py --appname=../../../mobile/dist/bin/fennec --xre-path=../../dist/bin --utility-path=../../dist/bin $(topsrcdir)/layout/reftests/reftest.list
</pre>
==Porting tests to N800==
With changes from {{bug|421611}} 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:
<pre>
cd $(xul_objdir)
make package-tests PYTHON=python2.5
cd dist
bunzip2 xulrunner-*tests.tar.bz2
scp xulrunner-*tests.tar root@<deviceip>:/media/mmc1
</pre>
On the device, untar the xulrunner-*tests.tar in your test directory alongside the fennec-*.tar:
<pre>
cd /media/mmc1
mkdir unittests
mv fennec-*.tar unittests
mv xulrunner-*tests.tar unittests
cd unittests
tar -xvf fennec-*.tar
tar -xvf xulrunner-*tests.tar
</pre>
==Running the tests==
Run the tests from the objdir with:
<pre>
cd /media/mmc1/unittests
python reftest/runreftest.py /media/mmc1/unittests/reftest/tests/layout/reftests/reftest.list
</pre>
We have created a framework to wrap the unittests [[Mobile/Fennec_Automation|maemkit]] which makes this a little bit easier.  Keeping the above example, you need to copy the maemkit files to /media/mmc1/maemkit.
Now Edit the /media/mmc1/maemkit/maemkit.cfg file:
<pre>
[general]
xre-path = /media/mmc1/unittests/fennec/xulrunner
appname = /media/mmc1/unittests/fennec/fennec
total-clients = 1
client-number = 1
logdir = logs
ostype = linux
[reftest]
split-directories = "layout/reftests/bugs/reftest.list","modules/libpr0n/test/reftest/reftest.list"
split-percentage = 100
testroot = /media/mmc1/unittests/reftest/tests
utility-path = /media/mmc1/unittests/reftest
manifest = /media/mmc1/unittests/reftest/tests/layout/reftests/reftest.list
log-file = log_reftest.txt
</pre>
Now execute the tests:
<pre>
cd /media/mmc1/maemkit
python maemkit-chunked.py --testtype=reftest
</pre>
To analyze/report your results, grep /media/mmc1/maemkit/log_reftest.txt for  TEST-PASS (pass), TEST-UNEXPECTED (fail), TEST-KNOWN (todo)
== Running crashtests ==
Crashtests use the same framework as reftests, just a different manifest file.  To run crashtests, edit your maemkit.cfg file like so:
<pre>
[crashtest]
testroot = /media/mmc1/unittests/reftest/tests
utility-path = /media/mmc1/unittests/reftest
manifest = /media/mmc1/unittests/reftest/tests/testing/crashtest/crashtests.list
log-file = log_crashtest.txt
</pre>
and now run maemkit like this:
<pre>
cd /media/mmc1/maemkit
python maemkit-chunked.py --testtype=reftest
</pre>
== TODO ==
There are a few issues in running these fully automated:
* many tests time out.  Copy [[http://people.mozilla.org/~jmaher/reftest.jar reftest.jar]] to your chrome directory [[https://bugzilla.mozilla.org/show_bug.cgi?id=471579 471579]]
* some tests do not run on maemo.  Workaround is to split layout/reftests/bugs/reftest.list into smaller lists (10 lists at 100 tests each), and modules/libpr0n/* tests into a smaller set of .list files. [[https://bugzilla.mozilla.org/show_bug.cgi?id=471676 471676]]
* Install Hebrew language pack on device: {{bug|471711}}
Confirmed users
586

edits