[PATCH 2/2] test: Nix increment_mtime.
authorAustin Clements <amdragon@MIT.EDU>
Wed, 29 Jun 2011 07:10:55 +0000 (03:10 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:48 +0000 (09:38 -0800)
39/ba7636b8bee50909185cb17a5fc6544bdb489c [new file with mode: 0644]

diff --git a/39/ba7636b8bee50909185cb17a5fc6544bdb489c b/39/ba7636b8bee50909185cb17a5fc6544bdb489c
new file mode 100644 (file)
index 0000000..9cb7f12
--- /dev/null
@@ -0,0 +1,296 @@
+Return-Path: <amthrax@drake.mit.edu>\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 31568429E55\r
+       for <notmuch@notmuchmail.org>; Wed, 29 Jun 2011 00:11:10 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 QZwyLyiI7yUy for <notmuch@notmuchmail.org>;\r
+       Wed, 29 Jun 2011 00:11:07 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU\r
+       [18.7.68.36])\r
+       by olra.theworths.org (Postfix) with ESMTP id 57E91421186\r
+       for <notmuch@notmuchmail.org>; Wed, 29 Jun 2011 00:11:07 -0700 (PDT)\r
+X-AuditID: 12074424-b7bc6ae000005a77-6a-4e0ad00a39b1\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+       by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id B2.75.23159.A00DA0E4; Wed, 29 Jun 2011 03:11:06 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id p5T7B6sO029792; \r
+       Wed, 29 Jun 2011 03:11:06 -0400\r
+Received: from drake.mit.edu\r
+       (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+       [209.6.116.242]) (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id p5T7B5gx015228\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Wed, 29 Jun 2011 03:11:06 -0400 (EDT)\r
+Received: from amthrax by drake.mit.edu with local (Exim 4.76)\r
+       (envelope-from <amthrax@drake.mit.edu>)\r
+       id 1QbovR-00056Z-Cd; Wed, 29 Jun 2011 03:11:05 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/2] test: Nix increment_mtime.\r
+Date: Wed, 29 Jun 2011 03:10:55 -0400\r
+Message-Id: <1309331455-19584-2-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.5.1\r
+In-Reply-To: <1309331455-19584-1-git-send-email-amdragon@mit.edu>\r
+References: <1309331455-19584-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFjrMIsWRmVeSWpSXmKPExsUixCmqrct1gcvPYPISK4vrN2cyOzB6PFt1\r
+       izmAMYrLJiU1J7MstUjfLoErY++K1ywFZ5wq7lx5x9TAuMOii5GTQ0LARKLrYh8rhC0mceHe\r
+       erYuRi4OIYF9jBI3Tm2AcjYwSrS/vcoK4dxnkvh/+hkzhDOfUaL/yBQWkH42AQ2JbfuXM4LY\r
+       IgLSEjvvzgbq4OBgFhCReDeTCSQsLKAv0di4nAkkzCKgKnFkpS+IySvgIPF8ayjEEQoSV67M\r
+       AxvIKeAo8axnHRuILQRUMunOE/YJjPwLGBlWMcqm5Fbp5iZm5hSnJusWJyfm5aUW6Zrr5WaW\r
+       6KWmlG5iBIUMu4vKDsbmQ0qHGAU4GJV4eIUec/oJsSaWFVfmHmKU5GBSEuWNOcvlJ8SXlJ9S\r
+       mZFYnBFfVJqTWnyIUYKDWUmE9/cCoBxvSmJlVWpRPkxKmoNFSZy31Pu/r5BAemJJanZqakFq\r
+       EUxWhoNDSYJ3wjmgRsGi1PTUirTMnBKENBMHJ8hwHqDhfiA1vMUFibnFmekQ+VOMxhw7/y07\r
+       zMjx9vXKw4xCLHn5ealS4rxbQEoFQEozSvPgpsHi/hWjONBzwrwdIFU8wJQBN+8V0ComoFUX\r
+       osBWlSQipKQaGE3vHvJispp4ju9jzKpjNb8d9adGzHwobzX1K5/QYtsaE57DrWUF/EFtz/ri\r
+       zX19PS/KJORcfrZqw+eoc9/q6uV7GTYauwnJaDguT9nAFvdOb2W+gXTZ5NWR7ifrIyzYORpW\r
+       Xf9WeOTngpeOubWX7ur9+pk651Bw8Y5DRnf0QopO2wS4ODobK7EUZyQaajEXFScCAEIlOX3W        AgAA\r
+Cc: amdragon@mit.edu\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, 29 Jun 2011 07:11:10 -0000\r
+\r
+With the fix for the mtime race, this workaround is no longer\r
+necessary.\r
+---\r
+ test/maildir-sync     |    8 --------\r
+ test/multipart        |    1 -\r
+ test/new              |    9 ---------\r
+ test/search-by-folder |    2 --\r
+ test/test-lib.sh      |   15 ---------------\r
+ 5 files changed, 0 insertions(+), 35 deletions(-)\r
+\r
+diff --git a/test/maildir-sync b/test/maildir-sync\r
+index c99dbec..a60854f 100755\r
+--- a/test/maildir-sync\r
++++ b/test/maildir-sync\r
+@@ -23,7 +23,6 @@ output=$(notmuch search subject:"Adding S flag" | notmuch_search_sanitize)\r
+ output+="\r
+ "\r
+ mv "${gen_msg_filename}" "${gen_msg_filename}S"\r
+-increment_mtime "$(dirname "${gen_msg_filename}")"\r
+ output+=$(NOTMUCH_NEW)\r
+ output+="\r
+ "\r
+@@ -66,7 +65,6 @@ test_expect_equal "$output" '[[[{"id": "adding-replied-tag@notmuch-test-suite",\r
+ test_expect_success 'notmuch reply works with renamed file (without notmuch new)' 'notmuch reply id:${gen_msg_id}'\r
\r
+ test_begin_subtest "notmuch new detects no file rename after tag->flag synchronization"\r
+-increment_mtime "$(dirname ${gen_msg_filename})"\r
+ output=$(NOTMUCH_NEW)\r
+ test_expect_equal "$output" "No new mail."\r
\r
+@@ -77,7 +75,6 @@ output=$(cd "$MAIL_DIR/cur"; ls message-to-move*)\r
+ test_expect_equal "$output" "message-to-move-to-cur:2,S"\r
\r
+ test_begin_subtest "No rename should be detected by notmuch new"\r
+-increment_mtime "$MAIL_DIR/cur"\r
+ output=$(NOTMUCH_NEW)\r
+ test_expect_equal "$output" "No new mail."\r
+ # (*) If notmuch new was not run we've got "Processed 1 file in almost\r
+@@ -97,7 +94,6 @@ output=$(notmuch search subject:"Removing S flag" | notmuch_search_sanitize)\r
+ output+="\r
+ "\r
+ mv "${gen_msg_filename}" "${gen_msg_filename%S}"\r
+-increment_mtime "$(dirname "${gen_msg_filename}")"\r
+ output+=$(NOTMUCH_NEW)\r
+ output+="\r
+ "\r
+@@ -110,7 +106,6 @@ test_begin_subtest "Removing info from filename leaves tags unchanged"\r
+ add_message [subject]='"Message to lose maildir info"' [filename]='message-to-lose-maildir-info' [dir]=cur\r
+ notmuch tag -unread subject:"Message to lose maildir info"\r
+ mv "$MAIL_DIR/cur/message-to-lose-maildir-info:2,S" "$MAIL_DIR/cur/message-without-maildir-info"\r
+-increment_mtime "$MAIL_DIR/cur"\r
+ output=$(NOTMUCH_NEW)\r
+ output+="\r
+ "\r
+@@ -134,7 +129,6 @@ mv $MAIL_DIR/cur/adding-replied-tag:2,RS $MAIL_DIR/cur/adding-replied-tag:2,S\r
+ mv $MAIL_DIR/cur/adding-s-flag:2,S $MAIL_DIR/cur/adding-s-flag:2,\r
+ mv $MAIL_DIR/cur/adding-with-s-flag:2,S $MAIL_DIR/cur/adding-with-s-flag:2,RS\r
+ mv $MAIL_DIR/cur/message-to-move-to-cur:2,S $MAIL_DIR/cur/message-to-move-to-cur:2,DS\r
+-increment_mtime $MAIL_DIR/cur\r
+ notmuch dump dump.txt\r
+ NOTMUCH_NEW >/dev/null\r
+ notmuch restore dump.txt\r
+@@ -144,7 +138,6 @@ test_expect_equal "$output" "$expected"\r
+ test_begin_subtest 'Adding flags to duplicate message tags the mail'\r
+ add_message [subject]='"Duplicated message"' [dir]=cur [filename]='duplicated-message:2,'\r
+ cp "$MAIL_DIR/cur/duplicated-message:2," "$MAIL_DIR/cur/duplicated-message-copy:2,RS"\r
+-increment_mtime $MAIL_DIR/cur\r
+ NOTMUCH_NEW > output\r
+ notmuch search subject:"Duplicated message" | notmuch_search_sanitize >> output\r
+ test_expect_equal "$(< output)" "No new mail.\r
+@@ -152,7 +145,6 @@ thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Duplicated message (inbox repl\r
\r
+ test_begin_subtest "Adding duplicate message without flags does not remove tags"\r
+ cp "$MAIL_DIR/cur/duplicated-message-copy:2,RS" "$MAIL_DIR/cur/duplicated-message-another-copy:2,"\r
+-increment_mtime $MAIL_DIR/cur\r
+ NOTMUCH_NEW > output\r
+ notmuch search subject:"Duplicated message" | notmuch_search_sanitize >> output\r
+ test_expect_equal "$(< output)" "No new mail.\r
+diff --git a/test/multipart b/test/multipart\r
+index 4d577f8..22c42c6 100755\r
+--- a/test/multipart\r
++++ b/test/multipart\r
+@@ -88,7 +88,6 @@ Content-Transfer-Encoding: base64\r
+ 7w0K\r
+ --==-=-=--\r
+ EOF\r
+-increment_mtime "$MAIL_DIR"\r
+ notmuch new > /dev/null\r
\r
+ test_begin_subtest "--format=text --part=0, full message"\r
+diff --git a/test/new b/test/new\r
+index 1b7296e..49f390d 100755\r
+--- a/test/new\r
++++ b/test/new\r
+@@ -52,10 +52,8 @@ 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
+-increment_mtime "${MAIL_DIR}"\r
+ notmuch new > /dev/null\r
+ mv "$tmp_msg_filename" "$gen_msg_filename"\r
+-increment_mtime "${MAIL_DIR}"\r
+ output=$(NOTMUCH_NEW)\r
+ test_expect_equal "$output" "Added 1 new message to the database."\r
\r
+@@ -65,7 +63,6 @@ test_begin_subtest "Renamed message"\r
+ generate_message\r
+ notmuch new > /dev/null\r
+ mv "$gen_msg_filename" "${gen_msg_filename}"-renamed\r
+-increment_mtime "${MAIL_DIR}"\r
+ output=$(NOTMUCH_NEW)\r
+ test_expect_equal "$output" "No new mail. Detected 1 file rename."\r
\r
+@@ -73,7 +70,6 @@ test_expect_equal "$output" "No new mail. Detected 1 file rename."\r
+ test_begin_subtest "Deleted message"\r
\r
+ rm "${gen_msg_filename}"-renamed\r
+-increment_mtime "${MAIL_DIR}"\r
+ output=$(NOTMUCH_NEW)\r
+ test_expect_equal "$output" "No new mail. Removed 1 message."\r
\r
+@@ -87,7 +83,6 @@ generate_message [dir]=dir\r
+ notmuch new > /dev/null\r
\r
+ mv "${MAIL_DIR}"/dir "${MAIL_DIR}"/dir-renamed\r
+-increment_mtime "${MAIL_DIR}"\r
\r
+ output=$(NOTMUCH_NEW)\r
+ test_expect_equal "$output" "No new mail. Detected 3 file renames."\r
+@@ -96,7 +91,6 @@ test_expect_equal "$output" "No new mail. Detected 3 file renames."\r
+ test_begin_subtest "Deleted directory"\r
\r
+ rm -rf "${MAIL_DIR}"/dir-renamed\r
+-increment_mtime "${MAIL_DIR}"\r
\r
+ output=$(NOTMUCH_NEW)\r
+ test_expect_equal "$output" "No new mail. Removed 3 messages."\r
+@@ -115,7 +109,6 @@ test_expect_equal "$output" "Added 3 new messages to the database."\r
+ test_begin_subtest "Deleted directory (end of list)"\r
\r
+ rm -rf "${MAIL_DIR}"/zzz\r
+-increment_mtime "${MAIL_DIR}"\r
\r
+ output=$(NOTMUCH_NEW)\r
+ test_expect_equal "$output" "No new mail. Removed 3 messages."\r
+@@ -139,7 +132,6 @@ 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
+-increment_mtime "${MAIL_DIR}"\r
+ output=$(NOTMUCH_NEW)\r
+ test_expect_equal "$output" "Added 1 new message to the database."\r
\r
+@@ -157,7 +149,6 @@ test_expect_equal "$output" "Added 3 new messages to the database."\r
+ test_begin_subtest "Deleted two-level directory"\r
\r
+ rm -rf "${MAIL_DIR}"/two\r
+-increment_mtime "${MAIL_DIR}"\r
\r
+ output=$(NOTMUCH_NEW)\r
+ test_expect_equal "$output" "No new mail. Removed 3 messages."\r
+diff --git a/test/search-by-folder b/test/search-by-folder\r
+index 4afa483..5cc2ca8 100755\r
+--- a/test/search-by-folder\r
++++ b/test/search-by-folder\r
+@@ -23,14 +23,12 @@ test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; B\r
\r
+ test_begin_subtest "After removing duplicate instance of matching path"\r
+ rm -r "${MAIL_DIR}/bad/news"\r
+-increment_mtime "${MAIL_DIR}/bad"\r
+ notmuch new\r
+ output=$(notmuch search folder:bad/news | notmuch_search_sanitize)\r
+ test_expect_equal "$output" "thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Bears (inbox unread)"\r
\r
+ test_begin_subtest "After rename, old path returns nothing"\r
+ mv "${MAIL_DIR}/duplicate/bad/news" "${MAIL_DIR}/duplicate/bad/olds"\r
+-increment_mtime "${MAIL_DIR}/duplicate/bad"\r
+ notmuch new\r
+ output=$(notmuch search folder:bad/news | notmuch_search_sanitize)\r
+ test_expect_equal "$output" ""\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index 079d7db..22e387e 100755\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -213,16 +213,6 @@ remove_cr () {\r
+       tr '\015' Q | sed -e 's/Q$//'\r
+ }\r
\r
+-# Notmuch helper functions\r
+-increment_mtime_amount=0\r
+-increment_mtime ()\r
+-{\r
+-    dir="$1"\r
+-\r
+-    increment_mtime_amount=$((increment_mtime_amount + 1))\r
+-    touch -d "+${increment_mtime_amount} seconds" "$dir"\r
+-}\r
+-\r
+ # Generate a new message in the mail directory, with a unique message\r
+ # ID and subject. The message is not added to the index.\r
+ #\r
+@@ -364,9 +354,6 @@ Date: ${template[date]}\r
+ ${additional_headers}\r
+ ${template[body]}\r
+ EOF\r
+-\r
+-    # Ensure that the mtime of the containing directory is updated\r
+-    increment_mtime "$(dirname "${gen_msg_filename}")"\r
+ }\r
\r
+ # Generate a new message and add it to the database.\r
+@@ -409,8 +396,6 @@ emacs_deliver_message ()\r
+          $@\r
+          (message-send-and-exit))" >/dev/null 2>&1\r
+     wait ${smtp_dummy_pid}\r
+-    increment_mtime "$MAIL_DIR"/sent/cur\r
+-    increment_mtime "$MAIL_DIR"/sent/new\r
+     notmuch new >/dev/null\r
+ }\r
\r
+-- \r
+1.7.5.1\r
+\r