diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2022-02-25 00:23:32 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2022-02-25 00:23:32 +0100 |
commit | 0ed97cf6a2d7783b59ea9855a99e6a95816961ae (patch) | |
tree | ead730eac255a02594e34d032e1c7ccfa625a440 /tests/pullimap | |
parent | 58c2c80b585fe51dea56ca13776b51f44ad68463 (diff) |
tests/pullimap: Allow easy exclusion of --idle'ing tests.
Diffstat (limited to 'tests/pullimap')
-rw-r--r-- | tests/pullimap/t | 42 |
1 files changed, 22 insertions, 20 deletions
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" |