From af998be5e6638671d05097176c7405258b30e315 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 18 Sep 2013 19:04:40 +0100 Subject: tests: cd into the directory from which we were run dbus-daemon does a chdir("/") for activated services. We want to undo that, and put our logs (and core dumps, if any) in a more obvious place. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69542 Reviewed-by: Guillaume Desmottes --- tests/twisted/run-test.sh.in | 5 ++++- tests/twisted/tools/exec-with-log.sh.in | 7 +++++++ tests/twisted/tools/run-mc.sh.in | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/twisted/run-test.sh.in b/tests/twisted/run-test.sh.in index f2717356..2cb87b3d 100644 --- a/tests/twisted/run-test.sh.in +++ b/tests/twisted/run-test.sh.in @@ -13,6 +13,9 @@ set -e +MC_TEST_CURDIR="`pwd`" +export MC_TEST_CURDIR + if test "x$MC_TEST_UNINSTALLED" = x; then script_fullname=`readlink -e "@mctestsdir@/twisted/run-test.sh"` if [ `readlink -e "$0"` != "$script_fullname" ] ; then @@ -83,7 +86,7 @@ any_failed=0 for i in $list ; do echo "Testing $i ..." - tmp="`pwd`/tmp-`echo $i | tr ./ __`" + tmp="${MC_TEST_CURDIR}/tmp-`echo $i | tr ./ __`" rm -fr "$tmp" mkdir "$tmp" diff --git a/tests/twisted/tools/exec-with-log.sh.in b/tests/twisted/tools/exec-with-log.sh.in index 364b9888..61380460 100644 --- a/tests/twisted/tools/exec-with-log.sh.in +++ b/tests/twisted/tools/exec-with-log.sh.in @@ -22,6 +22,13 @@ G_MESSAGES_DEBUG=all export G_MESSAGES_DEBUG ulimit -c unlimited +if test -z "$MC_TEST_CURDIR"; then + echo "MC_TEST_CURDIR must be set" + exit 1 +fi + +cd "${MC_TEST_CURDIR}" || exit 1 + if test -z "$MC_TEST_LOG_DIR"; then echo "MC_TEST_LOG_DIR must be set" exit 1 diff --git a/tests/twisted/tools/run-mc.sh.in b/tests/twisted/tools/run-mc.sh.in index 9e321403..4c7528f3 100755 --- a/tests/twisted/tools/run-mc.sh.in +++ b/tests/twisted/tools/run-mc.sh.in @@ -10,6 +10,12 @@ if test -z "$MC_TEST_LOG_DIR"; then exit 1 fi +if test -z "$MC_TEST_CURDIR"; then + echo "MC_TEST_CURDIR must be set" + exit 1 +fi +cd "${MC_TEST_CURDIR}" || exit 1 + exec > ${MC_TEST_LOG_DIR}/missioncontrol-$$.log 2>&1 ln -f ${MC_TEST_LOG_DIR}/missioncontrol-$$.log missioncontrol.log -- cgit v1.2.1