From: Ian Jackson Date: Thu, 25 Jul 2019 18:01:44 +0000 (+0100) Subject: test suite: lib: Provide $tmp/must-clean directory to tests X-Git-Tag: archive/debian/9.7~22 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=c142f82d221a3235b484c58fa57ea23f300fa5e6;p=dgit.git test suite: lib: Provide $tmp/must-clean directory to tests This is a directory for things which should be removed on exit. Currently there are none. Signed-off-by: Ian Jackson --- diff --git a/tests/lib b/tests/lib index 78ec9a71..6f361300 100644 --- a/tests/lib +++ b/tests/lib @@ -22,7 +22,13 @@ END exit 16 } -trap 'test $? = 0 || t-report-failure' EXIT +trap ' + rc=$? + set +e + [ "x$DGIT_TEST_TMP" = x ] || rm -rf $DGIT_TEST_TMP/must-clean + set -e + test $rc = 0 || t-report-failure +' EXIT t-filter-out-git-hyphen-dir @@ -74,6 +80,11 @@ export DEBCHANGE_VENDOR=dpkg unset VISUAL unset GIT_EDITOR +mkdir -p $tmp/must-clean +# must-clean is usually removed after each test, on success or failure. +# But this must not be relied on for correctness, only for garbage +# collection etc. + mkdir -p $tmp/incoming cat <$tmp/dput.cf [test-dummy] @@ -573,6 +584,8 @@ t-setup-import () { (set -e; cd $tmp; tar xf "$simport.tar") fi + mkdir -p $tmp/must-clean + . "$simport" }