From 76b27c5c5a705770fbab763199dd32efc279170a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 11 Sep 2013 15:23:26 -0400 Subject: test: testenv: clean up, set HOME, don't require user to be in test/ --- test/testenv | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/test/testenv b/test/testenv index 0448e33..12a5901 100755 --- a/test/testenv +++ b/test/testenv @@ -1,5 +1,6 @@ #!/bin/bash +# Parse the arguments NETWORK=true SUDO=true while [[ $# -gt 0 ]]; do @@ -14,25 +15,29 @@ while [[ $# -gt 0 ]]; do done export NETWORK SUDO +# Set up the working directory, and add the hook to clean it up export TMPDIR="$(mktemp --tmpdir -d libretools-test.XXXXXXXXXX)" trap "rm -rf '$TMPDIR'" EXIT + # Set up the install to work with destdir=$TMPDIR/destdir + +old_pwd="$(pwd)" +if [[ -f $0 ]]; then + cd "${0%/*}" +fi make -C .. install DESTDIR=$destdir &>/dev/null || { echo 'error creating local install, cannot run tests' exit 1 } +cd "$old_pwd" + +# Set up the environment export PATH="$destdir/usr/bin:$destdir/usr/sbin:$PATH" export LIBRETOOLS_LIBDIR="$destdir/usr/lib/libretools" - -# Set up the user profile -home=$TMPDIR/home -export XDG_CACHE_HOME="$home/.cache" -export XDG_CONFIG_HOME="$home/.config" +export HOME=$TMPDIR/home +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_CONFIG_HOME="$HOME/.config" # Run the tests eval "$@" -ret=$? - -# Clean up -exit $ret -- cgit v1.2.2