diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-09-11 15:23:26 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-09-11 15:23:26 -0400 |
commit | 76b27c5c5a705770fbab763199dd32efc279170a (patch) | |
tree | d531864f64157b68a69f2c8fdbeffe967efafd26 | |
parent | fb15c00592d6174dc92785587f1bdc099f0ec8e5 (diff) |
test: testenv: clean up, set HOME, don't require user to be in test/
-rwxr-xr-x | test/testenv | 23 |
1 files 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 |