tests: Add TEST_SKIP_CLEANUP env var for skipping test cleanup

This mirrors the same environment variable in OSTree’s unit tests, which
keeps the temporary directory around after tests have completed (or
failed) so the developer can examine it.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall
2017-06-30 00:46:40 +01:00
committed by Alexander Larsson
parent ceccd281c3
commit 0062cf69c0

View File

@@ -295,6 +295,10 @@ cleanup () {
/bin/kill $DBUS_SESSION_BUS_PID ${FLATPAK_HTTP_PID:-}
gpg-connect-agent --homedir "${FL_GPG_HOMEDIR}" killagent /bye || true
fusermount -u $XDG_RUNTIME_DIR/doc || :
rm -rf $TEST_DATA_DIR
if test -n "${TEST_SKIP_CLEANUP:-}"; then
echo "Skipping cleanup of ${TEST_DATA_DIR}"
else
rm -rf $TEST_DATA_DIR
fi
}
trap cleanup EXIT