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