[next] telepathy-glib: run-test.sh: run in a temporary XDG_DATA_HOME etc.

Simon McVittie smcv at kemper.freedesktop.org
Tue Mar 25 03:45:56 PDT 2014


Module: telepathy-glib
Branch: next
Commit: d20026879e6ddbb22b955b2a88c57c5563642c56
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=d20026879e6ddbb22b955b2a88c57c5563642c56

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Thu Mar 20 12:08:53 2014 +0000

run-test.sh: run in a temporary XDG_DATA_HOME etc.

---

 tests/dbus/run-test.sh.in |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tests/dbus/run-test.sh.in b/tests/dbus/run-test.sh.in
index d343948..60c0772 100644
--- a/tests/dbus/run-test.sh.in
+++ b/tests/dbus/run-test.sh.in
@@ -1,13 +1,25 @@
 #!/bin/sh
 
+set -e
+
 script_fullname=`readlink -e "@tpglibtestsdir@/run-test.sh"`
 if [ `readlink -e "$0"` != "$script_fullname" ] ; then
   echo "This script is meant to be installed at $script_fullname" >&2
   exit 1
 fi
 
+tmp="`mktemp -d`"
+
+XDG_CACHE_HOME="$tmp/cache"
+export XDG_CACHE_HOME
+XDG_CONFIG_HOME="$tmp/config"
+export XDG_CONFIG_HOME
+XDG_DATA_HOME="$tmp/localshare"
+export XDG_DATA_HOME
 XDG_DATA_DIRS=@tpglibtestsdir@:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}
 export XDG_DATA_DIRS
+XDG_RUNTIME_DIR="$tmp"
+export XDG_RUNTIME_DIR
 G_SLICE=debug-blocks
 export G_SLICE
 G_DEBUG=fatal_warnings,fatal_criticals
@@ -32,4 +44,7 @@ else
   exit 1
 fi
 
-exec "@tpglibtestsdir@/$testname" --tap "$@"
+e=0
+"@tpglibtestsdir@/$testname" --tap "$@" || e=$?
+rm -fr "$tmp"
+exit $e



More information about the telepathy-commits mailing list