andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame^] | 1 | # Using a chroot |
| 2 | |
| 3 | If you want to run layout tests and you're not running Lucid, you'll get errors due to version differences in libfreetype. To work around this, you can use a chroot. |
| 4 | |
| 5 | # Basic Instructions |
| 6 | |
| 7 | * Run `build/install-chroot.sh`. On the prompts, choose to install a 64-bit Lucid chroot and activate all your secondary mount points. |
| 8 | * sudo edit `/etc/schroot/mount-lucid64bit` and uncomment `/run` and `/run/shm`. Verify that your mount points are correct and uncommented: for example, if you have a second hard drive at `/src`, you should have an entry like `/src /src none rw,bind 0 0`. |
| 9 | * Enter your chroot as root with `sudo schroot -c lucid64`. Run `build/install-build-deps.sh`, then exit the rooted chroot. |
| 10 | * Delete your out/ directory if you had a previous non-chrooted build. |
| 11 | * To enter your chroot as normal user, run `schroot -c lucid64`. |
| 12 | * Now run `build/gyp_chromium`, compile and run DumpRenderTree within chroot. |
| 13 | |
| 14 | |
| 15 | # Tips and Tricks |
| 16 | |
| 17 | ## NFS home directories |
| 18 | The chroot install will be installed by default in /home/$USER/chroot. If your home directory is inaccessible by root (typically because it is mounted on NFS), then move this directory onto your local disk and change the corresponding entry in `/etc/schroot/mount-lucid64bit`. |
| 19 | |
| 20 | ## Goma builds |
| 21 | If you get mysterious compile errors (glibconfig.h or dbus header error), make sure that goma is running in the chroot, or don't use goma for builds inside the chroot. |
| 22 | |
| 23 | ## Different color prompt |
| 24 | |
| 25 | I use the following code in my .zshrc file to change the color of my prompt in the chroot. |
| 26 | ``` |
| 27 | # load colors |
| 28 | autoload colors zsh/terminfo |
| 29 | if [[ "$terminfo[colors]" -ge 8 ]]; then |
| 30 | colors |
| 31 | fi |
| 32 | for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do |
| 33 | eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' |
| 34 | eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' |
| 35 | done |
| 36 | PR_NO_COLOR="%{$terminfo[sgr0]%}" |
| 37 | |
| 38 | # set variable identifying the chroot you work in (used in the prompt below) |
| 39 | if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then |
| 40 | debian_chroot=$(cat /etc/debian_chroot) |
| 41 | fi |
| 42 | |
| 43 | if [ "xlucid64" = "x$debian_chroot" ]; then |
| 44 | PS1="%n@$PR_GREEN% lucid64$PR_NO_COLOR %~ %#" |
| 45 | else |
| 46 | PS1="%n@$PR_RED%m$PR_NO_COLOR %~ %#" |
| 47 | fi |
| 48 | ``` |
| 49 | |
| 50 | ## Running X apps |
| 51 | |
| 52 | I also have `DISPLAY=:0` in my `$debian_chroot` section so I can run test\_shell or layout tests without manually setting my display every time. Your display number may vary (`echo $DISPLAY` outside the chroot to see what your display number is). |
| 53 | |
| 54 | You can also use `Xvfb` if you only want to [run tests headless](http://code.google.com/p/chromium/wiki/LayoutTestsLinux#Using_an_embedded_X_server). |
| 55 | |
| 56 | ## Having layout test results open in a browser |
| 57 | |
| 58 | After running layout tests, you should get a new browser tab or window that opens results.html. If you get an error "Failed to open [file:///path/to/results.html](file:///path/to/results.html)", check the following conditions. |
| 59 | |
| 60 | 1. Make sure `DISPLAY` is set. See the [Running X apps](https://code.google.com/p/chromium/wiki/UsingALinuxChroot#Running_X_apps) section above. |
| 61 | 1. Install `xdg-utils`, which includes `xdg-open`, a utility for finding the right application to open a file or URL with. |
| 62 | 1. Install [Chrome](https://www.google.com/intl/en/chrome/browser/). |