[PATCH] test: Fix transient error in 'new' test
authorAustin Clements <amdragon@MIT.EDU>
Mon, 23 Dec 2013 20:20:36 +0000 (15:20 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:58:48 +0000 (09:58 -0800)
41/38958677c415b24a39c177499336d57807202f [new file with mode: 0644]

diff --git a/41/38958677c415b24a39c177499336d57807202f b/41/38958677c415b24a39c177499336d57807202f
new file mode 100644 (file)
index 0000000..7c7ba85
--- /dev/null
@@ -0,0 +1,118 @@
+Return-Path: <amdragon@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 13C6E431FC9\r
+       for <notmuch@notmuchmail.org>; Mon, 23 Dec 2013 12:20:59 -0800 (PST)\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 iWfHzFgfpA0Z for <notmuch@notmuchmail.org>;\r
+       Mon, 23 Dec 2013 12:20:51 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-3.mit.edu (dmz-mailsec-scanner-3.mit.edu\r
+       [18.9.25.14])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id E0EE1431FBF\r
+       for <notmuch@notmuchmail.org>; Mon, 23 Dec 2013 12:20:50 -0800 (PST)\r
+X-AuditID: 1209190e-f79ee6d000000c40-77-52b89b20e496\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       (using TLS with cipher AES256-SHA (256/256 bits))\r
+       (Client did not present a certificate)\r
+       by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id EE.0C.03136.02B98B25; Mon, 23 Dec 2013 15:20:48 -0500 (EST)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+       by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id rBNKKj76018914; \r
+       Mon, 23 Dec 2013 15:20:45 -0500\r
+Received: from drake.dyndns.org (a069.catapulsion.net [70.36.81.69])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id rBNKKgoG031693\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Mon, 23 Dec 2013 15:20:44 -0500\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1VvBzU-0004Hj-Rf; Mon, 23 Dec 2013 15:20:40 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] test: Fix transient error in 'new' test\r
+Date: Mon, 23 Dec 2013 15:20:36 -0500\r
+Message-Id: <1387830036-16434-1-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.8.4.rc3\r
+In-Reply-To: <87bo089y0t.fsf@maritornes.cs.unb.ca>\r
+References: <87bo089y0t.fsf@maritornes.cs.unb.ca>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFjrJIsWRmVeSWpSXmKPExsUixCmqrKswe0eQwa+PvBY3WrsZLa7fnMns\r
+       wOTxbNUtZo8th94zBzBFcdmkpOZklqUW6dslcGVc2/SZsWClQMWT3beZGhjP8nYxcnJICJhI\r
+       XPi3hQXCFpO4cG89WxcjF4eQwGwmiZnvJjNCOBsZJbbc+scC4exikni9bCI7hDOXUaJ16gJW\r
+       kH42AQ2JbfuXM4LYIgLSEjvvzgaLMwtYSlz92s4EYgsLWEjcnr8QbB+LgKrEgqcggzg4eAUc\r
+       JFbMkoQ4Q0li4altYK2cAkYSZzbOBLOFBAwlHp44yTyBkX8BI8MqRtmU3Crd3MTMnOLUZN3i\r
+       5MS8vNQiXWO93MwSvdSU0k2M4FCS5NvB+PWg0iFGAQ5GJR7egtIdQUKsiWXFlbmHGCU5mJRE\r
+       ectnAoX4kvJTKjMSizPii0pzUosPMUpwMCuJ8N7NBMrxpiRWVqUW5cOkpDlYlMR5b3LYBwkJ\r
+       pCeWpGanphakFsFkZTg4lCR4S2YBNQoWpaanVqRl5pQgpJk4OEGG8wANXwNSw1tckJhbnJkO\r
+       kT/FqMvR9+/TN0Yhlrz8vFQpcV4bkCIBkKKM0jy4ObAU8IpRHOgtYd42kCoeYPqAm/QKaAkT\r
+       0JKmGdtAlpQkIqSkGhibPr5MW/2mkelv3J1pC7yWtb5+cfPpf5fdyzjEFt6WYGWUWablsN8s\r
+       gkf79M71p5iOBoXLN7qraf1rc8xYaGEaXJ+8ztnSU6qgK/jH/Bau3Ac3d6Upv4ld9+CZ7b2l\r
+       19W9c+Mev8pc9MHKZZbgkidNc4MDVIzztC794FynMH9WAe8OmVXnNX8psRRnJBpqMRcVJwIA\r
+       hgcZU9wCAAA=\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: Mon, 23 Dec 2013 20:20:59 -0000\r
+\r
+This fixes a non-deterministic failure in "Ignore files and\r
+directories specified in new.ignore (multiple occurrences)".  The test\r
+assumed that all directories would be scanned, even though nothing\r
+updated the mtime of ${MAIL_DIR}.  It *usually* worked nevertheless\r
+because the tests run quickly enough that the directory mtime is\r
+usually the same as the current time, so notmuch new does not update\r
+the mtime in the database (because more changes could occur in the\r
+same second).  However, when it occasionally did update the mtime in\r
+the database, the notmuch new call in this test would (correctly) skip\r
+"pass 2" of scanning ${MAIL_DIR}, causing it to skip the following\r
+expected lines:\r
+\r
+  (D) add_files_recursive, pass 2: explicitly ignoring ${MAIL_DIR}/.git\r
+  (D) add_files_recursive, pass 2: explicitly ignoring ${MAIL_DIR}/.ignored_hidden_file\r
+  (D) add_files_recursive, pass 2: explicitly ignoring ${MAIL_DIR}/ignored_file\r
+\r
+This patch fixes this problem by touching ${MAIL_DIR} to ensure it\r
+gets scanned and by rearranging the test to ensure the directories are\r
+touched immediately before the main notmuch new call in the test.\r
+---\r
+ test/new | 3 ++-\r
+ 1 file changed, 2 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/test/new b/test/new\r
+index 3eff2fe..f27423d 100755\r
+--- a/test/new\r
++++ b/test/new\r
+@@ -218,9 +218,10 @@ test_expect_equal "$output" "Added 1 new message to the database."\r
\r
+ test_begin_subtest "Ignore files and directories specified in new.ignore (multiple occurrences)"\r
+ notmuch config set new.ignore .git ignored_file .ignored_hidden_file\r
++notmuch new > /dev/null # ensure that files/folders will be printed in ASCII order.\r
+ touch "${MAIL_DIR}"/.git # change .git's mtime for notmuch new to rescan.\r
++touch "${MAIL_DIR}"      # likewise for MAIL_DIR\r
+ mkdir -p "${MAIL_DIR}"/one/two/three/.git\r
+-notmuch new > /dev/null # ensure that files/folders will be printed in ASCII order.\r
+ touch "${MAIL_DIR}"/{one,one/two,one/two/three}/ignored_file\r
+ output=$(NOTMUCH_NEW --debug 2>&1 | sort)\r
+ test_expect_equal "$output" \\r
+-- \r
+1.8.4.rc3\r
+\r