--- /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 135E3431FC7\r
+ for <notmuch@notmuchmail.org>; Sat, 26 Jul 2014 20:53:30 -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 4ReiTNrmX+9K for <notmuch@notmuchmail.org>;\r
+ Sat, 26 Jul 2014 20:53:24 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-8.mit.edu (dmz-mailsec-scanner-8.mit.edu\r
+ [18.7.68.37])\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 76C0E431FCB\r
+ for <notmuch@notmuchmail.org>; Sat, 26 Jul 2014 20:53:08 -0700 (PDT)\r
+X-AuditID: 12074425-f79766d000006da8-b9-53d477a051ef\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-8.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id C0.5E.28072.0A774D35; Sat, 26 Jul 2014 23:53:04 -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 s6R3r20P009547; \r
+ Sat, 26 Jul 2014 23:53:03 -0400\r
+Received: from drake.dyndns.org\r
+ (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+ [216.15.114.40]) (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 s6R3r05D016398\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Sat, 26 Jul 2014 23:53:02 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1XBFW8-00051L-AV; Sat, 26 Jul 2014 23:53:00 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 06/14] test: Tool to build DB with specific version and\r
+ features\r
+Date: Sat, 26 Jul 2014 23:52:45 -0400\r
+Message-Id: <1406433173-19169-7-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 2.0.0\r
+In-Reply-To: <1406433173-19169-1-git-send-email-amdragon@mit.edu>\r
+References: <1406433173-19169-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrEIsWRmVeSWpSXmKPExsUixG6nrrug/EqwweOr7BbXb85kdmD0eLbq\r
+ FnMAYxSXTUpqTmZZapG+XQJXRt/KO8wFU4Uqju3ewdzAeIWvi5GTQ0LARGLO9f9MELaYxIV7\r
+ 69m6GLk4hARmM0ms+ncfytnIKLH8wy0mCOcOk8T+C5/ZIZy5jBJbl2xkBOlnE9CQ2LZ/OZgt\r
+ IiAtsfPubNYuRg4OZgE1iT9dKiBhYYEAid2LmphBbBYBVYm9l1+BlfMKOEi0bD/GBnGGnETD\r
+ jU9gNqeAo8TxZyfYQMYIAdXcupQ4gZF/ASPDKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl0LvdzM\r
+ Er3UlNJNjOCgcVHdwTjhkNIhRgEORiUeXgGWK8FCrIllxZW5hxglOZiURHn3mwGF+JLyUyoz\r
+ Eosz4otKc1KLDzFKcDArifAKFQPleFMSK6tSi/JhUtIcLErivG+trYKFBNITS1KzU1MLUotg\r
+ sjIcHEoSvF9LgRoFi1LTUyvSMnNKENJMHJwgw3mAhm8AqeEtLkjMLc5Mh8ifYlSUEuf9BZIQ\r
+ AElklObB9cKi+hWjONArwrysZUBVPMCEANf9CmgwE9BgFv/LIINLEhFSUg2MK7+9P1e5o3fJ\r
+ jvY9JzRS/l1IdLkddHuVp/c6teTGDW6TVuu45iw7s5ShdN9szrVH4s8H36hcHnqCR/K7zetT\r
+ RyeLb/i34+XpQGf/JyHSxcJ7Lb+eXrMwP/6ILM8VT3Nz96n379wOvFS5iikuc8tThuk/dJ8b\r
+ zjgr+TXLQ+xFm3T+sZoJrRalFkosxRmJhlrMRcWJAHrqYSLFAgAA\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: Sun, 27 Jul 2014 03:53:30 -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