--- /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 3FF54429E29\r
+ for <notmuch@notmuchmail.org>; Tue, 1 Apr 2014 18:17:18 -0700 (PDT)\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 JZjARqXI-fLB for <notmuch@notmuchmail.org>;\r
+ Tue, 1 Apr 2014 18:17:16 -0700 (PDT)\r
+Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
+ (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 17812431E64\r
+ for <notmuch@notmuchmail.org>; Tue, 1 Apr 2014 18:16:51 -0700 (PDT)\r
+Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1WV9nO-00073S-OC; Tue, 01 Apr 2014 22:16:50 -0300\r
+Received: (nullmailer pid 18509 invoked by uid 1000); Wed, 02 Apr 2014\r
+ 01:16:27 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [Patch v5 6/6] test: verify tag backup generated by database upgrade\r
+Date: Tue, 1 Apr 2014 22:16:21 -0300\r
+Message-Id: <1396401381-18128-7-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.9.0\r
+In-Reply-To: <1396401381-18128-1-git-send-email-david@tethera.net>\r
+References: <1396401381-18128-1-git-send-email-david@tethera.net>\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, 02 Apr 2014 01:17:18 -0000\r
+\r
+'pre upgrade dump' is not much of a test, but at least this way we get\r
+somewhat sensible behaviour if it fails.\r
+---\r
+ test/T530-upgrade.sh | 6 ++++++\r
+ 1 file changed, 6 insertions(+)\r
+\r
+diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh\r
+index d46e3d1..7a68ddf 100755\r
+--- a/test/T530-upgrade.sh\r
++++ b/test/T530-upgrade.sh\r
+@@ -25,6 +25,8 @@ test_begin_subtest "path: search does not work with old database version"\r
+ output=$(notmuch search path:foo)\r
+ test_expect_equal "$output" ""\r
+ \r
++test_expect_success 'pre upgrade dump' 'notmuch dump | sort > pre-upgrade-dump'\r
++\r
+ test_begin_subtest "database upgrade from format version 1"\r
+ output=$(notmuch new | sed -e 's/^Backing up tags to .*$/Backing up tags to FILENAME/')\r
+ test_expect_equal "$output" "\\r
+@@ -34,6 +36,10 @@ Backing up tags to FILENAME\r
+ Your notmuch database has now been upgraded to database format version 2.\r
+ No new mail."\r
+ \r
++test_begin_subtest "tag backup matches pre-upgrade dump"\r
++gunzip -c ${MAIL_DIR}/.notmuch/backup-*.gz | sort > backup-dump\r
++test_expect_equal_file pre-upgrade-dump backup-dump\r
++\r
+ test_begin_subtest "folder: no longer matches in the middle of path"\r
+ output=$(notmuch search folder:baz)\r
+ test_expect_equal "$output" ""\r
+-- \r
+1.9.0\r
+\r