summaryrefslogtreecommitdiffstats
path: root/maildrop/testsuite2
diff options
context:
space:
mode:
authorSam Varshavchik2021-05-17 22:45:55 -0400
committerSam Varshavchik2021-05-19 08:03:44 -0400
commitf47a71576c377269f5c5ca6156b2f319256e2738 (patch)
tree4b7a91e9ab6b3f52f5667e1f1a3abff1841f0b2f /maildrop/testsuite2
parent9c4bd37a0adc2ebbe1ad35d6317da02e4bbfcfb2 (diff)
downloadcourier-libs-f47a71576c377269f5c5ca6156b2f319256e2738.tar.bz2
maildrop: clean up a dotlock file if exited while it is held.
Implement exit() by throwing an exception, which will wind up and clean up the dotlock. Catch the exception and exit(), after everything gets cleaned up.
Diffstat (limited to 'maildrop/testsuite2')
-rw-r--r--maildrop/testsuite221
1 files changed, 21 insertions, 0 deletions
diff --git a/maildrop/testsuite2 b/maildrop/testsuite2
index ae5bbf1..a199ed6 100644
--- a/maildrop/testsuite2
+++ b/maildrop/testsuite2
@@ -322,3 +322,24 @@ else
fi
rm -f testsuite?.filter testsuite.msg
+
+rm -f testsuite.dotlock
+cat >testmd <<EOF
+dotlock "testsuite.dotlock" {
+ EXITCODE=5
+ exit
+}
+EOF
+chmod 600 testmd
+./maildrop ./testmd </dev/null
+if test $? != 5
+then
+ echo "dotlock test did not exit with the correct exit code"
+ exit 1
+fi
+if test -f testsuite.dotlock
+then
+ echo "dotlock test did not clean up after itself"
+ exit 1
+fi
+rm -f testmd