--- /dev/null
+Return-Path: <bremner@tethera.net>\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 ABE86431FAE\r
+ for <notmuch@notmuchmail.org>; Thu, 1 Mar 2012 18:35:28 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 gUu2nxbdLiIj for <notmuch@notmuchmail.org>;\r
+ Thu, 1 Mar 2012 18:35:28 -0800 (PST)\r
+Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])\r
+ (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id A3EDA431FD7\r
+ for <notmuch@notmuchmail.org>; Thu, 1 Mar 2012 18:35:27 -0800 (PST)\r
+Received: from fctnnbsc30w-142166230117.dhcp-dynamic.fibreop.nb.bellaliant.net\r
+ ([142.166.230.117] helo=zancas.localnet)\r
+ by tesseract.cs.unb.ca with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32)\r
+ (Exim 4.72) (envelope-from <bremner@tethera.net>)\r
+ id 1S3IL7-00085q-Ux; Thu, 01 Mar 2012 22:35:26 -0400\r
+Received: from bremner by zancas.localnet with local (Exim 4.77)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1S3IL2-0001ur-MX; Thu, 01 Mar 2012 22:35:20 -0400\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] test: utility function to add a pre-generated message to\r
+ the database.\r
+Date: Thu, 1 Mar 2012 22:35:07 -0400\r
+Message-Id: <1330655708-7318-2-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.7.9\r
+In-Reply-To: <1330655708-7318-1-git-send-email-david@tethera.net>\r
+References: <20120301215738.GA7466@mit.edu>\r
+ <1330655708-7318-1-git-send-email-david@tethera.net>\r
+X-Spam_bar: -\r
+Cc: David Bremner <bremner@debian.org>\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: Fri, 02 Mar 2012 02:35:28 -0000\r
+\r
+From: David Bremner <bremner@debian.org>\r
+\r
+For various "nasty" messages, it is easier to ship a message rather\r
+than try to generate a message which causes a failure.\r
+---\r
+ test/test-lib.sh | 15 +++++++++++++++\r
+ 1 files changed, 15 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index 2781506..17d0e48 100644\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -376,6 +376,21 @@ ${template[body]}\r
+ EOF\r
+ }\r
+ \r
++# Add an existing message to the notmuch database.\r
++#\r
++# expects a message on stdin.\r
++#\r
++# uses the variable gen_msg_cnt from generate_message.\r
++\r
++add_rfc822_message ()\r
++{\r
++ gen_msg_cnt=$((gen_msg_cnt + 1))\r
++ gen_msg_name="msg-$(printf "%03d" $gen_msg_cnt)"\r
++ gen_msg_filename="${MAIL_DIR}/$gen_msg_name"\r
++ cat >$gen_msg_filename\r
++ notmuch new > /dev/null\r
++}\r
++\r
+ # Generate a new message and add it to the database.\r
+ #\r
+ # All of the arguments and return values supported by generate_message\r
+-- \r
+1.7.9\r
+\r