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>
tingping/wmclass
Philip Withnall 2017-06-30 00:46:40 +01:00 committed by Alexander Larsson
parent ceccd281c3
commit 0062cf69c0
1 changed files with 5 additions and 1 deletions

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