--- /dev/null
+Return-Path: <aclements@csail.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 181DB431FB6\r
+ for <notmuch@notmuchmail.org>; Mon, 6 Oct 2014 16:18:06 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_MED=-2.3] 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 O8EZD2g24cdn for <notmuch@notmuchmail.org>;\r
+ Mon, 6 Oct 2014 16:18:02 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-1.mit.edu (dmz-mailsec-scanner-1.mit.edu\r
+ [18.9.25.12])\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 16EDC431FBC\r
+ for <notmuch@notmuchmail.org>; Mon, 6 Oct 2014 16:17:37 -0700 (PDT)\r
+X-AuditID: 1209190c-f795e6d000006c66-2b-543323104e82\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+ (using TLS with cipher AES256-SHA (256/256 bits))\r
+ (Client did not present a certificate)\r
+ by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 59.75.27750.01323345; Mon, 6 Oct 2014 19:17:36 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id s96NHPoT025205; \r
+ Mon, 6 Oct 2014 19:17:25 -0400\r
+Received: from drake.dyndns.org ([12.185.136.2]) (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 s96NHMl4014475\r
+ (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT);\r
+ Mon, 6 Oct 2014 19:17:24 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.84)\r
+ (envelope-from <aclements@csail.mit.edu>)\r
+ id 1XbHWs-0001Jz-Bo; Mon, 06 Oct 2014 17:17:22 -0600\r
+From: Austin Clements <aclements@csail.mit.edu>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 11/12] test: Test upgrade to ghost messages feature\r
+Date: Mon, 6 Oct 2014 17:17:17 -0600\r
+Message-Id: <1412637438-4821-12-git-send-email-aclements@csail.mit.edu>\r
+X-Mailer: git-send-email 2.1.0\r
+In-Reply-To: <1412637438-4821-1-git-send-email-aclements@csail.mit.edu>\r
+References: <1412637438-4821-1-git-send-email-aclements@csail.mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrHIsWRmVeSWpSXmKPExsUixG6noiugbBxisHSNgMWN1m5Gi+s3ZzI7\r
+ MHk8W3WL2WPLoffMAUxRXDYpqTmZZalF+nYJXBmH/11iLzjGVdHd0crcwPieo4uRk0NCwERi\r
+ y4pFjBC2mMSFe+vZuhi5OIQEZjNJ7Fv/nxHC2cAo8XnyMShnKZPEhc8XWCCcJYwSk+a9YAHp\r
+ ZxPQl1ixdhIriC0iIC2x8+5sMJtZwEHi7aSnYDuEBdwk7szoB6tnEVCV+NS9hA3E5hVwlzjd\r
+ NZsN4g45iQ27/4PVcwLF11yZDDZHCKj3+c+nLBMY+RcwMqxilE3JrdLNTczMKU5N1i1OTszL\r
+ Sy3SNdTLzSzRS00p3cQICiZOSZ4djG8OKh1iFOBgVOLhjdhhGCLEmlhWXJl7iFGSg0lJlHcO\r
+ u3GIEF9SfkplRmJxRnxRaU5q8SFGCQ5mJRFert9GIUK8KYmVValF+TApaQ4WJXHeTT/4QoQE\r
+ 0hNLUrNTUwtSi2CyMhwcShK8vxWBhgoWpaanVqRl5pQgpJk4OEGG8wAN/wdSw1tckJhbnJkO\r
+ kT/FqCglzhsMkhAASWSU5sH1wqL9FaM40CvCvOJKQFU8wEQB1/0KaDAT0GDTOfogg0sSEVJS\r
+ DYzpPrd2NYpMUS/Pn8bIuazcnDueJ1xrvks/05NP/fkWxb2CfY07W/K82abuZm/jdnt02aU0\r
+ 48OvDeYF0V/qIncz3L8csfOPitCZ9+XivsvPvn8ba8Z6eT13xXfl+D9tZqFqrCfqi5ceUc1L\r
+ fLl79qul/9N/b1p1OXTBD6dmY+m3LcU2l803uSuxFGckGmoxFxUnAgCZRM7e0QIAAA==\r
+Cc: Austin Clements <aclements@csail.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: Mon, 06 Oct 2014 23:18:06 -0000\r
+\r
+---\r
+ test/T530-upgrade.sh | 21 +++++++++++++++++++++\r
+ 1 file changed, 21 insertions(+)\r
+\r
+diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh\r
+index c4c4ac8..6b42a69 100755\r
+--- a/test/T530-upgrade.sh\r
++++ b/test/T530-upgrade.sh\r
+@@ -116,4 +116,25 @@ MAIL_DIR/bar/new/21:2,\r
+ MAIL_DIR/bar/new/22:2,\r
+ MAIL_DIR/cur/51:2,"\r
+ \r
++# Ghost messages are difficult to test since they're nearly invisible.\r
++# However, if the upgrade works correctly, the ghost message should\r
++# retain the right thread ID even if all of the original messages in\r
++# the thread are deleted. That's what we test. This won't detect if\r
++# the upgrade just plain didn't happen, but it should detect if\r
++# something went wrong.\r
++test_begin_subtest "ghost message retains thread ID"\r
++# Upgrade database\r
++notmuch new\r
++# Get thread ID of real message\r
++thread=$(notmuch search --output=threads id:4EFC743A.3060609@april.org)\r
++# Delete all real messages in that thread\r
++rm $(notmuch search --output=files $thread)\r
++notmuch new\r
++# "Deliver" ghost message\r
++add_message '[subject]=Ghost' '[id]=4EFC3931.6030007@april.org'\r
++# If the ghost upgrade worked, the new message should be attached to\r
++# the existing thread ID.\r
++nthread=$(notmuch search --output=threads id:4EFC3931.6030007@april.org)\r
++test_expect_equal "$thread" "$nthread"\r
++\r
+ test_done\r
+-- \r
+2.1.0\r
+\r