Mobile/Fennec Unittests/Remote Testing/Examples
This is an example of running remote tests on a Linux build of Fennec that is running in a VM. This uses the test-agent.py agent.
On the VM (where you'll run fennec)
sudo mkdir /tests sudo chown youruser /tests cd /tests
Download and extract the linux build of Fennec from https://www.mozilla.com/en-US/mobile/platforms/ into the /tests directory, e.g.:
wget https://ftp.mozilla.org/pub/mozilla.org/mobile/releases/1.1rc1/linux-i686/fennec-1.1.en-US.linux-i686.tar.bz2 tar xjf fennec-1.1.en-US.linux-i686.tar.bz2
Download the test agent:
hg clone https://hg.mozilla.org/automation/remote-testing/ ln -s remote-testing/SUTAgentPython/test-agent.py
Open TCP ports 20700 and 20701 in the VM's firewall, e.g. on Ubuntu:
sudo ufw allow from 10.0.0.0/8 to any port 20700 sudo ufw allow from 10.0.0.0/8 to any port 20701
Start the test agent (you'll need a display to do this, so either do it from a shell from within an X session or use xvfb):
python test-agent.py --testroot=/
On the mochitest host machine
Open ports TCP ports 8888 (httpd.js) and 11080 (socksd.js) in the host machine's firewall, or other ports if you have specified something other than the default. E.g. on Ubuntu:
sudo ufw allow from 10.0.0.0/8 to any port 8888 sudo ufw allow from 10.0.0.0/8 to any port 11080
Now start the tests (replace OBJ with your build directory below). Below we have 10.1.2.3 as the host machine's address and 10.4.5.6 as the VM's address. We also set --test-path=docshell to speed up the example and make it less likely that the host side times out waiting for fennec to start running the mochitests.
python OBJ/_tests/testing/mochitest/runtestsremote.py --remote-webserver=10.1.2.3 --deviceIP=10.4.5.6 --remote-app-path=fennec/fennec --test-path=docshell
Once you run the above command, in the host's terminal you will see output such as the following:
reconnecting socket unable to connect socket reconnecting socket in push file with: /tmp/tmp7L4YQE/mochikit.manifest, and: //tests/fennec/chrome/mochikit.manifest remote hash returned: 'dabf6649de97fb9f15e2ad5536d42a4a' local hash returned: 'dabf6649de97fb9f15e2ad5536d42a4a' files are validated pushing directory: /tmp/tmpOH8qk7 to //tests/profile in push file with: /tmp/tmpOH8qk7/userChrome.css, and: //tests/profile//userChrome.css remote hash returned: 'dd7d69f44a026b90fdff449be1695e9f' local hash returned: 'dd7d69f44a026b90fdff449be1695e9f' files are validated in push file with: /tmp/tmpOH8qk7/user.js, and: //tests/profile//user.js remote hash returned: '40c4e36c3ac89084d10003d76e505d64' local hash returned: '40c4e36c3ac89084d10003d76e505d64' files are validated INFO | runtests.py | Server pid: 1423
and in the VM's terminal you will see output such as the following followed by fennec starting and the mochitests being run:
going to open file in 'hash': //tests/fennec/chrome/mochikit.manifest going to open file in 'hash': //tests/profile//userChrome.css going to open file in 'hash': //tests/profile//user.js running process: //tests/fennec/fennec -no-remote -profile //tests/profile/ "http://mochi.test:8888/tests/?autorun=1&closeWhenDone=1&logFile=%2F%2Ftests%2Ftest.log&fileLevel=INFO" > //tests/process.txt