#!/bin/sh
if [ -z "$HOME" ] || [ ! -d "$HOME" ]; then
    [ -e debian/tests.home ] || mkdir debian/tests.home
    export HOME="$(pwd)/debian/tests.home"
    trap "rm -rf debian/tests.home" EXIT
fi
mkdir -p "$HOME"/.config || true
# Neon-exclusive. This severely depends on being run in a container where we
# don't see the entire process tree.
# Currently Akonadi's shutdown logic has some problems. When a test crashes
# etc. it will not shut down its mysqld. A future test would then pick up
# the daemon but not own it, effectively making the daemon unmanaged. When
# this happens it will linger forevermore or until we kill the test which takes
# hours.
trap "killall -9 mysqld" EXIT
xvfb-run -a dbus-launch --exit-with-session dh_auto_test
