unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org
Subject: Re: [PATCH v3 05/13] test: Tool to build DB with specific version and	features
Date: Sat, 23 Aug 2014 19:03:39 +0300	[thread overview]
Message-ID: <87oavbjiqs.fsf@nikula.org> (raw)
In-Reply-To: <1406859003-11561-6-git-send-email-amdragon@mit.edu>

On Fri, 01 Aug 2014, Austin Clements <amdragon@MIT.EDU> 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 <stdio.h>
> +#include <stdlib.h>
> +#include <sys/stat.h>
> +#include <sys/types.h>
> +
> +#include <xapian.h>
> +
> +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

  reply	other threads:[~2014-08-23 16:03 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01  2:09 [PATCH v3 00/13] Implement and use database "features" Austin Clements
2014-08-01  2:09 ` [PATCH v3 01/13] test: Include generated dependencies for test sources Austin Clements
2014-08-01  2:09 ` [PATCH v3 02/13] util: Const version of strtok_len Austin Clements
2014-08-06 13:43   ` David Bremner
2014-08-01  2:09 ` [PATCH v3 03/13] new: Don't report version after upgrade Austin Clements
2014-08-23 15:39   ` Jani Nikula
2014-08-23 22:59     ` Austin Clements
2014-08-24 12:56       ` Jani Nikula
2014-08-01  2:09 ` [PATCH v3 04/13] lib: Database version 3: Introduce fine-grained "features" Austin Clements
2014-08-23 16:02   ` Jani Nikula
2014-08-24  0:57     ` Austin Clements
2014-08-23 22:21   ` David Bremner
2014-08-24  0:58     ` Austin Clements
2014-08-24  3:58       ` David Bremner
2014-08-24 22:16         ` Austin Clements
2014-08-24 23:03           ` David Bremner
2014-08-01  2:09 ` [PATCH v3 05/13] test: Tool to build DB with specific version and features Austin Clements
2014-08-23 16:03   ` Jani Nikula [this message]
2014-08-01  2:09 ` [PATCH v3 06/13] test: Tests for future version and unknown feature handling Austin Clements
2014-08-01  2:09 ` [PATCH v3 07/13] lib: Simplify upgrade code using a transaction Austin Clements
2014-08-01  2:09 ` [PATCH v3 08/13] lib: Use database features to drive upgrade Austin Clements
2014-08-01  2:09 ` [PATCH v3 09/13] lib: Reorganize upgrade around document types Austin Clements
2014-08-01  2:10 ` [PATCH v3 10/13] lib: Report progress for combined upgrade operation Austin Clements
2014-08-01  2:10 ` [PATCH v3 11/13] lib: Support empty header values in database Austin Clements
2014-08-01  2:10 ` [PATCH v3 12/13] lib: Return an error from operations that require an upgrade Austin Clements
2014-08-01  2:10 ` [PATCH v3 13/13] lib: Update doc of notmuch_database_{needs_upgrade, upgrade} Austin Clements
2014-08-07 21:55 ` [PATCH v3 00/13] Implement and use database "features" Tomi Ollila
2014-08-08 18:18   ` Austin Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87oavbjiqs.fsf@nikula.org \
    --to=jani@nikula.org \
    --cc=amdragon@MIT.EDU \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).