blob: 0ebb7ece060a54a55d03b6093c0f91bcae78b042 [file] [log] [blame] [view]
andybons3322f762015-08-24 21:37:091# Using a chroot
2
Kent Tamura59ffb022018-11-27 05:30:563If you want to run web tests and you're not running Lucid, you'll get errors
nodir06cbaa02015-08-25 17:15:244due to version differences in libfreetype. To work around this, you can use a
5chroot.
andybons3322f762015-08-24 21:37:096
nodir06cbaa02015-08-25 17:15:247## Basic Instructions
andybons3322f762015-08-24 21:37:098
nodir06cbaa02015-08-25 17:15:249* Run `build/install-chroot.sh`. On the prompts, choose to install a 64-bit
10 Lucid chroot and activate all your secondary mount points.
11* sudo edit `/etc/schroot/mount-lucid64bit` and uncomment `/run` and
12 `/run/shm`. Verify that your mount points are correct and uncommented: for
13 example, if you have a second hard drive at `/src`, you should have an entry
14 like `/src /src none rw,bind 0 0`.
15* Enter your chroot as root with `sudo schroot -c lucid64`.
16 Run `build /install-build-deps.sh`, then exit the rooted chroot.
17* Delete your out/ directory if you had a previous non-chrooted build.
18* To enter your chroot as normal user, run `schroot -c lucid64`.
Daniel Bratellf73f0df2018-09-24 13:52:4919* Now compile and run DumpRenderTree within chroot.
andybons3322f762015-08-24 21:37:0920
nodir06cbaa02015-08-25 17:15:2421## Tips and Tricks
andybons3322f762015-08-24 21:37:0922
nodir06cbaa02015-08-25 17:15:2423### NFS home directories
andybons3322f762015-08-24 21:37:0924
nodir06cbaa02015-08-25 17:15:2425The chroot install will be installed by default in /home/$USER/chroot. If your
26home directory is inaccessible by root (typically because it is mounted on NFS),
27then move this directory onto your local disk and change the corresponding entry
28in `/etc/schroot/mount-lucid64bit`.
andybons3322f762015-08-24 21:37:0929
nodir06cbaa02015-08-25 17:15:2430### Goma builds
andybons3322f762015-08-24 21:37:0931
nodir06cbaa02015-08-25 17:15:2432If you get mysterious compile errors (glibconfig.h or dbus header error), make
33sure that goma is running in the chroot, or don't use goma for builds inside the
34chroot.
andybons3322f762015-08-24 21:37:0935
nodir06cbaa02015-08-25 17:15:2436### Different color prompt
37
38I use the following code in my .zshrc file to change the color of my prompt in
39the chroot.
40
41```shell
andybons3322f762015-08-24 21:37:0942# load colors
43autoload colors zsh/terminfo
44if [[ "$terminfo[colors]" -ge 8 ]]; then
45 colors
46fi
47for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
48 eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
49 eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
50done
51PR_NO_COLOR="%{$terminfo[sgr0]%}"
52
53# set variable identifying the chroot you work in (used in the prompt below)
54if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
55 debian_chroot=$(cat /etc/debian_chroot)
56fi
57
58if [ "xlucid64" = "x$debian_chroot" ]; then
59 PS1="%n@$PR_GREEN% lucid64$PR_NO_COLOR %~ %#"
60else
61 PS1="%n@$PR_RED%m$PR_NO_COLOR %~ %#"
62fi
63```
64
nodir06cbaa02015-08-25 17:15:2465### Running X apps
andybons3322f762015-08-24 21:37:0966
nodir06cbaa02015-08-25 17:15:2467I also have `DISPLAY=:0` in my `$debian_chroot` section so I can run test_shell
Kent Tamura59ffb022018-11-27 05:30:5668or web tests without manually setting my display every time. Your display
nodir06cbaa02015-08-25 17:15:2469number may vary (`echo $DISPLAY` outside the chroot to see what your display
70number is).
andybons3322f762015-08-24 21:37:0971
nodir06cbaa02015-08-25 17:15:2472You can also use `Xvfb` if you only want to
Kent Tamura59ffb022018-11-27 05:30:5673[run tests headless](web_tests_linux.md#Using-an-embedded-X-server).
andybons3322f762015-08-24 21:37:0974
Kent Tamura59ffb022018-11-27 05:30:5675### Having web test results open in a browser
andybons3322f762015-08-24 21:37:0976
Kent Tamura59ffb022018-11-27 05:30:5677After running web tests, you should get a new browser tab or window that
nodir06cbaa02015-08-25 17:15:2478opens results.html. If you get an error "Failed to open
79file:///path/to/results.html, check the
80following conditions.
andybons3322f762015-08-24 21:37:0981
nodir06cbaa02015-08-25 17:15:24821. Make sure `DISPLAY` is set. See the
foolipdf2a8632017-02-15 15:03:1683 [Running X apps](#Running-X-apps) section above.
nodir06cbaa02015-08-25 17:15:24841. Install `xdg-utils`, which includes `xdg-open`, a utility for finding the
85 right application to open a file or URL with.
861. Install [Chrome](https://www.google.com/intl/en/chrome/browser/).