aboutsummaryrefslogtreecommitdiffstats
path: root/tests/pullimap
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@debian.org>2022-02-27 16:54:38 +0100
committerGuilhem Moulin <guilhem@debian.org>2022-02-27 16:54:38 +0100
commit3656ac995b07c5cdeb881b88f371abf38cfb0bc4 (patch)
tree4365cb82a3fb51decc6a1e2547b0e755df31456c /tests/pullimap
parent1c596d75696e8342e9b489ba0bc7b5e7009fa90e (diff)
parent8ad5e5a218253a76eabf36bfd83f9e1a2a708377 (diff)
Merge tag 'v0.5.7' into debian/latest
Release version 0.5.7
Diffstat (limited to 'tests/pullimap')
-rw-r--r--tests/pullimap/t45
1 files changed, 27 insertions, 18 deletions
diff --git a/tests/pullimap/t b/tests/pullimap/t
index 0dfe634..58a19ca 100644
--- a/tests/pullimap/t
+++ b/tests/pullimap/t
@@ -6,6 +6,13 @@ step_start "\`pullimap --idle\` refuses to create the state file"
! pullimap --idle "remote" || error
step_done
+step_start "\`pullimap\` creates statefile with mode 0600"
+pullimap "remote" || error
+if ! st="$(stat -c"%#a" -- "$XDG_DATA_HOME/pullimap/remote")" || [ "$st" != "0600" ]; then
+ error "$XDG_DATA_HOME/pullimap/remote has mode $st != 0600"
+fi
+step_done
+
# compare mailboxes (can't compare the RFC 3501 TEXT as the LMTPd inconditionally
# adds a Return-Path: header -- and also Delivered-To: and Received: to by default)
list_mails_sha256() {
@@ -104,29 +111,31 @@ doveadm -u "remote" search mailbox "$MAILBOX" unseen >"$TMPDIR/unseen"
step_done
-step_start "--idle (${TIMEOUT}s)"
+if [ $TIMEOUT -gt 0 ]; then
+ step_start "--idle (${TIMEOUT}s)"
-pullimap --idle "remote" & PID=$!
-trap "ptree_abort $PID" EXIT INT TERM
+ pullimap --idle "remote" & PID=$!
+ trap "ptree_abort $PID" EXIT INT TERM
-timer=$(( $(date +%s) + TIMEOUT ))
-while [ $(date +%s) -le $timer ]; do
- n="$(shuf -n1 -i1-5)"
- for (( i=0; i < n; i++)); do
- sample_message | deliver -u "remote" -- -m "$MAILBOX"
- done
+ timer=$(( $(date +%s) + TIMEOUT ))
+ while [ $(date +%s) -le $timer ]; do
+ n="$(shuf -n1 -i1-5)"
+ for (( i=0; i < n; i++)); do
+ sample_message | deliver -u "remote" -- -m "$MAILBOX"
+ done
- s=$(shuf -n1 -i1-1500)
- [ $s -ge 1000 ] && s="$(printf "1.%03d" $((s-1000)))" || s="$(printf "0.%03d" $s)"
- sleep "$s"
-done
+ s=$(shuf -n1 -i1-1500)
+ [ $s -ge 1000 ] && s="$(printf "1.%03d" $((s-1000)))" || s="$(printf "0.%03d" $s)"
+ sleep "$s"
+ done
-sleep 5
-ptree_abort $PID
-trap - EXIT INT TERM
+ sleep 5
+ ptree_abort $PID
+ trap - EXIT INT TERM
-check
-step_done
+ check
+ step_done
+fi
step_start "Purging"