前回 Servo をソースコードからビルドしてみました。意外と大変でした…。前回の記事はこちら。
さて Servo がビルドできたところで、次はテストを走らせてみましょう。テストを走らせてみて無事パスすれば、コード的に問題ないこともわかりますし、いろいろと改造したりすることもできるようになりそうです。
Servo のテストについては Wiki があるのでそちらを見ましょう。
テストは以下の項目について記載があります。./mach test
で全部のテストを行い、それ以外では個別のテストが行えるのですね。
./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.
まずは、./mach test-unit
から。
$ ./mach test-unit
...
running 2 tests
test test_hang_monitoring ... ok
test test_hang_monitoring_unregister ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
Running target/debug/deps/font_context-ffd83ce9725b25c2
...
running 1 test
test lib.rs - trustedpromise_does_not_impl_clone (line 20) ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
無事通ったようです。実際は大量のテストが走りますが省略しています。
次は ./mach test-css
をやってみます。するとこんな表示が。
$ ./mach test-css
It looks like you are trying to run an unknown mach command: test-css
Did you want to run any of these commands instead: test, test-wpt, test-content?
Run |mach help| to show a list of commands.
どうもドキュメントに書かれているテストコマンドと現状のコマンドには違いがあるようです。./mach help
をして、テストに関するところを確認してみます。
$ ./mach help
usage: mach [global arguments] command [command arguments]
...
Testing:
Run tests.
compare_dromaeo Compare outputs of two runs of ./mach test-dromaeo
command
create-wpt
filter-intermittents Given a WPT error summary file, filter out
intermittents and other cruft.
fmt Format the Rust source files with rustfmt
smoketest Load a simple page in Servo and ensure that it closes
properly
test Run specified Servo tests
test-android-startup Extremely minimal testing of Servo for Android
test-content Run the content tests
test-dromaeo Run the Dromaeo test suite
test-jquery Run the jQuery test suite
test-perf Run the page load performance test
test-tidy Run the source code tidiness check
test-unit Run unit tests
test-webidl Run the WebIDL parser tests
test-wpt Run the regular web platform test suite
test-wpt-android Run the web platform test suite in an Android emulator
test-wpt-failure Run the tests harness that verifies that the test
failures are reported correctly
update-jquery Update the jQuery test suite expected results
update-manifest Run test-wpt --manifest-update SKIP_TESTS to
regenerate MANIFEST.json
update-net-cookies Update the net unit tests with cookie tests from http-
state
update-webgl Update the WebGL conformance suite tests from Khronos
repo
update-wpt Update the web platform tests
...
いくつか細かくテスト用のコマンドがあることがわかりました。test-css
はないようです。
./mach test-tidy
を実行してソースコードの tidy なチェックをしてみます。
$ ./mach test-tidy
0:09.03 INFO Diffing old and new manifests /Users/XXXX/src/servo/tests/wpt/metadata/MANIFEST.json
0:12.61 INFO Diffing old and new manifests /Users/XXXX/src/servo/tests/wpt/mozilla/meta/MANIFEST.json
0:12.72 INFO Diffing old and new manifests /Users/XXXX/src/servo/tests/wpt/webgl/meta/MANIFEST.json
Checking the config file...
Checking the wpt manifest file...
Checking directories for correct file extensions...
tidy reported no errors.
info: downloading component 'rustfmt'
info: installing component 'rustfmt'
他にもテストを実行してみます。
$ ./mach test-content
Content tests have been replaced by web-platform-tests under tests/wpt/mozilla/.
test-content
は、web-platform-tests
に置き換えられたとのこと。test-wpt
が「the regular web platform test suite」とのことなので、こちらを実行してみます。
$ ./mach test-wpt
...
Running 25695 tests in web-platform-tests
[335/25695] /css/CSS2/backgrounds/background-applies-to-001.xht
/css/CSS2/backgrounds/background-327.xht
/css/CSS2/backgrounds/background-329.xht
大量のテストがあるので、しばらく待つことになります。
ちょっと見慣れないテストといえば test-dromaeo
というテストが一覧にあります。Dromaeo テストをするそうなのですが Dromaeo とは何でしょうか。調べてみると、JavaScript のパフォーマンステストツールなようです。
ドキュメントや help などを頼りにテストを実行していく形でしばらく進めようと思いました。
ARTICLES
AUTHOR

原 一浩
カンソクインダストリーズ代表 / グレーティブ合同会社代表
1998年に独立し、同年、ウェブデザイン専門のメールメディア DesignWedgeの発行を開始。Webデザイン業の傍ら、海外のWebデザインに関する情報発信を行う。
雑誌への寄稿多数。主な著書に『はじめてのフロントエンド開発』『プロセスオブウェブデザイン』、『Play framework徹底入門』、『ウェブデザインコーディネートカタログ』など。自社製のWebデザインのクロール&キャプチャシステムvaqumをベースに、様々なリサーチを行っている。Web 検定プロジェクトメンバー。