1 Return-Path: <sojkam1@fel.cvut.cz>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id D62B6431FBD
\r
6 for <notmuch@notmuchmail.org>; Wed, 3 Feb 2010 05:52:42 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.317 tagged_above=-999 required=5 tests=[AWL=0.282,
\r
12 BAYES_00=-2.599] autolearn=ham
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id Og351Xxaxyci for <notmuch@notmuchmail.org>;
\r
16 Wed, 3 Feb 2010 05:52:41 -0800 (PST)
\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 8B473431FAE
\r
19 for <notmuch@notmuchmail.org>; Wed, 3 Feb 2010 05:52:41 -0800 (PST)
\r
20 Received: from localhost (unknown [192.168.200.4])
\r
21 by max.feld.cvut.cz (Postfix) with ESMTP id F367319F3372
\r
22 for <notmuch@notmuchmail.org>; Wed, 3 Feb 2010 14:52:40 +0100 (CET)
\r
23 X-Virus-Scanned: IMAP AMAVIS
\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])
\r
25 by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,
\r
26 port 10044) with ESMTP id Z2maKPtCHOuc for <notmuch@notmuchmail.org>;
\r
27 Wed, 3 Feb 2010 14:52:35 +0100 (CET)
\r
28 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])
\r
29 by max.feld.cvut.cz (Postfix) with ESMTP id AEF5819F35E3
\r
30 for <notmuch@notmuchmail.org>; Wed, 3 Feb 2010 14:42:55 +0100 (CET)
\r
31 Received: from localhost.localdomain (k335-30.felk.cvut.cz [147.32.86.30])
\r
32 (Authenticated sender: sojkam1)
\r
33 by imap.feld.cvut.cz (Postfix) with ESMTPSA id 8650AFA006
\r
34 for <notmuch@notmuchmail.org>; Wed, 3 Feb 2010 14:42:55 +0100 (CET)
\r
35 From: Michal Sojka <sojkam1@fel.cvut.cz>
\r
36 To: notmuch@notmuchmail.org
\r
37 Date: Wed, 3 Feb 2010 14:42:48 +0100
\r
38 Message-Id: <1265204568-24018-4-git-send-email-sojkam1@fel.cvut.cz>
\r
39 X-Mailer: git-send-email 1.6.6
\r
40 In-Reply-To: <1265204568-24018-1-git-send-email-sojkam1@fel.cvut.cz>
\r
41 References: <1265204568-24018-1-git-send-email-sojkam1@fel.cvut.cz>
\r
42 Subject: [notmuch] [PATCH 4/4] Content of the test script updated to the new
\r
44 X-BeenThere: notmuch@notmuchmail.org
\r
45 X-Mailman-Version: 2.1.13
\r
47 List-Id: "Use and development of the notmuch mail system."
\r
48 <notmuch.notmuchmail.org>
\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
52 List-Post: <mailto:notmuch@notmuchmail.org>
\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
56 X-List-Received-Date: Wed, 03 Feb 2010 13:52:43 -0000
\r
59 - Removed helper functions which were moved to test-lib.sh
\r
60 - Replaced every echo with test_expect_success.
\r
61 - Replaced $NOTMUCH with notmuch (test-lib.sh sets $PATH appropriately)
\r
62 - Test commands chained with && (test-lib.sh doesn't use "set -e" in
\r
63 order to complete the test suite even if something fails)
\r
64 - Quoted ${MAIL_DIR} and other variables as they contains spaces
\r
65 - ${TEST_DIR} replaced by ./
\r
67 To run the whole test suite run
\r
70 To run only the converted test
\r
71 ./t0001-notmuch-new.sh
\r
73 To stop on the first error
\r
74 ./t0001-notmuch-new.sh -i
\r
75 then mail store and database can be inspected in
\r
76 "trash directory.t0001-notmuch-new"
\r
78 To see the output of tests
\r
79 ./t0001-notmuch-new.sh -v
\r
81 To not remove trash directory at the end:
\r
82 ./t0001-notmuch-new.sh -d
\r
84 Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
\r
86 test/t0001-notmuch-new.sh | 310 ++++++++++++++++-----------------------------
\r
87 1 files changed, 108 insertions(+), 202 deletions(-)
\r
89 diff --git a/test/t0001-notmuch-new.sh b/test/t0001-notmuch-new.sh
\r
90 index d7b85c0..52c64e9 100755
\r
91 --- a/test/t0001-notmuch-new.sh
\r
92 +++ b/test/t0001-notmuch-new.sh
\r
97 -find_notmuch_binary ()
\r
100 +test_description='Description of this test...
\r
101 +This test checks if command xyzzy does the right thing...
\r
105 - while [ -n "$dir" ]; do
\r
107 - if [ -x $bin ]; then
\r
111 - dir=$(dirname $dir)
\r
112 - if [ "$dir" = "/" ]; then
\r
120 -# Generate a new message in the mail directory, with
\r
121 -# a unique message ID and subject.
\r
123 -# The filename of the message generated is available as
\r
124 -# $gen_msg_filename
\r
126 -gen_msg_filename=""
\r
127 -generate_message ()
\r
129 - gen_msg_cnt=$((gen_msg_cnt + 1))
\r
130 - gen_msg_name=msg-$(printf "%03d" $gen_msg_cnt)
\r
132 - if [ "$#" = "0" ]; then
\r
133 - gen_msg_filename="${MAIL_DIR}/$gen_msg_name"
\r
135 - gen_msg_filename="${MAIL_DIR}/$1/$gen_msg_name"
\r
136 - mkdir -p $(dirname $gen_msg_filename)
\r
139 -cat <<EOF >$gen_msg_filename
\r
140 -From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
141 -To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
142 -Message-Id: <msg-${gen_msg_cnt}@notmuch-test-suite>
\r
143 -Subject: Test message ${gen_msg_filename}
\r
144 -Date: Tue, 05 Jan 2010 15:43:57 -0800
\r
146 -This is just a test message at ${gen_msg_filename}
\r
155 -TEST_DIR=$(pwd)/test.$$
\r
156 -MAIL_DIR=${TEST_DIR}/mail
\r
157 -export NOTMUCH_CONFIG=${TEST_DIR}/notmuch-config
\r
158 -NOTMUCH=$(find_notmuch_binary $(pwd))
\r
160 -rm -rf ${TEST_DIR}
\r
166 -cat <<EOF > ${NOTMUCH_CONFIG}
\r
171 -name=Notmuch Test Suite
\r
172 -primary_email=test_suite@notmuchmail.org
\r
175 -echo "### Testing \"notmuch new\" with no messages"
\r
178 -echo "### Testing \"notmuch new\" with 1 new message"
\r
179 +test_expect_success "Testing \"notmuch new\" with no messages" '
\r
186 -echo "### Testing \"notmuch new\" with 2 new messages"
\r
187 +test_expect_success "Testing \"notmuch new\" with 1 new message" '
\r
188 +generate_message &&
\r
196 -echo "### Testing \"notmuch new\" with no new messages (and a non-empty database)"
\r
200 -echo "### Testing \"notmuch new\" with two new directories (one mail)"
\r
201 -rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch
\r
202 -mkdir ${MAIL_DIR}/def
\r
203 -mkdir ${MAIL_DIR}/ghi
\r
204 -generate_message def
\r
208 -echo "### Testing \"notmuch new\" with two new directories (one mail)---opposite inode order"
\r
210 -rm -rf ${MAIL_DIR}/.notmuch
\r
211 -mv ${MAIL_DIR}/ghi ${MAIL_DIR}/abc
\r
212 -rm ${MAIL_DIR}/def/*
\r
213 -generate_message abc
\r
217 -echo "### Testing \"notmuch new\" with 1 old message moved into the mail store"
\r
218 -rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch
\r
220 -tmp_msg_filename=tmp/$gen_msg_filename
\r
221 -mkdir -p $(dirname $tmp_msg_filename)
\r
222 -mv $gen_msg_filename $tmp_msg_filename
\r
223 +test_expect_success "Testing \"notmuch new\" with 2 new messages" '
\r
224 +generate_message &&
\r
225 +generate_message &&
\r
228 +test_expect_success "Testing \"notmuch new\" with no new messages (and a non-empty database)" '
\r
231 +test_expect_success "Testing \"notmuch new\" with two new directories (one mail)" '
\r
232 +rm -rf "${MAIL_DIR}"/* "${MAIL_DIR}"/.notmuch &&
\r
233 +mkdir "${MAIL_DIR}/def" &&
\r
234 +mkdir "${MAIL_DIR}/ghi" &&
\r
235 +generate_message def &&
\r
238 +test_expect_success "Testing \"notmuch new\" with two new directories (one mail)---opposite inode order" '
\r
239 +rm -rf "${MAIL_DIR}/.notmuch" &&
\r
240 +mv "${MAIL_DIR}/ghi" "${MAIL_DIR}/abc" &&
\r
241 +rm "${MAIL_DIR}/def/"* &&
\r
242 +generate_message abc &&
\r
245 +test_expect_success "Testing \"notmuch new\" with 1 old message moved into the mail store" '
\r
246 +rm -rf "${MAIL_DIR}/"* "${MAIL_DIR}/.notmuch" &&
\r
247 +generate_message &&
\r
248 +tmp_msg_filename="tmp/notmuch-${this_test}/$(basename "$gen_msg_filename")" &&
\r
249 +mkdir -p "$(dirname "$tmp_msg_filename")" &&
\r
250 +mv "$gen_msg_filename" "$tmp_msg_filename" &&
\r
252 +notmuch new > /dev/null &&
\r
254 +mv "$tmp_msg_filename" "$gen_msg_filename" &&
\r
258 -$NOTMUCH new > /dev/null
\r
259 +test_expect_success "Testing \"notmuch new\" with 1 renamed message" '
\r
260 +generate_message &&
\r
261 +notmuch new > /dev/null &&
\r
263 +mv "$gen_msg_filename" "${gen_msg_filename}-renamed" &&
\r
267 -mv $tmp_msg_filename $gen_msg_filename
\r
270 -echo "### Testing \"notmuch new\" with 1 renamed message"
\r
272 +test_expect_success "Testing \"notmuch new\" with 1 deleted message" '
\r
273 +rm "${gen_msg_filename}-renamed" &&
\r
278 -$NOTMUCH new > /dev/null
\r
279 +test_expect_success "Testing \"notmuch new\" with a new directory with 3 messages" '
\r
280 +generate_message dir &&
\r
281 +generate_message dir &&
\r
282 +generate_message dir &&
\r
286 -mv $gen_msg_filename ${gen_msg_filename}-renamed
\r
289 -echo "### Testing \"notmuch new\" with 1 deleted message"
\r
291 +test_expect_success "Testing \"notmuch new\" with a renamed directory of 3 messages" '
\r
292 +mv "${MAIL_DIR}/dir" "${MAIL_DIR}/dir-renamed" &&
\r
296 -rm ${gen_msg_filename}-renamed
\r
299 -echo "### Testing \"notmuch new\" with a new directory with 3 messages"
\r
301 +test_expect_success "Testing \"notmuch new\" with a deleted directory of 3 messages" '
\r
302 +rm -rf "${MAIL_DIR}/dir-renamed" &&
\r
306 -generate_message dir
\r
307 -generate_message dir
\r
308 -generate_message dir
\r
312 -echo "### Testing \"notmuch new\" with a renamed directory of 3 messages"
\r
315 -mv ${MAIL_DIR}/dir ${MAIL_DIR}/dir-renamed
\r
319 -echo "### Testing \"notmuch new\" with a deleted directory of 3 messages"
\r
321 +test_expect_success "Testing \"notmuch new\" with a new directory with 3 messages (tail of list)" '
\r
322 +generate_message zzz &&
\r
323 +generate_message zzz &&
\r
324 +generate_message zzz &&
\r
328 -rm -rf ${MAIL_DIR}/dir-renamed
\r
332 -echo "### Testing \"notmuch new\" with a new directory with 3 messages (tail of list)"
\r
334 +test_expect_success "Testing \"notmuch new\" with a deleted directory of 3 messages (tail of list)" '
\r
335 +rm -rf "${MAIL_DIR}/zzz" &&
\r
338 +test_expect_success "Testing \"notmuch new\" with a symlink to an external directory of 1 message" '
\r
339 +rm -rf "${MAIL_DIR}/.notmuch" &&
\r
340 +mv "${MAIL_DIR}" "./actual_maildir" &&
\r
341 +mkdir "${MAIL_DIR}" &&
\r
342 +ln -s ../actual_maildir "${MAIL_DIR}/symlink" &&
\r
346 -generate_message zzz
\r
347 -generate_message zzz
\r
348 -generate_message zzz
\r
352 -echo "### Testing \"notmuch new\" with a deleted directory of 3 messages (tail of list)"
\r
354 +test_expect_success "Testing \"notmuch new\" with a symlink to an external file" '
\r
355 +generate_message &&
\r
356 +external_msg_filename="$PWD/external/$(basename $gen_msg_filename)" &&
\r
357 +mkdir -p "$(dirname "$external_msg_filename")" &&
\r
358 +mv "$gen_msg_filename" "$external_msg_filename" &&
\r
359 +ln -s "$external_msg_filename" "$gen_msg_filename" &&
\r
364 +test_expect_success "Testing \"notmuch new\" with a two-level directory with 3 files" '
\r
365 +generate_message two/levels &&
\r
366 +generate_message two/levels &&
\r
367 +generate_message two/levels &&
\r
371 -rm -rf ${MAIL_DIR}/zzz
\r
375 -echo "### Testing \"notmuch new\" with a symlink to an external directory of 1 message"
\r
377 -rm -rf ${MAIL_DIR}/.notmuch
\r
378 -mv ${MAIL_DIR} ${TEST_DIR}/actual_maildir
\r
381 -ln -s ${TEST_DIR}/actual_maildir ${MAIL_DIR}/symlink
\r
385 -echo "### Testing \"notmuch new\" with a symlink to an external file"
\r
388 -external_msg_filename=${TEST_DIR}/external/$(basename $gen_msg_filename)
\r
389 -mkdir -p $(dirname $external_msg_filename)
\r
390 -mv $gen_msg_filename $external_msg_filename
\r
391 -ln -s $external_msg_filename $gen_msg_filename
\r
395 -echo "### Testing \"notmuch new\" with a two-level directory with 3 files"
\r
398 -generate_message two/levels
\r
399 -generate_message two/levels
\r
400 -generate_message two/levels
\r
404 -echo "### Testing \"notmuch new\" with deletion of two-level directory (3 files)"
\r
407 -rm -rf ${MAIL_DIR}/two
\r
412 -Notmuch test suite complete.
\r
413 +test_expect_success "Testing \"notmuch new\" with deletion of two-level directory (3 files)" '
\r
414 +rm -rf "${MAIL_DIR}/two" &&
\r
418 -Intermediate state can be examined in:
\r