From 0ed97cf6a2d7783b59ea9855a99e6a95816961ae Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Fri, 25 Feb 2022 00:23:32 +0100 Subject: tests/pullimap: Allow easy exclusion of --idle'ing tests. --- Changelog | 1 + tests/pullimap/t | 42 ++++++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/Changelog b/Changelog index 1365749..10db1a0 100644 --- a/Changelog +++ b/Changelog @@ -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 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" -- cgit v1.2.3