summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gmail.com>2017-08-30 16:14:45 +0100
committerGitHub <noreply@github.com>2017-08-30 16:14:45 +0100
commit95cf70bbe0cc0dbc697b18ca2198c426de3547a1 (patch)
tree126671f771d479b09c64ea356ed15d1047e9f361
parent6f12bfff3f26648db694dd7bb3f299dd828c8496 (diff)
parent5f2aa7fb5e588c589742aeacec391d0787a4cf3d (diff)
Merge pull request #4172 from endlessm/T18981
Fixes for running tests in flatpak sandbox
-rw-r--r--configure.ac1
-rw-r--r--test/Makefile.am.inc5
-rwxr-xr-xtest/run-with-dbus146
3 files changed, 4 insertions, 148 deletions
diff --git a/configure.ac b/configure.ac
index 7001a30..66edc49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -123,6 +123,7 @@ AC_PATH_PROG([YELPBUILD], [yelp-build], [notfound])
AC_ARG_VAR([YELPBUILD], [Path to yelp-build])
GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
AC_SUBST(GLIB_COMPILE_RESOURCES)
+AC_PATH_PROG([DBUS_RUN_SESSION], [dbus-run-session])
AC_CACHE_SAVE
diff --git a/test/Makefile.am.inc b/test/Makefile.am.inc
index 98ec69e..f4b1c6a 100644
--- a/test/Makefile.am.inc
+++ b/test/Makefile.am.inc
@@ -62,7 +62,7 @@ TESTS = \
$(javascript_tests) \
run_coverage.coverage \
$(NULL)
-JS_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(top_srcdir)/test/run-with-dbus --session $(SHELL) $(top_srcdir)/tap-driver.sh
+JS_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh
JS_LOG_DRIVER_FLAGS = --comments
TEST_EXTENSIONS = .js .coverage
JS_LOG_COMPILER = jasmine
@@ -87,9 +87,10 @@ CLEANFILES += stderr.log
# directory with junk from the tests
TESTS_ENVIRONMENT = \
export EOS_DISABLE_METRICS=1; \
+ export NO_AT_BRIDGE=1; \
export GI_TYPELIB_PATH="$(top_builddir)$${GI_TYPELIB_PATH:+:$$GI_TYPELIB_PATH}"; \
export LD_LIBRARY_PATH="$(top_builddir)/.libs$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH}"; \
export XDG_CONFIG_HOME=`mktemp -d $${TMPDIR:-/tmp}/sdktestconfig.XXXXXXXX`; \
export TOP_SRCDIR="$(abs_top_srcdir)"; \
export BUILDDIR="."; \
- $(NULL)
+ $(DBUS_RUN_SESSION) --config-file=$(top_srcdir)/test/test-bus.conf
diff --git a/test/run-with-dbus b/test/run-with-dbus
deleted file mode 100755
index 37b818a..0000000
--- a/test/run-with-dbus
+++ /dev/null
@@ -1,146 +0,0 @@
-#! /bin/sh
-# Copyright 2008-2009 litl, LLC.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-
-SCRIPTNAME=$0
-START_SYSTEM_BUS=
-START_SESSION_BUS=
-
-done=0
-
-while [ "$done" != 1 ]; do
- case $1 in
- --system )
- START_SYSTEM_BUS=1
- ;;
- --session)
- START_SESSION_BUS=1
- ;;
- * )
- WRAPPED_SCRIPT=$1
- done=1
- ;;
- esac
- shift
-done
-
-die()
-{
- if ! test -z "$DBUS_SESSION_BUS_PID" ; then
- echo "killing message bus "$DBUS_SESSION_BUS_PID >&2
- kill -9 $DBUS_SESSION_BUS_PID
- fi
-
- if ! test -z "$DBUS_SYSTEM_BUS_PID" ; then
- echo "killing message bus "$DBUS_SYSTEM_BUS_PID >&2
- kill -9 $DBUS_SYSTEM_BUS_PID
- fi
-
- echo $SCRIPTNAME: $* >&2
- exit 1
-}
-
-## convenient to be able to ctrl+C without leaking the message bus process
-trap 'die "Received terminal signal"' INT TERM HUP
-
-if test -z "$TOP_SRCDIR" ; then
- die "Must set TOP_SRCDIR"
-fi
-
-if test -z "$BUILDDIR" ; then
- die "Must set BUILDDIR"
-fi
-
-RANDOM=`dbus-uuidgen`
-
-## this has to be set BEFORE we start session bus,
-## or stuff the session bus starts won't get it
-if ! test -z "$START_SYSTEM_BUS" ; then
- DBUS_SYSTEM_BUS_ADDRESS="unix:abstract=/tmp/dbus-$USER-$$-$RANDOM-system"
- export DBUS_SYSTEM_BUS_ADDRESS
-fi
-
-STDERR_LOGFILE="$BUILDDIR"/stderr.log
-if test x"$XDG_DATA_HOME" != x ; then
- mkdir -p "$XDG_DATA_HOME"/logs || exit 1
- STDERR_LOGFILE="$XDG_DATA_HOME"/logs/stderr.log
-fi
-/bin/rm -f "$STDERR_LOGFILE"
-SYSTEM_MONITOR_LOGFILE=`echo "$STDERR_LOGFILE" | sed -e s/stderr.log/dbus-system.log/g`
-
-if ! test -z "$START_SESSION_BUS" ; then
- CONFIG_FILE="$TOP_SRCDIR"/test/test-bus.conf
-
- unset DBUS_SESSION_BUS_ADDRESS
- unset DBUS_SESSION_BUS_PID
-
- echo "Running dbus-launch --config-file=$CONFIG_FILE" >&2
-
- eval `dbus-launch --sh-syntax --config-file=$CONFIG_FILE 2>"$STDERR_LOGFILE"`
-
- if test -z "$DBUS_SESSION_BUS_PID" ; then
- die "Failed to launch message bus for test script to run"
- fi
-
- echo "Started bus pid $DBUS_SESSION_BUS_PID at $DBUS_SESSION_BUS_ADDRESS" >&2
-fi
-
-if ! test -z "$START_SYSTEM_BUS" ; then
- SYSTEM_CONFIG_FILE="$TOP_SRCDIR"/test/test-bus.conf
-
- echo "Running dbus-daemon --fork --print-pid --config-file=$SYSTEM_CONFIG_FILE" >&2
-
- unset DBUS_SYSTEM_BUS_PID
- DBUS_SYSTEM_BUS_PID=`dbus-daemon --fork --print-pid --config-file=$SYSTEM_CONFIG_FILE 2>>"$STDERR_LOGFILE"`
-
- if test -z "$DBUS_SYSTEM_BUS_PID" ; then
- die "Failed to launch system bus for test script to run"
- fi
-
- echo "Started bus pid $DBUS_SYSTEM_BUS_PID at $DBUS_SYSTEM_BUS_ADDRESS" >&2
-
- dbus-monitor --system "type='method_call'" "type='signal'" "type='method_return'" "type='error'" > "$SYSTEM_MONITOR_LOGFILE" 2>&1 &
-
-fi
-
-# Execute wrapped script
-echo "Running with dbus: $WRAPPED_SCRIPT $@ with stderr to $STDERR_LOGFILE" >&2
-$WRAPPED_SCRIPT "$@" 2>>"$STDERR_LOGFILE" || die "script \"$WRAPPED_SCRIPT\" failed"
-
-if ! test -z "$DBUS_SESSION_BUS_PID" ; then
- kill -TERM $DBUS_SESSION_BUS_PID || die "Message bus vanished! should not have happened" && echo "Killed daemon $DBUS_SESSION_BUS_PID" >&2
-fi
-
-if ! test -z "$DBUS_SYSTEM_BUS_PID" ; then
- kill -TERM $DBUS_SYSTEM_BUS_PID || die "Message bus vanished! should not have happened" && echo "Killed daemon $DBUS_SYSTEM_BUS_PID" >&2
-fi
-
-sleep 2
-
-## be sure it really died
-if ! test -z "$DBUS_SESSION_BUS_PID" ; then
- kill -9 $DBUS_SESSION_BUS_PID > /dev/null 2>&1 || true
-fi
-
-if ! test -z "$DBUS_SYSTEM_BUS_PID" ; then
- kill -9 $DBUS_SYSTEM_BUS_PID > /dev/null 2>&1 || true
-fi
-
-exit 0