tests: Honor TEST_SKIP_CLEANUP like ostree

We seem to have substantial infrastructure drift here between the two, and I was
*really* confused why `TEST_SKIP_CLEANUP` wasn't being honored. Turned out in
rpm-ostree we have tmpdir code in two places, not entirely sure why. Punting
full cleanup.

Closes: #566
Approved by: jlebon
This commit is contained in:
Colin Walters 2017-01-11 15:24:30 -05:00 committed by Atomic Bot
parent 4a511fa011
commit 178ec03154
2 changed files with 8 additions and 1 deletions

View File

@ -6,7 +6,13 @@ srcd=$(cd $(dirname $1) && pwd)
bn=$(basename $1)
tempdir=$(mktemp -d)
function cleanup () {
rm "${tempdir}" -rf
if test -z "${TEST_SKIP_CLEANUP:-}"; then
if test -f ${test_tmpdir}/.test; then
rm "${tempdir}" -rf
fi
else
echo "Skipping cleanup of ${test_tmpdir}"
fi
}
trap cleanup EXIT
cd ${tempdir}

View File

@ -54,6 +54,7 @@ if test -n "${UNINSTALLEDTESTS:-}"; then
fi
test_tmpdir=$(pwd)
echo "Using tmpdir ${test_tmpdir}"
export G_DEBUG=fatal-warnings