From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 6D8D46DE1F4B for ; Sat, 25 Feb 2017 10:49:57 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.184 X-Spam-Level: X-Spam-Status: No, score=-0.184 tagged_above=-999 required=5 tests=[AWL=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MTNqW-BowLZY for ; Sat, 25 Feb 2017 10:49:56 -0800 (PST) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by arlo.cworth.org (Postfix) with ESMTPS id F06EE6DE1F48 for ; Sat, 25 Feb 2017 10:49:55 -0800 (PST) Received: by mail-lf0-f68.google.com with SMTP id z127so3538374lfa.2 for ; Sat, 25 Feb 2017 10:49:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:in-reply-to:references:date:message-id:mime-version; bh=C7MeBYQwa8bfjxO+EnkBdNRHhPIeqtBZjUcDlpjbr28=; b=egnMwLmujjnYywYuYF2XScRN32hG8T9L+BdxdrGNGI5fdlfEpntk/yB1ZzpW8QUeuo CyY5NUts2FsumIthQbLn8ZvJMqrQOpZykupsaxNF5a+AlC483dGs8IXs4ZDpDw88ER6s 5LqflM/Od0WknFTcrE9wUFXIEFtx8dH5Vl6bjttsQOd5s+sJfyj0iZC/XNGQP/WKXrV9 Pm1vwtJnjfjEaB+rWdDGBYG94KDy6HGDZo+OHG+nJ0PiWn3HEkAiDTSmvcJoMGYig/ci 7rR6jbc12khrOXJbPp5KGIZ46kXGKo7IdfjOAo3qAG+jQ5MA6jETLZXlUMmFsbLRIJuv yJGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=C7MeBYQwa8bfjxO+EnkBdNRHhPIeqtBZjUcDlpjbr28=; b=eqFQBFZ+FX1gmI90NNPFEKYEHeeb4KLvYidaH6TLidCrVre4gDO3FMLFB87lbVXJ+U BiC0Oyrr853tSmjODxYGc9pWzGs5EcoCF2RFJxRFn0XivlSgU3A/kSUGyVU1+GdYxwAZ AgDoSBo2llP7X++iwi48+5cudAO0xDq09FkxZTwOg+d/Y+milrmYoeNqbzZxOOU5xx53 6mqYGaAkyUu47hwIlQI4z2ExYJ29FHLJw2/AVIhkObjMSTPgojEADrGH80EP7sKu7hYe k0/e/95uBtm8wFyK5Q4lx8YCd/5/CZZV7QQu3JMpRQBH14cGZnbYJqPg/aqGuCa7B4D9 Cjvw== X-Gm-Message-State: AMke39lqzukofc6qEK++vyhgz3gN7QaYY8LJevQavETjzeE8VKK+BWR17itB5rvp2c17Pg== X-Received: by 10.25.229.156 with SMTP id i28mr2507160lfk.11.1488048594422; Sat, 25 Feb 2017 10:49:54 -0800 (PST) Received: from localhost (mobile-access-bcee80-14.dhcp.inet.fi. [188.238.128.14]) by smtp.gmail.com with ESMTPSA id a71sm2770176lfe.36.2017.02.25.10.49.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 25 Feb 2017 10:49:53 -0800 (PST) From: Jani Nikula To: David Bremner , notmuch@notmuchmail.org, eg@gaute.vetsj.com Subject: Re: [PATCH 1/4] test: add known broken test for uncaught DatabaseModifiedError In-Reply-To: <20170225034513.19427-2-david@tethera.net> References: <20170225034513.19427-1-david@tethera.net> <20170225034513.19427-2-david@tethera.net> Date: Sat, 25 Feb 2017 20:49:53 +0200 Message-ID: <87k28e6r72.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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, 25 Feb 2017 18:49:57 -0000 On Fri, 24 Feb 2017, David Bremner wrote: > There are several of these to track down, but one that is in quite a > few code paths is _notmuch_message_ensure_metadata. > --- > test/T640-database-modified.sh | 60 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 60 insertions(+) > create mode 100755 test/T640-database-modified.sh > > diff --git a/test/T640-database-modified.sh b/test/T640-database-modified.sh > new file mode 100755 > index 00000000..41869eaa > --- /dev/null > +++ b/test/T640-database-modified.sh > @@ -0,0 +1,60 @@ > +#!/usr/bin/env bash > +test_description="DatabaseModifiedError handling" > +. ./test-lib.sh || exit 1 > + > +add_email_corpus Is the whole corpus necessary? Just add a single message? > + > +test_begin_subtest "catching DatabaseModifiedError in _notmuch_message_ensure_metadata" > +test_subtest_known_broken > +test_C ${MAIL_DIR} <<'EOF' I'm not entirely thrilled by the whole test_C thing, but I guess I've lost that battle... :/ > +#include > +#include > +#include > +#include > +int > +main (int argc, char **argv) > +{ > + pid_t child; Leftover variable? > + const char *path = argv[1]; > + > + notmuch_database_t *rw_db, *ro_db; > + notmuch_messages_t *messages; > + notmuch_message_t *message, *ro_message; > + notmuch_query_t *query; > + notmuch_tags_t *tags; > + > + EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_ONLY, &ro_db)); > + EXPECT0 (notmuch_database_find_message (ro_db, "4EFC743A.3060609@april.org", &ro_message)); How about add_message with a specific message-id, and using that here? I think we rely too much on the test corpus and hard-code stuff from there too much. Otherwise, LGTM. > + > + EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, &rw_db)); > + query = notmuch_query_create(rw_db, ""); > + EXPECT0 (notmuch_query_search_messages_st (query, &messages)); > + > + for (int count=0; > + notmuch_messages_valid (messages); > + notmuch_messages_move_to_next (messages), count++) { > + message = notmuch_messages_get (messages); > + for (int i=0; i<200; i++) { > + char *tag_str = talloc_asprintf(rw_db, "%d", i); > + EXPECT0 (notmuch_message_add_tag (message, tag_str)); > + talloc_free (tag_str); > + } > + } > + > + notmuch_database_close (rw_db); > + > + tags = notmuch_message_get_tags (ro_message); > + if (tags) > + printf("SUCCESS\n"); > + return 0; > +} > +EOF > + > +cat <<'EOF' >EXPECTED > +== stdout == > +SUCCESS > +== stderr == > +EOF > +test_expect_equal_file EXPECTED OUTPUT > + > +test_done > -- > 2.11.0 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > https://notmuchmail.org/mailman/listinfo/notmuch