Here's how to set up an environment to run our automated test suite. Alternatively, you way want to use the tails::tester class from the puppet-tails Puppet module.

Once you have a working environment, see usage.

Install dependencies

First of all, one needs a Debian Stretch system with:

  • the non-free APT component enabled.

The following packages are necessary on Debian Stretch:

sudo apt update && \
sudo apt install \
    cucumber \
    devscripts \
    dnsmasq-base \
    gawk \
    git \
    i18nspector \
    libav-tools \
    libcap2-bin \
    libsikulixapi-java \
    libvirt-clients \
    libvirt-daemon-system \
    libvirt-dev \
    libvirt0 \
    obfs4proxy \
    openssh-server \
    ovmf \
    pry \
    python-jabberbot \
    python-potr \
    qemu-kvm \
    qemu-system-common \
    qemu-system-x86 \
    qemu-utils \
    redir \
    ruby-guestfs \
    ruby-json \
    ruby-libvirt \
    ruby-net-irc \
    ruby-packetfu \
    ruby-rb-inotify \
    ruby-rjb \
    ruby-rspec \
    ruby-test-unit \
    seabios \
    tcpdump \
    tcplay \
    tor \
    unclutter \
    virt-viewer \
    x11vnc \
    tigervnc-viewer \
    x264 \
    xvfb \
    && \
sudo service libvirtd restart

Other requirements

Synchronized clock

The system running the test suite needs an accurate clock since we sync the clock from the host to the Tails guest after a background snapshot restore to appease Tor.

You might want to enable systemd-timesyncd.service or your favorite time synchronization tool for this.

File permissions

The user that runs QEMU (via libvirt) needs read-access at least to the content of features/misc_files/ in the Git checkout.

AppArmor tweaks

If you have AppArmor enabled:

  • You need to add the /tmp/TailsToaster/** rwk, line to /etc/apparmor.d/libvirt/TEMPLATE.qemu, in the profile LIBVIRT_TEMPLATE section; then delete /etc/apparmor.d/libvirt/libvirt-* and retry. If you use a custom TMPDIR to run the test suite, replace /tmp/TailsToaster with the value of that $TMPDIR.

Known issues

System under test freezes when creating a persistent volume

If the host system runs Debian Stretch, due to #12142 aka. Debian bug #851694, any test scenario that creates a persistent volume will fail. To work around this problem, rebuild qemu locally with the upstream fix applied. For example, the qemu source package in this APT suite has the fix:

    deb-src http://deb.tails.boum.org/ isotester-stretch main

This problem does not affect host systems that run Debian Buster or newer.

Special use cases

Access the system under test with VNC

If you're running the test suite in a nested environnement, install tigervnc-viewer on the bare metal level-0 host. Then you can use vncviewer's -via option so that it automatically setup a ssh tunnel to your first level test suite domain for you and display the Tails VM. E.g. where $DISPLAY is the display given to you by run_test_suite (often 0):

vncviewer -viewonly -via user@level0 localhost:$DISPLAY