Re: [PATCH v3 05/13] test: Tool to build DB with specific version and features
authorJani Nikula <jani@nikula.org>
Sat, 23 Aug 2014 16:03:39 +0000 (19:03 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:04:16 +0000 (10:04 -0800)
c1/5e28a6d303912a6fff21f6c3453160f284d364 [new file with mode: 0644]

diff --git a/c1/5e28a6d303912a6fff21f6c3453160f284d364 b/c1/5e28a6d303912a6fff21f6c3453160f284d364
new file mode 100644 (file)
index 0000000..b547bfc
--- /dev/null
@@ -0,0 +1,163 @@
+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 15445431FBD\r
+       for <notmuch@notmuchmail.org>; Sat, 23 Aug 2014 09:03:47 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\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 UIzzwl5zq9tp for <notmuch@notmuchmail.org>;\r
+       Sat, 23 Aug 2014 09:03:42 -0700 (PDT)\r
+Received: from mail-we0-f170.google.com (mail-we0-f170.google.com\r
+       [74.125.82.170]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 3C583431FBC\r
+       for <notmuch@notmuchmail.org>; Sat, 23 Aug 2014 09:03:42 -0700 (PDT)\r
+Received: by mail-we0-f170.google.com with SMTP id w62so11719638wes.29\r
+       for <notmuch@notmuchmail.org>; Sat, 23 Aug 2014 09:03:41 -0700 (PDT)\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:subject:in-reply-to:references\r
+       :user-agent:date:message-id:mime-version:content-type;\r
+       bh=BKMTbWLiNR9mkBSowX0up322aYVs2qqtFNQSfecfmq8=;\r
+       b=bFAU38LFE4rtX0aArGO2VekX25890PRbD3PPxqUsd0yM8J0t4r93Y8XrTj2nfP29Xd\r
+       iCJSd//TY/akr+gLBrZuhELmbuhq2qFWeaGjfU7IVGqR1KnamQxjiASA1p8z+REcm61s\r
+       CmvbNtRTpFza3mLpCK+FnTGzeg+xOLKLHfaYhbbCeG0xHbSRQouzPTRw+SDaOQU4z3Eo\r
+       fCEPoCb4nsTishFYQV6CpkYeEKvv40FhX5matDo5xEp/tLQijuGsLPCDJCJD7QXZ0SsE\r
+       XQDYDowzvprPau9XGKVaZ5Fnw1TBkyJkdpahYj3gpaUufbqDwCNE2AKt6DWKSOqxKoH4\r
+       SW9w==\r
+X-Gm-Message-State:\r
+ ALoCoQlopNjU5jxy9u0MsUXS2MELMGWV9cGyYkDiWBAbzeecF87dc9OERHTLssGrOGnvzWz3j5jg\r
+X-Received: by 10.180.77.193 with SMTP id u1mr4701055wiw.45.1408809821066;\r
+       Sat, 23 Aug 2014 09:03:41 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw2-58c374-75.dhcp.inet.fi.\r
+       [88.195.116.75]) by mx.google.com with ESMTPSA id\r
+       jo10sm69515507wjc.41.2014.08.23.09.03.39 for <multiple recipients>\r
+       (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+       Sat, 23 Aug 2014 09:03:40 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v3 05/13] test: Tool to build DB with specific version\r
+       and     features\r
+In-Reply-To: <1406859003-11561-6-git-send-email-amdragon@mit.edu>\r
+References: <1406859003-11561-1-git-send-email-amdragon@mit.edu>\r
+       <1406859003-11561-6-git-send-email-amdragon@mit.edu>\r
+User-Agent: Notmuch/0.18.1+65~g9f0f30f (http://notmuchmail.org) Emacs/24.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Sat, 23 Aug 2014 19:03:39 +0300\r
+Message-ID: <87oavbjiqs.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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: Sat, 23 Aug 2014 16:03:47 -0000\r
+\r
+On Fri, 01 Aug 2014, Austin Clements <amdragon@MIT.EDU> wrote:\r
+> This will let us test basic version and feature handling.\r
+\r
+LGTM.\r
+\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
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r