--- /dev/null
+Return-Path: <jani@nikula.org>\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 723B4431FCB\r
+ for <notmuch@notmuchmail.org>; Thu, 9 Jan 2014 23:33:58 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\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 kStYf5CJOvI2 for <notmuch@notmuchmail.org>;\r
+ Thu, 9 Jan 2014 23:32:08 -0800 (PST)\r
+Received: from mail-ee0-f48.google.com (mail-ee0-f48.google.com\r
+ [74.125.83.48]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 5235D431FC3 for <notmuch@notmuchmail.org>; Thu, 9 Jan 2014 23:32:08 -0800\r
+ (PST)\r
+Received: by mail-ee0-f48.google.com with SMTP id t10so27850eei.35\r
+ for <notmuch@notmuchmail.org>; Thu, 09 Jan 2014 23:32:07 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+ :references:in-reply-to:references;\r
+ bh=An4TGZjqieWpkGHUmhKr7HBmewLaYXVs2hRSMJCSZhg=;\r
+ b=iAUEJWK+6E+lRfWjhSmZFHY0zN1OIB/AQFv7PD93EvGZ5qY7kukmkRZhZ4oOrBw8ky\r
+ 0NE7UNa8Q4h9HttzxuRPyfBxjr6rt1IZZ5QhhwbcRrm8hWX6hhVW06xypwAJBfiCLliP\r
+ haAYfN+B+sBxmzmcOLWDoBupYtw+72y4ApX1bqWonVgVpRN1aGykDz2jc7SYuCeO3njX\r
+ ZY3zvn6V9ZxOQsvw+m+P6CqyDrWhQ2xvhSM5pTXSPycVQKnuSkRPuVFFljfjWfiSdHzW\r
+ byOdohYrSRwc/uJUy7DC4qp3avYavTcjaNkNuaAGj+/cdcgMAjSJ9TY/yCaqnclBdM2B\r
+ MWGg==\r
+X-Gm-Message-State:\r
+ ALoCoQnjRkxj1/t05ZSci99a4Zi+9wiDl+70UiEOkMkJIyLPyIhulBvLHXaSjgL3kjFW1d3X8UEV\r
+X-Received: by 10.14.113.199 with SMTP id a47mr5617114eeh.41.1389305949892;\r
+ Thu, 09 Jan 2014 14:19:09 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+ [88.195.111.91])\r
+ by mx.google.com with ESMTPSA id 4sm9382887eed.14.2014.01.09.14.19.08\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Thu, 09 Jan 2014 14:19:09 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 5/5] test: add database upgrade test from format version 1\r
+Date: Fri, 10 Jan 2014 00:18:36 +0200\r
+Message-Id:\r
+ <33ae92e21bfeea0e21ad818d011fa4f000aa837c.1389304779.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.8.5.2\r
+In-Reply-To: <cover.1389304779.git.jani@nikula.org>\r
+References: <cover.1389304779.git.jani@nikula.org>\r
+In-Reply-To: <cover.1389304779.git.jani@nikula.org>\r
+References: <cover.1389304779.git.jani@nikula.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, 10 Jan 2014 07:33:59 -0000\r
+\r
+---\r
+ test/notmuch-test | 1 +\r
+ test/upgrade | 25 +++++++++++++++++++++++++\r
+ 2 files changed, 26 insertions(+)\r
+ create mode 100755 test/upgrade\r
+\r
+diff --git a/test/notmuch-test b/test/notmuch-test\r
+index d6fdd3a..68c8ad9 100755\r
+--- a/test/notmuch-test\r
++++ b/test/notmuch-test\r
+@@ -69,6 +69,7 @@ TESTS="\r
+ parse-time-string\r
+ search-date\r
+ thread-replies\r
++ upgrade\r
+ "\r
+ TESTS=${NOTMUCH_TESTS:=$TESTS}\r
+ \r
+diff --git a/test/upgrade b/test/upgrade\r
+new file mode 100755\r
+index 0000000..edee35d\r
+--- /dev/null\r
++++ b/test/upgrade\r
+@@ -0,0 +1,25 @@\r
++#!/usr/bin/env bash\r
++test_description="database upgrade"\r
++\r
++. ./test-lib.sh\r
++\r
++tar zxf $TEST_DIRECTORY/test-databases/database-v1.tar.gz -C ${MAIL_DIR} --strip-components=1\r
++\r
++# XXX: Test new notmuch with old database in read-only mode\r
++\r
++test_begin_subtest "database upgrade from format version 1"\r
++output=$(notmuch new)\r
++test_expect_equal "$output" "\\r
++Welcome to a new version of notmuch! Your database will now be upgraded.\r
++Your notmuch database has now been upgraded to database format version 2.\r
++No new mail."\r
++\r
++# XXX: Add some meaningful tests on the upgraded database, testing the\r
++# things that have been upgraded. For folder search, this means\r
++# actually having folders in the corpus.\r
++\r
++test_begin_subtest "Top level folder"\r
++output=$(notmuch search folder:'""' | notmuch_search_sanitize)\r
++test_expect_equal "$output" ""\r
++\r
++test_done\r
+-- \r
+1.8.5.2\r
+\r