tests: skip running flatpak at build time if bwrap doesn't work

Distribution autobuilders are often more locked-down than the
environment in which the distribution binaries actually run.

Signed-off-by: Simon McVittie <smcv@debian.org>
tingping/wmclass
Simon McVittie 2016-05-17 10:17:46 +01:00 committed by Alexander Larsson
parent d6b1c9ff3c
commit d4738cca16
3 changed files with 15 additions and 0 deletions

View File

@ -192,6 +192,17 @@ run_sh () {
${CMD_PREFIX} flatpak run --command=bash ${ARGS-} org.test.Hello -c "$*"
}
skip_without_bwrap () {
if [ -z "${FLATPAK_BWRAP:-}" ]; then
# running installed-tests: assume we know what we're doing
:
elif ! "$FLATPAK_BWRAP" --ro-bind / / /bin/true > bwrap-result 2>&1; then
sed -e 's/^/# /' < bwrap-result
echo "1..0 # SKIP Cannot run bwrap"
exit 0
fi
}
sed s#@testdir@#${test_builddir}# ${test_srcdir}/session.conf.in > session.conf
eval `dbus-launch --config-file=session.conf --sh-syntax`

View File

@ -21,6 +21,8 @@ set -euo pipefail
. $(dirname $0)/libtest.sh
skip_without_bwrap
echo "1..3"
setup_repo

View File

@ -21,6 +21,8 @@ set -euo pipefail
. $(dirname $0)/libtest.sh
skip_without_bwrap
echo "1..7"
setup_repo