]> diplodocus.org Git - nmh/blob - test/imap/test-inc-missing-msg-case-2
expect this commit to be force-replaced periodically
[nmh] / test / imap / test-inc-missing-msg-case-2
1 #!/bin/sh
2
3 # TODO FIX uh oh this and the other missing msg cases passed by accident after inc uses ESEARCH
4 # and now switching inc to leave mailbox open has broken it completely!
5
6 if test -z "$MH_OBJ_DIR"; then
7 srcdir=`dirname "$0"`/../..
8 MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
9 fi
10
11 . "$MH_OBJ_DIR/test/common.sh"
12
13 # common.sh sets this to something crazy; did i do that?!
14 testname=${0#$srcdir/}
15
16 setup_test_without_data Mail
17
18 imap_cleanup() {
19 #### Save exit status to use as status for this program.
20 status=$?
21 set +e
22
23 rm -f "$imapd"
24
25 [ -n "$imapd_pid" ] && kill $imapd_pid
26 "$MH_OBJ_DIR/target/debug/mhimap" imap shutdown
27
28 # TODO have cleanup allow additional cleanup registration?
29 # Or just allow it to accept status as argument.
30 (exit $status)
31 cleanup
32 }
33 trap imap_cleanup 0
34
35 covdir="$MH_OBJ_DIR/covdata/${MH_COVERAGE_PROFILE:-default}/$testname"
36 install -d "$covdir"
37 export LLVM_PROFILE_FILE="$covdir/$profile-%m.profraw"
38
39 imapd="$MH_TEST_DIR/$$.imapd"
40 start_fakeinetd "$imapd"
41 imapd_pid=$fakeinetd_pid
42
43 cat >> "$MH" <<EOF
44 Managed-Folders: imap
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
48 imap-host: 127.0.0.1
49 imap-port: $fakeinetd_port
50 imap-tls: don't protect my data i know what i'm doing
51 imap-auth: PREAUTH
52 imap-mailbox-root: test/
53 EOF
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"
57 fi
58
59 # TODO handle this case next:
60 # UIDNEXT 12 so FETCH 1:11 but nothing is returned; 11 was deleted but never seen.
61
62 cat > "$imapd" <<EOSCRIPT
63 #!/bin/sh
64 cat <<EOF
65 * PREAUTH [CAPABILITY IMAP4REV1 UIDPLUS] authenticated
66 * LIST (\NoInferiors \UnMarked) "/" test/fold
67 1 OK LIST completed
68 * 1 EXISTS
69 * OK [UIDVALIDITY 1603585238] UID validity status
70 * OK [UIDNEXT 12] Predicted next UID
71 1 OK [READ-WRITE] SELECT completed
72 1 OK UID FETCH completed
73 1 OK SEARCH ALL completed
74 1 OK CLOSE completed
75 EOF
76 while read line; do :; done
77 EOSCRIPT
78 chmod 755 "$imapd"
79
80 check_exit '-eq 0' inc +imap
81
82 finish_test
83 exit ${failed:-0}