summary: Ensure that XDG_RUNTIME_DIR directory is created by snap-confine
# This is blacklisted on debian because debian doesn't use apparmor yet
systems: [-debian-8]
details: |
    This test checks that XDG_RUNTIME_DIR is actually created
prepare: |
    echo "Having installed the snapd-hacker-toolbelt snap"
    snap install snapd-hacker-toolbelt
    echo "Having removed the XDG_RUNTIME_DIR directory"
    rm -rf "/run/user/`id -u`/snapd-hacker-toolbelt"
execute: |
    cd /
    echo "FIXME: export XDG_RUNTIME_DIR for now until snapd does it"
    export XDG_RUNTIME_DIR="/run/user/`id -u`/snapd-hacker-toolbelt"
    echo "We can now run snapd-hacker-toolbelt.busybox true"
    /snap/bin/snapd-hacker-toolbelt.busybox true
    echo "And see that the XDG_RUNTIME_DIR directory was created"
    test -d /run/user/`id -u`/snapd-hacker-toolbelt
restore: |
    snap remove --purge snapd-hacker-toolbelt
    rm -rf "/run/user/`id -u`/snapd-hacker-toolbelt"
