From a2fbcef61947982a19d1a35eb206fe984e77407b Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 18 Sep 2013 19:04:40 +0100 Subject: [PATCH 08/10] 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. --- 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 f271735..2cb87b3 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 364b988..6138046 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 9e32140..4c7528f 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 -- 1.8.4.rc3