diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2019-07-05 04:26:24 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2019-07-05 04:26:24 +0200 |
commit | 590bf57446967d897ee8327c8b2df57b77f4744e (patch) | |
tree | 877ba9054b883045592de277911b407522598e77 /tests/run | |
parent | 272ab84e5cb4f37f5fb0351b934839a45b8dd72d (diff) | |
parent | 25f1dbdf54947bd6bbce653bc64f6c45b2473792 (diff) |
Merge branch 'master' into debian
Diffstat (limited to 'tests/run')
-rwxr-xr-x | tests/run | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -36,7 +36,7 @@ if [ ! -d "$TESTDIR" ]; then exit 1 fi -ROOTDIR="$(mktemp --tmpdir=/dev/shm --directory "$NAME.XXXXXXXXXX")" +ROOTDIR="$(mktemp --tmpdir="${TMPDIR:-/dev/shm}" --directory "$NAME.XXXXXXXXXX")" trap 'rm -rf -- "$ROOTDIR"' EXIT INT TERM STDOUT="$ROOTDIR/stdout" @@ -73,6 +73,7 @@ prepare() { cat >"$home/.config/dovecot/config" <<-EOF log_path = /dev/null mail_home = $ROOTDIR/home/%u + mailbox_list_index = yes ssl = no EOF cat >>"$home/.config/dovecot/config" <"$src" @@ -102,12 +103,12 @@ prepare() { [local] type = tunnel command = exec ${HOME_local@Q}/.local/bin/doveadm exec imap - null-stderr = YES + null-stderr = NO [remote] type = tunnel command = exec ${home@Q}/.local/bin/doveadm exec imap - null-stderr = YES + null-stderr = NO EOF done } @@ -129,14 +130,18 @@ doveadm() { shift 2 "$home/.local/bin/doveadm" "$@" } +sqlite3() { + command sqlite3 -init /dev/null "$@" +} # Sample (random) message sample_message() { + local date="$(date +"%s.%N")" cat <<-EOF From: <sender@example.net> To: <recipient@example.net> - Date: $(date -R) - Message-ID: <$(< /proc/sys/kernel/random/uuid)@example.net> + Date: $(date -R -d@"$date") + Message-ID: <$date@example.net> EOF local len="$(shuf -i1-4096 -n1)" @@ -156,7 +161,7 @@ deliver() { doveadm "${argv[@]}" exec dovecot-lda -e "$@" } -# Dump test results +# Dump test results dump_test_result() { local below=">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" local above="<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" @@ -215,7 +220,7 @@ check_mailbox_status2() { read MESSAGES < <( sqlite3 "$XDG_DATA_HOME/interimap/$u.db" <<-EOF .mode csv .separator " " "\\n" - SELECT COUNT(*) + SELECT COUNT(*) FROM mailboxes a JOIN mapping b ON a.idx = b.idx WHERE mailbox = $blob EOF @@ -319,7 +324,7 @@ xcgrep() { declare -a ENVIRON=() environ_set "local" export TMPDIR TESTDIR STDOUT STDERR "${ENVIRON[@]}" -export -f environ_set doveadm interimap sample_message deliver +export -f environ_set doveadm interimap sqlite3 sample_message deliver export -f check_mailbox_status check_mailbox_status_values check_mailbox_status2 export -f check_mailboxes_status check_mailbox_list xgrep xcgrep printf "%s..." "$TEST" |