telepathy-mission-control: tests: cd into the directory from which we were run

Simon McVittie smcv at kemper.freedesktop.org
Thu Sep 19 11:42:53 PDT 2013


Module: telepathy-mission-control
Branch: master
Commit: af998be5e6638671d05097176c7405258b30e315
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=af998be5e6638671d05097176c7405258b30e315

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Wed Sep 18 19:04:40 2013 +0100

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 <guillaume.desmottes at collabora.co.uk>

---

 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 deletions(-)

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
 



More information about the telepathy-commits mailing list