diff options
-rw-r--r-- | Changelog | 1 | ||||
-rw-r--r-- | tests/pullimap/t | 42 |
2 files changed, 23 insertions, 20 deletions
@@ -39,6 +39,7 @@ interimap (0.5.7) upstream; output. - tests/certs/generate: use custom openssl.cnf to avoid depending on the system default. + - tests/pullimap: allow easy exclusion of --idle'ing tests. -- Guilhem Moulin <guilhem@fripost.org> Thu, 24 Feb 2022 01:28:25 +0100 diff --git a/tests/pullimap/t b/tests/pullimap/t index 7998cdc..58a19ca 100644 --- a/tests/pullimap/t +++ b/tests/pullimap/t @@ -111,29 +111,31 @@ doveadm -u "remote" search mailbox "$MAILBOX" unseen >"$TMPDIR/unseen" step_done -step_start "--idle (${TIMEOUT}s)" - -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" +if [ $TIMEOUT -gt 0 ]; then + step_start "--idle (${TIMEOUT}s)" + + 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 + + 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" |