-
Notifications
You must be signed in to change notification settings - Fork 0
Testing
Servo has a test suite which runs on every reviewed pull request, via bors-servo and the buildbot. It uses Mozilla's Mach system to run the tests.
You can run the test suite yourself through these ./mach
commands:
-
./mach test
: Runs all the Servo tests. -
./mach test-unit
: Runs unit tests (functions tagged with#[test]
) inside Servo and its dependencies. May also run ref or content tests depending on your platform. -
./mach test-wpt
: Runs the web platform tests on Servo. -
./mach test-css
Runs a subset of the CSS WG tests (mostly reftests) on Servo. Uses the same harnesses as the web-platform-tests and the further information there still applies.
- Write wpt/css tests
- Write unit tests: These are common Rust programs under
tests/unit
, and is organized to reflect thecomponents
tree. You can follow the existing structure and Rust testing guide.
In some tests (e.g. wpt tests), you need to use a hostfile to translate testing domain names to real IPs. For example, translating wpt1.testserver.com
to 127.0.0.1
. But you may not have the permission to change the system hostfile in a shared server. Instead, you can assign a temporary hostfile using the HOST_FILE
environment variable.
First, create a hostfile, say /tmp/hostfile.txt
, in the following format ip<single space>hostname<new line>
. For example:
127.0.0.1 wpt1.testserver.com
127.0.0.1 wpt2.testserver.com
Then, set the HOST_FILE
environment variable as the absolute path to the hostfile.
export HOST_FILE=/tmp/hostfile.txt
Now, if you open http://wpt1.testserver.com in servo, you will go to http://127.0.0.1 directly.