diff options
author | Colin Walters <walters@verbum.org> | 2016-11-18 15:07:52 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2016-11-21 16:11:55 +0000 |
commit | a6eb8bbcf6d0e0bbc5163dea1d41fff1706299d5 (patch) | |
tree | b5e5f59395c969388511c8f61535f9a7debb132c /buildutil/tap-test | |
parent | 41ef2aeb3824d52e33cb0d9eafa62393e5065fb0 (diff) | |
download | ostree-a6eb8bbcf6d0e0bbc5163dea1d41fff1706299d5.tar.gz |
tests: Support TEST_SKIP_CLEANUP=err
I find myself often wanting to debug interactively failing tests.
This makes it more convenient to keep around the temporary directories
just for those tests, rather than accumulating tons of tempdirs from
the successful tests as well.
Closes: #588
Approved by: jlebon
Diffstat (limited to 'buildutil/tap-test')
-rwxr-xr-x | buildutil/tap-test | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/buildutil/tap-test b/buildutil/tap-test index 6b2eb5c1..c8da31e7 100755 --- a/buildutil/tap-test +++ b/buildutil/tap-test @@ -11,13 +11,24 @@ bn=$(basename $1) tempdir=$(mktemp -d /var/tmp/tap-test.XXXXXX) touch ${tempdir}/.testtmp function cleanup () { - if test -n "${TEST_SKIP_CLEANUP:-}"; then - echo "Skipping cleanup of ${tempdir}" - else if test -f ${tempdir}/.testtmp; then + if test -f ${tempdir}/.testtmp; then rm "${tempdir}" -rf fi - fi } -trap cleanup EXIT +function skip_cleanup() { + echo "Skipping cleanup of ${tempdir}" +} cd ${tempdir} ${srcd}/${bn} -k --tap +rc=$? +case "${TEST_SKIP_CLEANUP:-}" in + no|"") cleanup ;; + err) + if test $rc != 0; then + skip_cleanup + else + cleanup + fi ;; + *) skip_cleanup ;; +esac +exit $rc |