wiki:WebKitGtkLayoutTests

Version 5 (modified by mrobinson@webkit.org, 9 years ago) (diff)

Fix depth argument to Xvfb (16 -> 24)

Running Tests for WebKitGTK+

Dependencies

You will need to install the following Debian packages to run the layout tests. For other distributions, you must install the equivalent packages.

sudo aptitude install curl ruby apache2 libapache2-mod-php5

Xvfb

WebKit functional tests for WebKitGTK+ should be run inside a virtual framebuffer environment. The most common choice for WebKItGTK developers is Xvfb. To start Xvfb simply run:

Xvfb :23 -ac -screen 0 1024x768x24 &

-screen 0 1024x768x16 ensures that Xvfb has a deep enough color depth to produce accurate pixel test results. Some older versions of Ubuntu may have bugs which cause Xvfb to segfault while running tests. A workaround for this is to run Xvfb with the GLX extension disabled:

Xvfb :23 -ac -screen 0 1024x768x16 -extension GLX &

Fonts

The tests require you to use the testfonts package shared between the QtWebKit and WebKitGTK+ ports. To get this package via git run:

git clone git://gitorious.org/qtwebkit/testfonts.git

The tests require the WEBKIT_TESTFONTS environment variable to point to the location of this repository on your local machine.

Running the Tests

Simply run the run-webkit-tests script from the WebKitTools directory. run-webkit-tests also supports the --debug argument to run the tests with the debug build of WebKitGTK+.

env -i DISPLAY=:23 WEBKIT_TESTFONTS=/home/developer/work/testfonts \
    ./WebKitTools/Scripts/run-webkit-tests --gtk [--debug]

If you wish to run a single test you can do:

env -i DISPLAY=:23 WEBKIT_TESTFONTS=/home/developer/work/testfonts \
    ./WebKitTools/Scripts/run-webkit-tests --gtk fast/forms/plaintext-mode-1.html

Pixel Tests

WebKitGTK+ supports running pixel tests, but they are not enabled by default. To run them simply pass the -p argument to run-webkit-tests:

env -i DISPLAY=:23 WEBKIT_TESTFONTS=/home/developer/work/testfonts \
    ./WebKitTools/Scripts/run-webkit-tests --gtk -p

Adding Baselines

Sometimes you may need to generate new results for a test that relies on render tree output. This can be accomplished by passing the --new-test-results option. Note that new pixel results require the -p option as well:

env -i DISPLAY=:23 WEBKIT_TESTFONTS=/home/developer/work/testfonts \
    ./WebKitTools/Scripts/run-webkit-tests --gtk fast/forms/plaintext-mode-1.html --new-test-results

Running Tests in GDB

For debugging a test it may be useful to run it directly in DumpRenderTree (with gdb):

WebKitBuild/Debug/Programs/DumpRenderTree -v LayoutTests/fast/forms/plaintext-mode-1.html