summaryrefslogtreecommitdiff
path: root/test/testenv
blob: 131eed2b2bcb0f4a4f1ec5439aeea8ddf640f783 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

# Set up the install to work with
destdir=$(mktemp --tmpdir -d libretools-test-destdir.XXXXXXXXXX)
make -C .. install DESTDIR=$destdir &>/dev/null || {
	echo 'error creating local install, cannot run tests'
	exit 1
}
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)
export XDG_CACHE_HOME="$home/.cache"
export XDG_CONFIG_HOME="$home/.config"

# Run the tests
eval "$@"
ret=$?

# Clean up
rm -rf -- "$destdir" "$testhome"
exit $ret