setup-session.sh: use libtest.sh for setup

The libtest.sh script is aware of whether a tmpdir needs to be created
or not for the test. Make use of this in setup-session.sh so that we're
sure we're in the right directory before creating the sysroot dir.
This commit is contained in:
Jonathan Lebon 2016-02-26 11:12:11 -05:00
parent 78d0bbbf12
commit 657f48377b
2 changed files with 13 additions and 6 deletions

View File

@ -19,17 +19,22 @@
SRCDIR=$(dirname $0)
_cleanup_tmpdir () {
if test -f ${test_tmpdir}.test; then
rm ${test_tmpdir} -rf
if test -f ${test_tmpdir}/.test; then
rm ${test_tmpdir} -rf
fi
}
# If we're running as a local test (i.e. through `make check`), then
# UNINSTALLEDTESTS=1. Otherwise (i.e. as an installed test), it's undefined, in
# which case we're already in a tmpdir.
if test -n "${UNINSTALLEDTESTS:-}"; then
test_tmpdir=$(mktemp -d test.XXXXXX)
touch ${test_tmpdir}/.test
trap _cleanup_tmpdir EXIT
cd ${test_tmpdir}
export PATH=${builddir}:${PATH}
fi
fi
test_tmpdir=$(pwd)
export G_DEBUG=fatal-warnings

View File

@ -19,12 +19,14 @@
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
test_tmpdir=$(pwd)
set -e
. $(dirname $0)/libtest.sh
exec_binary="@LIBEXECDIR@/rpm-ostreed"
mkdir sysroot
mkdir session-services
mkdir -p sysroot
mkdir -p session-services
# Create a busconfig file with a custom <servicedir>
cat > session.conf <<EOF