8 while [ -n "$dir" ]; do
15 if [ "$dir" = "/" ]; then
23 # Generate a new message in the mail directory, with
24 # a unique message ID and subject.
26 # The filename of the message generated is available as
32 gen_msg_cnt=$((gen_msg_cnt + 1))
33 gen_msg_name=msg-$(printf "%03d" $gen_msg_cnt)
35 if [ "$#" = "0" ]; then
36 gen_msg_filename="${MAIL_DIR}/$gen_msg_name"
38 gen_msg_filename="${MAIL_DIR}/$1/$gen_msg_name"
39 mkdir -p $(dirname $gen_msg_filename)
42 cat <<EOF >$gen_msg_filename
43 From: Notmuch Test Suite <test_suite@notmuchmail.org>
44 To: Notmuch Test Suite <test_suite@notmuchmail.org>
45 Message-Id: <msg-${gen_msg_cnt}@notmuch-test-suite>
46 Subject: Test message ${gen_msg_filename}
47 Date: Tue, 05 Jan 2010 15:43:57 -0800
49 This is just a test message at ${gen_msg_filename}
58 TEST_DIR=$(pwd)/test.$$
59 MAIL_DIR=${TEST_DIR}/mail
60 export NOTMUCH_CONFIG=${TEST_DIR}/notmuch-config
61 NOTMUCH=$(find_notmuch_binary $(pwd))
69 cat <<EOF > ${NOTMUCH_CONFIG}
74 name=Notmuch Test Suite
75 primary_email=test_suite@notmuchmail.org
78 echo "### Testing \"notmuch new\" with no messages"
81 echo "### Testing \"notmuch new\" with 1 new message"
86 echo "### Testing \"notmuch new\" with 2 new messages"
92 echo "### Testing \"notmuch new\" with no new messages (and a non-empty database)"
96 echo "### Testing \"notmuch new\" with two new directories (one mail)"
97 rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch
104 echo "### Testing \"notmuch new\" with two new directories (one mail)---opposite inode order"
106 rm -rf ${MAIL_DIR}/.notmuch
107 mv ${MAIL_DIR}/ghi ${MAIL_DIR}/abc
113 echo "### Testing \"notmuch new\" with 1 old message moved into the mail store"
114 rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch
116 tmp_msg_filename=tmp/$gen_msg_filename
117 mkdir -p $(dirname $tmp_msg_filename)
118 mv $gen_msg_filename $tmp_msg_filename
120 $NOTMUCH new > /dev/null
122 mv $tmp_msg_filename $gen_msg_filename
125 echo "### Testing \"notmuch new\" with 1 renamed message"
129 $NOTMUCH new > /dev/null
131 mv $gen_msg_filename ${gen_msg_filename}-renamed
134 echo "### Testing \"notmuch new\" with 1 deleted message"
137 rm ${gen_msg_filename}-renamed
140 echo "### Testing \"notmuch new\" with a new directory with 3 messages"
149 echo "### Testing \"notmuch new\" with a renamed directory of 3 messages"
152 mv ${MAIL_DIR}/dir ${MAIL_DIR}/dir-renamed
156 echo "### Testing \"notmuch new\" with a deleted directory of 3 messages"
159 rm -rf ${MAIL_DIR}/dir-renamed
163 echo "### Testing \"notmuch new\" with a new directory with 3 messages (tail of list)"
172 echo "### Testing \"notmuch new\" with a deleted directory of 3 messages (tail of list)"
175 rm -rf ${MAIL_DIR}/zzz
179 echo "### Testing \"notmuch new\" with a symlink to an external directory of 1 message"
181 rm -rf ${MAIL_DIR}/.notmuch
182 mv ${MAIL_DIR} ${TEST_DIR}/actual_maildir
185 ln -s ${TEST_DIR}/actual_maildir ${MAIL_DIR}/symlink
189 echo "### Testing \"notmuch new\" with a symlink to an external file"
192 external_msg_filename=${TEST_DIR}/external/$(basename $gen_msg_filename)
193 mkdir -p $(dirname $external_msg_filename)
194 mv $gen_msg_filename $external_msg_filename
195 ln -s $external_msg_filename $gen_msg_filename
199 echo "### Testing \"notmuch new\" with a two-level directory with 3 files"
202 generate_message two/levels
203 generate_message two/levels
204 generate_message two/levels
208 echo "### Testing \"notmuch new\" with deletion of two-level directory (3 files)"
211 rm -rf ${MAIL_DIR}/two
216 Notmuch test suite complete.
218 Intermediate state can be examined in: