andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 1 | # Running layout tests on Linux |
| 2 | |
| 3 | 1. Build `blink_tests` (see LinuxBuildInstructions) |
| 4 | 1. Checkout the layout tests |
| 5 | * If you have an entry in your .gclient file that includes "LayoutTests", you may need to comment it out and sync. |
| 6 | * You can run a subset of the tests by passing in a path relative to `src/third_party/WebKit/LayoutTests/`. For example, `run_layout_tests.py fast` will only run the tests under `src/third_party/WebKit/LayoutTests/fast/`. |
| 7 | 1. When the tests finish, any unexpected results should be displayed. |
| 8 | |
| 9 | See [Running WebKit Layout Tests](http://dev.chromium.org/developers/testing/webkit-layout-tests) for full documentation about set up and available options. |
| 10 | |
| 11 | ## Pixel Tests |
| 12 | |
| 13 | The pixel test results were generated on Ubuntu 10.4 (Lucid). If you're running a newer version of Ubuntu, you will get some pixel test failures due to changes in freetype or fonts. In this case, you can create a Lucid 64 chroot using `build/install-chroot.sh` to compile and run tests. |
| 14 | |
| 15 | ## Fonts |
| 16 | |
| 17 | Make sure you have all the necessary fonts installed. |
| 18 | ``` |
| 19 | sudo apt-get install apache2 wdiff php5-cgi ttf-indic-fonts \ |
| 20 | msttcorefonts ttf-dejavu-core ttf-kochi-gothic ttf-kochi-mincho \ |
| 21 | ttf-thai-tlwg |
| 22 | ``` |
| 23 | |
| 24 | You can also just run `build/install-build-deps.sh` again. |
| 25 | |
| 26 | ## Plugins |
| 27 | |
| 28 | If `fast/dom/object-plugin-hides-properties.html` and `plugins/embed-attributes-style.html` are failing, try uninstalling `totem-mozilla` from your system: |
| 29 | ``` |
| 30 | sudo apt-get remove totem-mozilla |
| 31 | ``` |
| 32 | |
| 33 | ## Running layout tests under valgrind on Linux |
| 34 | |
| 35 | As above, but use `tools/valgrind/chrome_tests.sh -t webkit` instead. e.g. |
| 36 | ``` |
| 37 | sh tools/valgrind/chrome_tests.sh -t webkit LayoutTests/fast/ |
| 38 | ``` |
| 39 | This defaults to using --debug. Read the script for more details. |
| 40 | |
| 41 | If you're trying to reproduce a run from the valgrind buildbot, look for the --run\_chunk=XX:YY |
| 42 | line in the bot's log. You can rerun exactly as the bot did with the commands |
| 43 | ``` |
| 44 | cd ~/chromium/src |
| 45 | echo XX > valgrind_layout_chunk.txt |
| 46 | sh tools/valgrind/chrome_tests.sh -t layout -n YY |
| 47 | ``` |
| 48 | That will run the XXth chunk of YY layout tests. |
| 49 | |
| 50 | ## Configuration tips |
| 51 | * Use an optimized content\_shell when rebaselining or running a lot of tests. ([bug 8475](http://code.google.com/p/chromium/issues/detail?id=8475) is about how the debug output differs from the optimized output.) `ninja -C out/Release content_shell` |
| 52 | * Make sure you have wdiff installed: `sudo apt-get install wdiff` to get prettier diff output |
| 53 | * Some pixel tests may fail due to processor-specific rounding errors. Build using a chroot jail with Lucid 64-bit user space to be sure that your system matches the checked in baselines. You can use `build/install-chroot.sh` to set up a Lucid 64 chroot. Learn more about [UsingALinuxChroot](UsingALinuxChroot.md). |
| 54 | ## Getting a layout test into a debugger |
| 55 | |
| 56 | There are two ways: |
| 57 | 1. Run content\_shell directly rather than using run\_layout\_tests.py. You will need to pass some options: |
| 58 | * `--no-timeout` to give you plenty of time to debug |
| 59 | * the fully qualified path of the layout test (rather than relative to `WebKit/LayoutTests`). |
| 60 | 1. Or, run as normal but with the `--additional-drt-flag=--renderer-startup-dialog --additional-drt-flag=--no-timeout --time-out-ms=86400000` flags. The first one makes content\_shell bring up a dialog before running, which then would let you attach to the process via `gdb -p PID_OF_DUMPRENDERTREE`. The others help avoid the test shell and DumpRenderTree timeouts during the debug session. |
| 61 | |
| 62 | ## Using an embedded X server |
| 63 | |
| 64 | If you try to use your computer while the tests are running, you may get annoyed as windows are opened and closed automatically. To get around this, you can create a separate X server for running the tests. |
| 65 | |
| 66 | 1. Install Xephyr (`sudo apt-get install xserver-xephyr`) |
| 67 | 1. Start Xephyr as display 4: `Xephyr :4 -screen 1024x768x24` |
| 68 | 1. Run the layout tests in the Xephyr: `DISPLAY=:4 run_layout_tests.py` |
| 69 | |
| 70 | Xephyr supports debugging repainting. See the [Xephyr README](http://cgit.freedesktop.org/xorg/xserver/tree/hw/kdrive/ephyr/README) for details. In brief: |
| 71 | 1. `XEPHYR_PAUSE=$((500*1000)) Xephyr ...etc... # 500 ms repaint flash` |
| 72 | 1. `kill -USR1 $(pidof Xephyr)` |
| 73 | |
| 74 | If you don't want to see anything at all, you can use Xvfb (should already be installed). |
| 75 | 1. Start Xvfb as display 4: `Xvfb :4 -screen 0 1024x768x24` |
| 76 | 1. Run the layout tests in the Xvfb: `DISPLAY=:4 run_layout_tests.py` |
| 77 | |
| 78 | ## Tiling Window managers |
| 79 | |
| 80 | The layout tests want to run with the window at a particular size down to the pixel level. This means if your window manager resizes the window it'll cause test failures. This is another good reason to use an embedded X server. |
| 81 | |
| 82 | ### xmonad |
| 83 | In your `.xmonad/xmonad.hs`, change your config to include a manageHook along these lines: |
| 84 | ``` |
| 85 | test_shell_manage = className =? "Test_shell" --> doFloat |
| 86 | main = xmonad $ |
| 87 | defaultConfig |
| 88 | { manageHook = test_shell_manage <+> manageHook defaultConfig |
| 89 | ... |
| 90 | ``` |