--- /dev/null
+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 E91BB431FAE\r
+ for <notmuch@notmuchmail.org>; Mon, 25 Aug 2014 10:28:48 -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 dsSTlM1aWbI2 for <notmuch@notmuchmail.org>;\r
+ Mon, 25 Aug 2014 10:28:44 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-6.mit.edu (dmz-mailsec-scanner-6.mit.edu\r
+ [18.7.68.35])\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 692D9431FBC\r
+ for <notmuch@notmuchmail.org>; Mon, 25 Aug 2014 10:28:17 -0700 (PDT)\r
+X-AuditID: 12074423-f799d6d00000337c-42-53fb7230f575\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+ (using TLS with cipher AES256-SHA (256/256 bits))\r
+ (Client did not present a certificate)\r
+ by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 4B.C0.13180.0327BF35; Mon, 25 Aug 2014 13:28:16 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id s7PHQENf001077; \r
+ Mon, 25 Aug 2014 13:26:15 -0400\r
+Received: from drake.dyndns.org (31-35-14.wireless.csail.mit.edu\r
+ [128.31.35.14]) (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 s7PHQCJQ029609\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Mon, 25 Aug 2014 13:26:13 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1XLy1z-0003jP-U8; Mon, 25 Aug 2014 13:26:11 -0400\r
+From: Austin Clements <amdragon@mit.edu>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v4 03/11] test: Tool to build DB with specific version and\r
+ features\r
+Date: Mon, 25 Aug 2014 13:26:01 -0400\r
+Message-Id: <1408987569-14146-4-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 2.0.0\r
+In-Reply-To: <1408987569-14146-1-git-send-email-amdragon@mit.edu>\r
+References: <1408987569-14146-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFjrOIsWRmVeSWpSXmKPExsUixG6nrmtQ9DvY4O8MS4sbrd2MFk3TnS2u\r
+ 35zJ7MDscev+a3aPZ6tuMXtsOfSeOYA5issmJTUnsyy1SN8ugSujb+Ud5oKpQhXHdu9gbmC8\r
+ wtfFyMkhIWAi8eLtchYIW0ziwr31bF2MXBxCArOZJCbO64NyNjJKrF3YzQrhHGOSOHd4DlRm\r
+ LqPEh7ZPzCD9bAIaEr9vLWYCsUUEpCV23p3NCmIzC3hJLLvQD2YLCwRLbOxbxQ5iswioSvRN\r
+ XARm8wo4SCw50gt1h5xEw41PbCA2p4CjxPSFs8FmCgHVfL98nnkCI/8CRoZVjLIpuVW6uYmZ\r
+ OcWpybrFyYl5ealFumZ6uZkleqkppZsYweHloryD8c9BpUOMAhyMSjy8N+J/BwuxJpYVV+Ye\r
+ YpTkYFIS5Z2WDxTiS8pPqcxILM6ILyrNSS0+xCjBwawkwtsMkuNNSaysSi3Kh0lJc7AoifO+\r
+ tbYKFhJITyxJzU5NLUgtgsnKcHAoSfDmFgA1ChalpqdWpGXmlCCkmTg4QYbzAA2PB6nhLS5I\r
+ zC3OTIfIn2JUlBLnXQuyVQAkkVGaB9cLi/9XjOJArwjzHgVp5wGmDrjuV0CDmYAGm/b8BBlc\r
+ koiQkmpgVL71Xr580uKoifuWX7K4o+98a/Kpw7eaGj/Z+UmGsx59vMj9HNuz/401jTN/bP80\r
+ JdW05aDPU3ahX/vmRpY0VtSnzj4p3xu8a3nMj/TI/WrSC789VJzCOS184d2j92qDH+0+s6Es\r
+ 3PLAYo37cybHiUzsOvKGnVvtaNP99CXNb7+L/lniwxekmKrEUpyRaKjFXFScCAANnDXA2gIA AA==\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, 25 Aug 2014 17:28:49 -0000\r
+\r
+This will let us test basic version and feature handling.\r
+---\r
+ test/.gitignore | 1 +\r
+ test/Makefile.local | 4 ++++\r
+ test/make-db-version.cc | 35 +++++++++++++++++++++++++++++++++++\r
+ 3 files changed, 40 insertions(+)\r
+ create mode 100644 test/make-db-version.cc\r
+\r
+diff --git a/test/.gitignore b/test/.gitignore\r
+index b3b706d..0f7d5bf 100644\r
+--- a/test/.gitignore\r
++++ b/test/.gitignore\r
+@@ -5,5 +5,6 @@ parse-time\r
+ random-corpus\r
+ smtp-dummy\r
+ symbol-test\r
++make-db-version\r
+ test-results\r
+ tmp.*\r
+diff --git a/test/Makefile.local b/test/Makefile.local\r
+index 916dd0b..a2d58fc 100644\r
+--- a/test/Makefile.local\r
++++ b/test/Makefile.local\r
+@@ -35,6 +35,9 @@ $(dir)/symbol-test: $(dir)/symbol-test.o lib/$(LINKER_NAME)\r
+ $(dir)/parse-time: $(dir)/parse-time.o parse-time-string/parse-time-string.o\r
+ $(call quiet,CC) $^ -o $@\r
+ \r
++$(dir)/make-db-version: $(dir)/make-db-version.o\r
++ $(call quiet,CXX) $^ -o $@ $(XAPIAN_LDFLAGS)\r
++\r
+ .PHONY: test check\r
+ \r
+ test_main_srcs=$(dir)/arg-test.c \\r
+@@ -43,6 +46,7 @@ test_main_srcs=$(dir)/arg-test.c \\r
+ $(dir)/parse-time.c \\r
+ $(dir)/smtp-dummy.c \\r
+ $(dir)/symbol-test.cc \\r
++ $(dir)/make-db-version.cc \\r
+ \r
+ test_srcs=$(test_main_srcs) $(dir)/database-test.c\r
+ \r
+diff --git a/test/make-db-version.cc b/test/make-db-version.cc\r
+new file mode 100644\r
+index 0000000..fa80cac\r
+--- /dev/null\r
++++ b/test/make-db-version.cc\r
+@@ -0,0 +1,35 @@\r
++/* Create an empty notmuch database with a specific version and\r
++ * features. */\r
++\r
++#include <stdio.h>\r
++#include <stdlib.h>\r
++#include <sys/stat.h>\r
++#include <sys/types.h>\r
++\r
++#include <xapian.h>\r
++\r
++int main(int argc, char **argv)\r
++{\r
++ if (argc != 4) {\r
++ fprintf (stderr, "Usage: %s mailpath version features\n", argv[0]);\r
++ exit (2);\r
++ }\r
++\r
++ std::string nmpath (argv[1]);\r
++ nmpath += "/.notmuch";\r
++ if (mkdir (nmpath.c_str (), 0777) < 0) {\r
++ perror (("failed to create " + nmpath).c_str ());\r
++ exit (1);\r
++ }\r
++\r
++ try {\r
++ Xapian::WritableDatabase db (\r
++ nmpath + "/xapian", Xapian::DB_CREATE_OR_OPEN);\r
++ db.set_metadata ("version", argv[2]);\r
++ db.set_metadata ("features", argv[3]);\r
++ db.commit ();\r
++ } catch (const Xapian::Error &e) {\r
++ fprintf (stderr, "%s\n", e.get_description ().c_str ());\r
++ exit (1);\r
++ }\r
++}\r
+-- \r
+2.0.0\r
+\r