From e89326c5e90c42ea82744f4c495cdfc2c47a88d3 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Sat, 23 Aug 2014 19:03:39 +0300 Subject: [PATCH] Re: [PATCH v3 05/13] test: Tool to build DB with specific version and features --- c1/5e28a6d303912a6fff21f6c3453160f284d364 | 163 ++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 c1/5e28a6d303912a6fff21f6c3453160f284d364 diff --git a/c1/5e28a6d303912a6fff21f6c3453160f284d364 b/c1/5e28a6d303912a6fff21f6c3453160f284d364 new file mode 100644 index 000000000..b547bfcd0 --- /dev/null +++ b/c1/5e28a6d303912a6fff21f6c3453160f284d364 @@ -0,0 +1,163 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 15445431FBD + for ; Sat, 23 Aug 2014 09:03:47 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id UIzzwl5zq9tp for ; + Sat, 23 Aug 2014 09:03:42 -0700 (PDT) +Received: from mail-we0-f170.google.com (mail-we0-f170.google.com + [74.125.82.170]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 3C583431FBC + for ; Sat, 23 Aug 2014 09:03:42 -0700 (PDT) +Received: by mail-we0-f170.google.com with SMTP id w62so11719638wes.29 + for ; Sat, 23 Aug 2014 09:03:41 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:subject:in-reply-to:references + :user-agent:date:message-id:mime-version:content-type; + bh=BKMTbWLiNR9mkBSowX0up322aYVs2qqtFNQSfecfmq8=; + b=bFAU38LFE4rtX0aArGO2VekX25890PRbD3PPxqUsd0yM8J0t4r93Y8XrTj2nfP29Xd + iCJSd//TY/akr+gLBrZuhELmbuhq2qFWeaGjfU7IVGqR1KnamQxjiASA1p8z+REcm61s + CmvbNtRTpFza3mLpCK+FnTGzeg+xOLKLHfaYhbbCeG0xHbSRQouzPTRw+SDaOQU4z3Eo + fCEPoCb4nsTishFYQV6CpkYeEKvv40FhX5matDo5xEp/tLQijuGsLPCDJCJD7QXZ0SsE + XQDYDowzvprPau9XGKVaZ5Fnw1TBkyJkdpahYj3gpaUufbqDwCNE2AKt6DWKSOqxKoH4 + SW9w== +X-Gm-Message-State: + ALoCoQlopNjU5jxy9u0MsUXS2MELMGWV9cGyYkDiWBAbzeecF87dc9OERHTLssGrOGnvzWz3j5jg +X-Received: by 10.180.77.193 with SMTP id u1mr4701055wiw.45.1408809821066; + Sat, 23 Aug 2014 09:03:41 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw2-58c374-75.dhcp.inet.fi. + [88.195.116.75]) by mx.google.com with ESMTPSA id + jo10sm69515507wjc.41.2014.08.23.09.03.39 for + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sat, 23 Aug 2014 09:03:40 -0700 (PDT) +From: Jani Nikula +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH v3 05/13] test: Tool to build DB with specific version + and features +In-Reply-To: <1406859003-11561-6-git-send-email-amdragon@mit.edu> +References: <1406859003-11561-1-git-send-email-amdragon@mit.edu> + <1406859003-11561-6-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.18.1+65~g9f0f30f (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-pc-linux-gnu) +Date: Sat, 23 Aug 2014 19:03:39 +0300 +Message-ID: <87oavbjiqs.fsf@nikula.org> +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sat, 23 Aug 2014 16:03:47 -0000 + +On Fri, 01 Aug 2014, Austin Clements wrote: +> This will let us test basic version and feature handling. + +LGTM. + +> --- +> test/.gitignore | 1 + +> test/Makefile.local | 4 ++++ +> test/make-db-version.cc | 35 +++++++++++++++++++++++++++++++++++ +> 3 files changed, 40 insertions(+) +> create mode 100644 test/make-db-version.cc +> +> diff --git a/test/.gitignore b/test/.gitignore +> index b3b706d..0f7d5bf 100644 +> --- a/test/.gitignore +> +++ b/test/.gitignore +> @@ -5,5 +5,6 @@ parse-time +> random-corpus +> smtp-dummy +> symbol-test +> +make-db-version +> test-results +> tmp.* +> diff --git a/test/Makefile.local b/test/Makefile.local +> index 916dd0b..a2d58fc 100644 +> --- a/test/Makefile.local +> +++ b/test/Makefile.local +> @@ -35,6 +35,9 @@ $(dir)/symbol-test: $(dir)/symbol-test.o lib/$(LINKER_NAME) +> $(dir)/parse-time: $(dir)/parse-time.o parse-time-string/parse-time-string.o +> $(call quiet,CC) $^ -o $@ +> +> +$(dir)/make-db-version: $(dir)/make-db-version.o +> + $(call quiet,CXX) $^ -o $@ $(XAPIAN_LDFLAGS) +> + +> .PHONY: test check +> +> test_main_srcs=$(dir)/arg-test.c \ +> @@ -43,6 +46,7 @@ test_main_srcs=$(dir)/arg-test.c \ +> $(dir)/parse-time.c \ +> $(dir)/smtp-dummy.c \ +> $(dir)/symbol-test.cc \ +> + $(dir)/make-db-version.cc \ +> +> test_srcs=$(test_main_srcs) $(dir)/database-test.c +> +> diff --git a/test/make-db-version.cc b/test/make-db-version.cc +> new file mode 100644 +> index 0000000..fa80cac +> --- /dev/null +> +++ b/test/make-db-version.cc +> @@ -0,0 +1,35 @@ +> +/* Create an empty notmuch database with a specific version and +> + * features. */ +> + +> +#include +> +#include +> +#include +> +#include +> + +> +#include +> + +> +int main(int argc, char **argv) +> +{ +> + if (argc != 4) { +> + fprintf (stderr, "Usage: %s mailpath version features\n", argv[0]); +> + exit (2); +> + } +> + +> + std::string nmpath (argv[1]); +> + nmpath += "/.notmuch"; +> + if (mkdir (nmpath.c_str (), 0777) < 0) { +> + perror (("failed to create " + nmpath).c_str ()); +> + exit (1); +> + } +> + +> + try { +> + Xapian::WritableDatabase db ( +> + nmpath + "/xapian", Xapian::DB_CREATE_OR_OPEN); +> + db.set_metadata ("version", argv[2]); +> + db.set_metadata ("features", argv[3]); +> + db.commit (); +> + } catch (const Xapian::Error &e) { +> + fprintf (stderr, "%s\n", e.get_description ().c_str ()); +> + exit (1); +> + } +> +} +> -- +> 2.0.0 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2