Run tests with a private XDG_RUNTIME_DIR

Otherwise, service activation will start a new xdg-document-portal
(because we're using a private DBUS_SESSION_BUS_ADDRESS), but because
XDG_RUNTIME_DIR is shared with the real system, it won't be able to
mount its filesystem.

We need to unmount the document portal before removing the private
XDG_RUNTIME_DIR.

Signed-off-by: Simon McVittie <smcv@debian.org>
tingping/wmclass
Simon McVittie 2016-06-25 00:15:41 +01:00
parent c59fba9be3
commit 6f9915eade
1 changed files with 8 additions and 1 deletions

View File

@ -70,11 +70,13 @@ fi
# We need this to be in /var/tmp because /tmp has no xattr support
TEST_DATA_DIR=`mktemp -d /var/tmp/test-flatpak-XXXXXX`
mkdir -p ${TEST_DATA_DIR}/home
mkdir -p ${TEST_DATA_DIR}/runtime
mkdir -p ${TEST_DATA_DIR}/system
export FLATPAK_SYSTEM_DIR=${TEST_DATA_DIR}/system
export FLATPAK_SYSTEM_HELPER_ON_SESSION=1
export XDG_DATA_HOME=${TEST_DATA_DIR}/home/share
export XDG_RUNTIME_DIR=${TEST_DATA_DIR}/runtime
export USERDIR=${TEST_DATA_DIR}/home/share/flatpak
export SYSTEMDIR=${TEST_DATA_DIR}/system
@ -220,4 +222,9 @@ skip_without_bwrap () {
sed s#@testdir@#${test_builddir}# ${test_srcdir}/session.conf.in > session.conf
eval `dbus-launch --config-file=session.conf --sh-syntax`
trap "rm -rf $TEST_DATA_DIR; /bin/kill $DBUS_SESSION_BUS_PID" EXIT
cleanup () {
/bin/kill $DBUS_SESSION_BUS_PID
fusermount -u $XDG_RUNTIME_DIR/doc || :
rm -rf $TEST_DATA_DIR
}
trap cleanup EXIT