summaryrefslogtreecommitdiff
path: root/test/testenv
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-06-03 21:19:27 -0600
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-06-05 20:06:25 -0600
commitbcf060fec41789af48664605fd1892f3ca477f4c (patch)
tree460b8da201a80654691cfdc58a6b6ed9bb0e46ef /test/testenv
parent5f9a944f44d253cd16b5a4d6ddb3e6642258b4e6 (diff)
testenv: do a better job of cleaning up temorary files
Diffstat (limited to 'test/testenv')
-rwxr-xr-xtest/testenv7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/testenv b/test/testenv
index 131eed2..0c8c4a7 100755
--- a/test/testenv
+++ b/test/testenv
@@ -1,7 +1,9 @@
#!/bin/bash
+export TMPDIR="$(mktemp --tmpdir -d libretools-test.XXXXXXXXXX)"
+trap "rm -rf '$TMPDIR'" EXIT
# Set up the install to work with
-destdir=$(mktemp --tmpdir -d libretools-test-destdir.XXXXXXXXXX)
+destdir=$TMPDIR/destdir
make -C .. install DESTDIR=$destdir &>/dev/null || {
echo 'error creating local install, cannot run tests'
exit 1
@@ -10,7 +12,7 @@ export PATH="$destdir/usr/bin:$destdir/usr/sbin:$PATH"
export LIBRETOOLS_LIBDIR="$destdir/usr/lib/libretools"
# Set up the user profile
-home=$(mktemp --tmpdir -d libretools-test-home.XXXXXXXXXX)
+home=$TMPDIR/home
export XDG_CACHE_HOME="$home/.cache"
export XDG_CONFIG_HOME="$home/.config"
@@ -19,5 +21,4 @@ eval "$@"
ret=$?
# Clean up
-rm -rf -- "$destdir" "$testhome"
exit $ret