andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 1 | # Using a chroot |
| 2 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 3 | If you want to run web tests and you're not running Lucid, you'll get errors |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 4 | due to version differences in libfreetype. To work around this, you can use a |
| 5 | chroot. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 6 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 7 | ## Basic Instructions |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 8 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 9 | * 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 Bratell | f73f0df | 2018-09-24 13:52:49 | [diff] [blame] | 19 | * Now compile and run DumpRenderTree within chroot. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 20 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 21 | ## Tips and Tricks |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 22 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 23 | ### NFS home directories |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 24 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 25 | The chroot install will be installed by default in /home/$USER/chroot. If your |
| 26 | home directory is inaccessible by root (typically because it is mounted on NFS), |
| 27 | then move this directory onto your local disk and change the corresponding entry |
| 28 | in `/etc/schroot/mount-lucid64bit`. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 29 | |
Takuto Ikuta | 7478af72 | 2024-05-27 07:23:19 | [diff] [blame] | 30 | ### Reclient builds |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 31 | |
Takuto Ikuta | 7478af72 | 2024-05-27 07:23:19 | [diff] [blame] | 32 | If you get mysterious compile errors (glibconfig.h or dbus header error), don't |
| 33 | use reclient for builds inside the chroot. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 34 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 35 | ### Different color prompt |
| 36 | |
| 37 | I use the following code in my .zshrc file to change the color of my prompt in |
| 38 | the chroot. |
| 39 | |
| 40 | ```shell |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 41 | # load colors |
| 42 | autoload colors zsh/terminfo |
| 43 | if [[ "$terminfo[colors]" -ge 8 ]]; then |
| 44 | colors |
| 45 | fi |
| 46 | for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do |
| 47 | eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' |
| 48 | eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' |
| 49 | done |
| 50 | PR_NO_COLOR="%{$terminfo[sgr0]%}" |
| 51 | |
| 52 | # set variable identifying the chroot you work in (used in the prompt below) |
| 53 | if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then |
| 54 | debian_chroot=$(cat /etc/debian_chroot) |
| 55 | fi |
| 56 | |
| 57 | if [ "xlucid64" = "x$debian_chroot" ]; then |
| 58 | PS1="%n@$PR_GREEN% lucid64$PR_NO_COLOR %~ %#" |
| 59 | else |
| 60 | PS1="%n@$PR_RED%m$PR_NO_COLOR %~ %#" |
| 61 | fi |
| 62 | ``` |
| 63 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 64 | ### Running X apps |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 65 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 66 | I also have `DISPLAY=:0` in my `$debian_chroot` section so I can run test_shell |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 67 | or web tests without manually setting my display every time. Your display |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 68 | number may vary (`echo $DISPLAY` outside the chroot to see what your display |
| 69 | number is). |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 70 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 71 | You can also use `Xvfb` if you only want to |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 72 | [run tests headless](web_tests_linux.md#Using-an-embedded-X-server). |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 73 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 74 | ### Having web test results open in a browser |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 75 | |
Kent Tamura | 59ffb02 | 2018-11-27 05:30:56 | [diff] [blame] | 76 | After running web tests, you should get a new browser tab or window that |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 77 | opens results.html. If you get an error "Failed to open |
| 78 | file:///path/to/results.html, check the |
| 79 | following conditions. |
andybons | 3322f76 | 2015-08-24 21:37:09 | [diff] [blame] | 80 | |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 81 | 1. Make sure `DISPLAY` is set. See the |
foolip | df2a863 | 2017-02-15 15:03:16 | [diff] [blame] | 82 | [Running X apps](#Running-X-apps) section above. |
nodir | 06cbaa0 | 2015-08-25 17:15:24 | [diff] [blame] | 83 | 1. Install `xdg-utils`, which includes `xdg-open`, a utility for finding the |
| 84 | right application to open a file or URL with. |
| 85 | 1. Install [Chrome](https://www.google.com/intl/en/chrome/browser/). |