[notmuch] [PATCH 4/4] Content of the test script updated to the new framework
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 3 Feb 2010 13:42:48 +0000 (14:42 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:05 +0000 (09:36 -0800)
73/1d5f94eec67b879934e9022c5f4989023b7cc9 [new file with mode: 0644]

diff --git a/73/1d5f94eec67b879934e9022c5f4989023b7cc9 b/73/1d5f94eec67b879934e9022c5f4989023b7cc9
new file mode 100644 (file)
index 0000000..bbb455f
--- /dev/null
@@ -0,0 +1,424 @@
+Return-Path: <sojkam1@fel.cvut.cz>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id D62B6431FBD\r
+       for <notmuch@notmuchmail.org>; Wed,  3 Feb 2010 05:52:42 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.317\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.317 tagged_above=-999 required=5 tests=[AWL=0.282,\r
+       BAYES_00=-2.599] autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id Og351Xxaxyci for <notmuch@notmuchmail.org>;\r
+       Wed,  3 Feb 2010 05:52:41 -0800 (PST)\r
+Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
+       by olra.theworths.org (Postfix) with ESMTP id 8B473431FAE\r
+       for <notmuch@notmuchmail.org>; Wed,  3 Feb 2010 05:52:41 -0800 (PST)\r
+Received: from localhost (unknown [192.168.200.4])\r
+       by max.feld.cvut.cz (Postfix) with ESMTP id F367319F3372\r
+       for <notmuch@notmuchmail.org>; Wed,  3 Feb 2010 14:52:40 +0100 (CET)\r
+X-Virus-Scanned: IMAP AMAVIS\r
+Received: from max.feld.cvut.cz ([192.168.200.1])\r
+       by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new,\r
+       port 10044) with ESMTP id Z2maKPtCHOuc for <notmuch@notmuchmail.org>;\r
+       Wed,  3 Feb 2010 14:52:35 +0100 (CET)\r
+Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
+       by max.feld.cvut.cz (Postfix) with ESMTP id AEF5819F35E3\r
+       for <notmuch@notmuchmail.org>; Wed,  3 Feb 2010 14:42:55 +0100 (CET)\r
+Received: from localhost.localdomain (k335-30.felk.cvut.cz [147.32.86.30])\r
+       (Authenticated sender: sojkam1)\r
+       by imap.feld.cvut.cz (Postfix) with ESMTPSA id 8650AFA006\r
+       for <notmuch@notmuchmail.org>; Wed,  3 Feb 2010 14:42:55 +0100 (CET)\r
+From: Michal Sojka <sojkam1@fel.cvut.cz>\r
+To: notmuch@notmuchmail.org\r
+Date: Wed,  3 Feb 2010 14:42:48 +0100\r
+Message-Id: <1265204568-24018-4-git-send-email-sojkam1@fel.cvut.cz>\r
+X-Mailer: git-send-email 1.6.6\r
+In-Reply-To: <1265204568-24018-1-git-send-email-sojkam1@fel.cvut.cz>\r
+References: <1265204568-24018-1-git-send-email-sojkam1@fel.cvut.cz>\r
+Subject: [notmuch] [PATCH 4/4] Content of the test script updated to the new\r
+       framework\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 03 Feb 2010 13:52:43 -0000\r
+\r
+The changes are:\r
+- Removed helper functions which were moved to test-lib.sh\r
+- Replaced every echo with test_expect_success.\r
+- Replaced $NOTMUCH with notmuch (test-lib.sh sets $PATH appropriately)\r
+- Test commands chained with && (test-lib.sh doesn't use "set -e" in\r
+  order to complete the test suite even if something fails)\r
+- Quoted ${MAIL_DIR} and other variables as they contains spaces\r
+- ${TEST_DIR} replaced by ./\r
+\r
+To run the whole test suite run\r
+    make\r
+\r
+To run only the converted test\r
+   ./t0001-notmuch-new.sh\r
+\r
+To stop on the first error\r
+   ./t0001-notmuch-new.sh -i\r
+then mail store and database can be inspected in\r
+"trash directory.t0001-notmuch-new"\r
+\r
+To see the output of tests\r
+   ./t0001-notmuch-new.sh -v\r
+\r
+To not remove trash directory at the end:\r
+   ./t0001-notmuch-new.sh -d\r
+\r
+Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>\r
+---\r
+ test/t0001-notmuch-new.sh |  310 ++++++++++++++++-----------------------------\r
+ 1 files changed, 108 insertions(+), 202 deletions(-)\r
+\r
+diff --git a/test/t0001-notmuch-new.sh b/test/t0001-notmuch-new.sh\r
+index d7b85c0..52c64e9 100755\r
+--- a/test/t0001-notmuch-new.sh\r
++++ b/test/t0001-notmuch-new.sh\r
+@@ -1,220 +1,126 @@\r
+ #!/bin/sh\r
+-set -e\r
\r
+-find_notmuch_binary ()\r
+-{\r
+-    dir=$1\r
++test_description='Description of this test...\r
++This test checks if command xyzzy does the right thing...\r
++'\r
++. ./test-lib.sh\r
\r
+-    while [ -n "$dir" ]; do\r
+-      bin=$dir/notmuch\r
+-      if [ -x $bin ]; then\r
+-          echo $bin\r
+-          return\r
+-      fi\r
+-      dir=$(dirname $dir)\r
+-      if [ "$dir" = "/" ]; then\r
+-          break\r
+-      fi\r
+-    done\r
+-\r
+-    echo notmuch\r
+-}\r
+-\r
+-# Generate a new message in the mail directory, with\r
+-# a unique message ID and subject.\r
+-#\r
+-# The filename of the message generated is available as\r
+-# $gen_msg_filename\r
+-gen_msg_cnt=0\r
+-gen_msg_filename=""\r
+-generate_message ()\r
+-{\r
+-    gen_msg_cnt=$((gen_msg_cnt + 1))\r
+-    gen_msg_name=msg-$(printf "%03d" $gen_msg_cnt)\r
+-\r
+-    if [ "$#" = "0" ]; then\r
+-      gen_msg_filename="${MAIL_DIR}/$gen_msg_name"\r
+-    else\r
+-      gen_msg_filename="${MAIL_DIR}/$1/$gen_msg_name"\r
+-      mkdir -p $(dirname $gen_msg_filename)\r
+-    fi\r
+-\r
+-cat <<EOF >$gen_msg_filename\r
+-From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
+-To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
+-Message-Id: <msg-${gen_msg_cnt}@notmuch-test-suite>\r
+-Subject: Test message ${gen_msg_filename}\r
+-Date: Tue, 05 Jan 2010 15:43:57 -0800\r
+-\r
+-This is just a test message at ${gen_msg_filename}\r
+-EOF\r
+-}\r
+-\r
+-do_sleep ()\r
+-{\r
+-    sleep 1\r
+-}\r
+-\r
+-TEST_DIR=$(pwd)/test.$$\r
+-MAIL_DIR=${TEST_DIR}/mail\r
+-export NOTMUCH_CONFIG=${TEST_DIR}/notmuch-config\r
+-NOTMUCH=$(find_notmuch_binary $(pwd))\r
+-\r
+-rm -rf ${TEST_DIR}\r
+-mkdir ${TEST_DIR}\r
+-cd ${TEST_DIR}\r
+-\r
+-mkdir ${MAIL_DIR}\r
+-\r
+-cat <<EOF > ${NOTMUCH_CONFIG}\r
+-[database]\r
+-path=${MAIL_DIR}\r
+-\r
+-[user]\r
+-name=Notmuch Test Suite\r
+-primary_email=test_suite@notmuchmail.org\r
+-EOF\r
+-\r
+-echo "### Testing \"notmuch new\" with no messages"\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with 1 new message"\r
++test_expect_success "Testing \"notmuch new\" with no messages" '\r
++notmuch new\r
++'\r
+ do_sleep\r
+-generate_message\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with 2 new messages"\r
++test_expect_success "Testing \"notmuch new\" with 1 new message" '\r
++generate_message &&\r
++notmuch new\r
++'\r
+ do_sleep\r
+-generate_message\r
+-generate_message\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with no new messages (and a non-empty database)"\r
+-\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with two new directories (one mail)"\r
+-rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
+-mkdir ${MAIL_DIR}/def\r
+-mkdir ${MAIL_DIR}/ghi\r
+-generate_message def\r
+-\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with two new directories (one mail)---opposite inode order"\r
+-\r
+-rm -rf ${MAIL_DIR}/.notmuch\r
+-mv ${MAIL_DIR}/ghi ${MAIL_DIR}/abc\r
+-rm ${MAIL_DIR}/def/*\r
+-generate_message abc\r
+-\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with 1 old message moved into the mail store"\r
+-rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch\r
+-generate_message\r
+-tmp_msg_filename=tmp/$gen_msg_filename\r
+-mkdir -p $(dirname $tmp_msg_filename)\r
+-mv $gen_msg_filename $tmp_msg_filename\r
++test_expect_success "Testing \"notmuch new\" with 2 new messages" '\r
++generate_message &&\r
++generate_message &&\r
++notmuch new\r
++'\r
++test_expect_success "Testing \"notmuch new\" with no new messages (and a non-empty database)" '\r
++notmuch new\r
++'\r
++test_expect_success "Testing \"notmuch new\" with two new directories (one mail)" '\r
++rm -rf "${MAIL_DIR}"/* "${MAIL_DIR}"/.notmuch &&\r
++mkdir "${MAIL_DIR}/def" &&\r
++mkdir "${MAIL_DIR}/ghi" &&\r
++generate_message def &&\r
++notmuch new\r
++'\r
++test_expect_success "Testing \"notmuch new\" with two new directories (one mail)---opposite inode order" '\r
++rm -rf "${MAIL_DIR}/.notmuch" &&\r
++mv "${MAIL_DIR}/ghi" "${MAIL_DIR}/abc" &&\r
++rm "${MAIL_DIR}/def/"* &&\r
++generate_message abc &&\r
++notmuch new\r
++'\r
++test_expect_success "Testing \"notmuch new\" with 1 old message moved into the mail store" '\r
++rm -rf "${MAIL_DIR}/"* "${MAIL_DIR}/.notmuch" &&\r
++generate_message &&\r
++tmp_msg_filename="tmp/notmuch-${this_test}/$(basename "$gen_msg_filename")" &&\r
++mkdir -p "$(dirname "$tmp_msg_filename")" &&\r
++mv "$gen_msg_filename" "$tmp_msg_filename" &&\r
++do_sleep &&\r
++notmuch new > /dev/null &&\r
++do_sleep &&\r
++mv "$tmp_msg_filename" "$gen_msg_filename" &&\r
++notmuch new\r
++'\r
+ do_sleep\r
+-$NOTMUCH new > /dev/null\r
++test_expect_success "Testing \"notmuch new\" with 1 renamed message" '\r
++generate_message &&\r
++notmuch new > /dev/null &&\r
++do_sleep &&\r
++mv "$gen_msg_filename" "${gen_msg_filename}-renamed" &&\r
++notmuch new\r
++'\r
+ do_sleep\r
+-mv $tmp_msg_filename $gen_msg_filename\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with 1 renamed message"\r
+-\r
++test_expect_success "Testing \"notmuch new\" with 1 deleted message" '\r
++rm "${gen_msg_filename}-renamed" &&\r
++notmuch new\r
++'\r
+ do_sleep\r
+-generate_message\r
+-$NOTMUCH new > /dev/null\r
++test_expect_success "Testing \"notmuch new\" with a new directory with 3 messages" '\r
++generate_message dir &&\r
++generate_message dir &&\r
++generate_message dir &&\r
++notmuch new\r
++'\r
+ do_sleep\r
+-mv $gen_msg_filename ${gen_msg_filename}-renamed\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with 1 deleted message"\r
+-\r
++test_expect_success "Testing \"notmuch new\" with a renamed directory of 3 messages" '\r
++mv "${MAIL_DIR}/dir" "${MAIL_DIR}/dir-renamed" &&\r
++notmuch new\r
++'\r
+ do_sleep\r
+-rm ${gen_msg_filename}-renamed\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with a new directory with 3 messages"\r
+-\r
++test_expect_success "Testing \"notmuch new\" with a deleted directory of 3 messages" '\r
++rm -rf "${MAIL_DIR}/dir-renamed" &&\r
++notmuch new\r
++'\r
+ do_sleep\r
+-generate_message dir\r
+-generate_message dir\r
+-generate_message dir\r
+-\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with a renamed directory of 3 messages"\r
+-\r
+-do_sleep\r
+-mv ${MAIL_DIR}/dir ${MAIL_DIR}/dir-renamed\r
+-\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with a deleted directory of 3 messages"\r
+-\r
++test_expect_success "Testing \"notmuch new\" with a new directory with 3 messages (tail of list)" '\r
++generate_message zzz &&\r
++generate_message zzz &&\r
++generate_message zzz &&\r
++notmuch new\r
++'\r
+ do_sleep\r
+-rm -rf ${MAIL_DIR}/dir-renamed\r
+-\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with a new directory with 3 messages (tail of list)"\r
\r
++test_expect_success "Testing \"notmuch new\" with a deleted directory of 3 messages (tail of list)" '\r
++rm -rf "${MAIL_DIR}/zzz" &&\r
++notmuch new\r
++'\r
++test_expect_success "Testing \"notmuch new\" with a symlink to an external directory of 1 message" '\r
++rm -rf "${MAIL_DIR}/.notmuch" &&\r
++mv "${MAIL_DIR}" "./actual_maildir" &&\r
++mkdir "${MAIL_DIR}" &&\r
++ln -s ../actual_maildir "${MAIL_DIR}/symlink" &&\r
++notmuch new\r
++'\r
+ do_sleep\r
+-generate_message zzz\r
+-generate_message zzz\r
+-generate_message zzz\r
+-\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with a deleted directory of 3 messages (tail of list)"\r
\r
++test_expect_success "Testing \"notmuch new\" with a symlink to an external file" '\r
++generate_message &&\r
++external_msg_filename="$PWD/external/$(basename $gen_msg_filename)" &&\r
++mkdir -p "$(dirname "$external_msg_filename")" &&\r
++mv "$gen_msg_filename" "$external_msg_filename" &&\r
++ln -s "$external_msg_filename" "$gen_msg_filename" &&\r
++notmuch new\r
++'\r
++do_sleep \r
++\r
++test_expect_success "Testing \"notmuch new\" with a two-level directory with 3 files" '\r
++generate_message two/levels &&\r
++generate_message two/levels &&\r
++generate_message two/levels &&\r
++notmuch new\r
++'\r
+ do_sleep\r
+-rm -rf ${MAIL_DIR}/zzz\r
+-\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with a symlink to an external directory of 1 message"\r
+-\r
+-rm -rf ${MAIL_DIR}/.notmuch\r
+-mv ${MAIL_DIR} ${TEST_DIR}/actual_maildir\r
+-\r
+-mkdir ${MAIL_DIR}\r
+-ln -s ${TEST_DIR}/actual_maildir ${MAIL_DIR}/symlink\r
+-\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with a symlink to an external file"\r
+-do_sleep\r
+-generate_message\r
+-external_msg_filename=${TEST_DIR}/external/$(basename $gen_msg_filename)\r
+-mkdir -p $(dirname $external_msg_filename)\r
+-mv $gen_msg_filename $external_msg_filename\r
+-ln -s $external_msg_filename $gen_msg_filename\r
+-\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with a two-level directory with 3 files"\r
+-\r
+-do_sleep\r
+-generate_message two/levels\r
+-generate_message two/levels\r
+-generate_message two/levels\r
+-\r
+-$NOTMUCH new\r
+-\r
+-echo "### Testing \"notmuch new\" with deletion of two-level directory (3 files)"\r
+-\r
+-do_sleep\r
+-rm -rf ${MAIL_DIR}/two\r
+-\r
+-$NOTMUCH new\r
\r
+-cat <<EOF\r
+-Notmuch test suite complete.\r
++test_expect_success "Testing \"notmuch new\" with deletion of two-level directory (3 files)" '\r
++rm -rf "${MAIL_DIR}/two" &&\r
++notmuch new\r
++'\r
\r
+-Intermediate state can be examined in:\r
+-      ${TEST_DIR}\r
+-EOF\r
++test_done\r
+-- \r
+1.6.6\r
+\r