5 if test -z "$MH_OBJ_DIR"; then
6 srcdir
=`dirname "$0"`/..
/..
7 MH_OBJ_DIR
=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
10 .
"$MH_OBJ_DIR/test/common.sh"
12 rm -rf "$MH_TEST_DIR/panda"
15 #### Save exit status to use as status for this program.
19 [ -n "$imapd_pid" ] && kill $imapd_pid
21 # TODO uh oops don't need two profiles for this one
23 set_mh_profile profile
$i
24 "$MH_OBJ_DIR/target/debug/mhimap" imap shutdown
27 if [ -z "$MH_TEST_NOCLEANUP" ]; then
28 rm -rf "$MH_TEST_DIR/panda"
30 rm -rf "$MH_TEST_DIR/profile$i"
34 # TODO have cleanup allow additional cleanup registration?
35 # Or just allow it to accept status as argument.
40 covdir
="$MH_OBJ_DIR/covdata/${MH_COVERAGE_PROFILE:-default}/$testname"
43 mkdir "$MH_TEST_DIR/panda"
44 mkdir "$MH_TEST_DIR/panda/test"
46 expected
="$MH_TEST_DIR/$$.expected"
47 actual
="$MH_TEST_DIR/$$.actual"
49 uidvalidity
=1503585238
50 cat > $MH_TEST_DIR/panda
/test
/fold <<EOF
51 From nmh@example.com Sat Oct 24 19:20:38 2020 -0500
52 Date:Sat, 24 Oct 2020 19:20:38 -0500
55 X-IMAPbase: $uidvalidity 1 testseq
65 start_fakeinetd env
"HOME=$MH_TEST_DIR/panda" "$PANDA_IMAPD"
66 imapd_pid
=$fakeinetd_pid
69 rm -f "$MH_TEST_DIR/$profile/imap.d/socket"
71 LLVM_PROFILE_FILE
="$covdir/$profile-%m.profraw" "$MH_OBJ_DIR/target/debug/mhimap" imap start
> "$actual" 2>&1 || status
=$?
74 # setup profile 2 and 1, leaving 1 as active profile
76 setup_test_without_data profile
$i
80 imap-manager: $MH_OBJ_DIR/target/debug/imap-folder-manager
81 imap-socket: $MH_TEST_DIR/profile$i/imap.d/socket
82 imap-db: $MH_TEST_DIR/profile$i/imap.d
84 imap-port: $fakeinetd_port
85 imap-tls: don't protect my data i know what i'm doing
87 imap-mailbox-root: test/
89 if [ -n "$MH_TEST_IMAP_LOG_LEVEL" ]; then
90 echo "imap-log-level: $MH_TEST_IMAP_LOG_LEVEL" >> "$MH"
91 echo "imap-log-$MH_TEST_IMAP_LOG_LEVEL-to: $MH_TEST_DIR/$profile/imap.d/log.$MH_TEST_IMAP_LOG_LEVEL" >> "$MH"
96 ################################################################################
97 start_test
'1. inc from profile1'
99 echo 'Incorporating new mail into imap/fold...' > "$expected.inc"
100 echo >> "$expected.inc"
101 printf ' 1 10/24 me <<body >>\n' >> "$expected.inc"
103 inc
+imap
-form scan.unseen
-width 80 > "$actual"
104 check
"$actual" "$expected.inc"
106 ################################################################################
108 uidvalidity
=1603585238
109 cat > $MH_TEST_DIR/panda
/test
/fold <<EOF
110 From nmh@example.com Sat Oct 25 19:20:38 2020 -0500
111 Date:Sat, 25 Oct 2020 19:20:38 -0500
114 X-IMAPbase: $uidvalidity 1 testseq
124 ################################################################################
125 start_test
'3. inc after rebuilt mailbox goes BOOM'
127 # Kill the folder manager so inc will cause a re-SELECT.
128 "$MH_OBJ_DIR/target/debug/mhimap" imap shutdown
130 # TODO plumb this error out to inc
132 check_exit
'-eq 1' inc
+imap
133 if ! grep -q 'UIDVALIDITY changed' "$MH_TEST_DIR/profile$i/imap.d/stderr"; then
134 cat "$MH_TEST_DIR/profile$i/imap.d/stderr" >&2
135 fail
"'UIDVALIDITY changed' not in $MH_TEST_DIR/profile$i/imap.d/stderr"