--- /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 9D02A429E29\r
+ for <notmuch@notmuchmail.org>; Thu, 31 Jul 2014 19:10:35 -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 ntc7rUpMUqrz for <notmuch@notmuchmail.org>;\r
+ Thu, 31 Jul 2014 19:10:29 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-3.mit.edu (dmz-mailsec-scanner-3.mit.edu\r
+ [18.9.25.14])\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 94F13431FC3\r
+ for <notmuch@notmuchmail.org>; Thu, 31 Jul 2014 19:10:13 -0700 (PDT)\r
+X-AuditID: 1209190e-f79946d000007db1-3a-53daf7036d8d\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+ (using TLS with cipher AES256-SHA (256/256 bits))\r
+ (Client did not present a certificate)\r
+ by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 43.DF.32177.307FAD35; Thu, 31 Jul 2014 22:10:11 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id s712AA4e008864; \r
+ Thu, 31 Jul 2014 22:10:11 -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 s712A6Hj029979\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Thu, 31 Jul 2014 22:10:10 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1XD2IH-00033f-W6; Thu, 31 Jul 2014 22:10:05 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 05/13] test: Tool to build DB with specific version and\r
+ features\r
+Date: Thu, 31 Jul 2014 22:09:55 -0400\r
+Message-Id: <1406859003-11561-6-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 2.0.0\r
+In-Reply-To: <1406859003-11561-1-git-send-email-amdragon@mit.edu>\r
+References: <1406859003-11561-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrLIsWRmVeSWpSXmKPExsUixCmqrcv8/VawwYV3shar5/JYXL85k9mB\r
+ yWPnrLvsHs9W3WIOYIrisklJzcksSy3St0vgyuhbeYe5YKpQxbHdO5gbGK/wdTFyckgImEj8\r
+ /32IFcIWk7hwbz1bFyMXh5DAbCaJr5++s0A4Gxklbh26zATh3GGSWP/nAjOEM5dR4s6Bc0wg\r
+ /WwCGhLb9i9nBLFFBKQldt6dDTaXWcBR4vP+RWwgtrBAsMS7hhnMIDaLgKrEuUPvwWp4BRwk\r
+ 3t95yQJxh5xEw41PYPWcQL3//y0AqxECqmk9vZV5AiP/AkaGVYyyKblVurmJmTnFqcm6xcmJ\r
+ eXmpRbrGermZJXqpKaWbGMGhJMm3g/HrQaVDjAIcjEo8vDPCbwULsSaWFVfmHmKU5GBSEuW1\r
+ +QgU4kvKT6nMSCzOiC8qzUktPsQowcGsJML78gNQjjclsbIqtSgfJiXNwaIkzvvW2ipYSCA9\r
+ sSQ1OzW1ILUIJivDwaEkwXvmK1CjYFFqempFWmZOCUKaiYMTZDgP0HChbyDDiwsSc4sz0yHy\r
+ pxgVpcR594A0C4AkMkrz4Hphsf6KURzoFWHehyBVPMA0Adf9CmgwE9Dg57eugwwuSURISTUw\r
+ 1rWor1Ct8855wrlzFteLIxVaGfqipwTELH9EGNuvWzDfJaBoEYf3o8oZmmxFKyU5PRtd58hv\r
+ m6/y8IV3lPWdqjV7l/dn/MgMi7H45pYkHbnf299a49cx00eOR+fFin9cJWzCvsGVeSGj1ZHT\r
+ LNNylyQFi7+9/9E7+M/ZRYpf0sIdmI0v/61UYinOSDTUYi4qTgQAV4B4vNACAAA=\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, 01 Aug 2014 02:10:36 -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