3 # TODO rename this file test-bad-list
4 # TODO figure out how to get a server to send a BAD response so we have an accurate fake
6 if test -z "$MH_OBJ_DIR"; then
7 srcdir
=`dirname "$0"`/..
/..
8 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
11 .
"$MH_OBJ_DIR/test/common.sh"
13 # common.sh sets this to something crazy; did i do that?!
14 testname
=${0#$srcdir/}
16 setup_test_without_data Mail
19 #### Save exit status to use as status for this program.
25 [ -n "$imapd_pid" ] && kill $imapd_pid
26 "$MH_OBJ_DIR/target/debug/mhimap" imap shutdown
28 # TODO have cleanup allow additional cleanup registration?
29 # Or just allow it to accept status as argument.
35 covdir
="$MH_OBJ_DIR/covdata/${MH_COVERAGE_PROFILE:-default}/$testname"
37 export LLVM_PROFILE_FILE
="$covdir/$profile-%m.profraw"
39 imapd
="$MH_TEST_DIR/$$.imapd"
40 start_fakeinetd
"$imapd"
41 imapd_pid
=$fakeinetd_pid
45 imap-manager: $MH_OBJ_DIR/target/debug/imap-folder-manager
46 imap-socket: $MH_TEST_DIR/Mail/imap.d/socket
47 imap-db: $MH_TEST_DIR/Mail/imap.d
49 imap-port: $fakeinetd_port
50 imap-tls: don't protect my data i know what i'm doing
52 imap-mailbox-root: test/
54 if [ -n "$MH_TEST_IMAP_LOG_LEVEL" ]; then
55 echo "imap-log-level: $MH_TEST_IMAP_LOG_LEVEL" >> "$MH"
56 echo "imap-log-$MH_TEST_IMAP_LOG_LEVEL-to: $MH_TEST_DIR/$profile/imap.d/log.$MH_TEST_IMAP_LOG_LEVEL" >> "$MH"
59 expected
="$MH_TEST_DIR/$$.expected"
60 actual
="$MH_TEST_DIR/$$.actual"
62 start_test
'unrecoverable error: BAD LIST'
64 cat > "$imapd" <<EOSCRIPT
67 * PREAUTH [CAPABILITY IMAP4REV1 UIDPLUS] authenticated
68 * LIST (\NoInferiors \UnMarked) "/" test/fold
69 1 BAD fake fake fakey fake
71 while read line; do :; done
75 cat > "$expected" <<EOF
76 inc: failed to inc folder imap: BAD response from LIST: Unknown fake fake fakey fake
78 inc
+imap
> "$actual" 2>&1 || status
=$?
79 check
"$actual" "$expected"
80 (exit $status) && fail
'inc exited 0 on error'