1 Return-Path: <bremner@tethera.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by arlo.cworth.org (Postfix) with ESMTP id 292706DE091C
\r
6 for <notmuch@notmuchmail.org>; Sat, 4 Jun 2016 05:29:59 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=-0.012 tagged_above=-999 required=5
\r
12 tests=[AWL=-0.001, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01]
\r
14 Received: from arlo.cworth.org ([127.0.0.1])
\r
15 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id A5hDbifBI6dc for <notmuch@notmuchmail.org>;
\r
17 Sat, 4 Jun 2016 05:29:51 -0700 (PDT)
\r
18 Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])
\r
19 by arlo.cworth.org (Postfix) with ESMTPS id 8A5886DE0261
\r
20 for <notmuch@notmuchmail.org>; Sat, 4 Jun 2016 05:29:34 -0700 (PDT)
\r
21 Received: from remotemail by fethera.tethera.net with local (Exim 4.84)
\r
22 (envelope-from <bremner@tethera.net>)
\r
23 id 1b9Ahc-0004z6-SF; Sat, 04 Jun 2016 08:29:20 -0400
\r
24 Received: (nullmailer pid 23495 invoked by uid 1000);
\r
25 Sat, 04 Jun 2016 12:29:27 -0000
\r
26 From: David Bremner <david@tethera.net>
\r
27 To: Istvan Marko <notmuch@kismala.com>, Jani Nikula <jani@nikula.org>,
\r
28 notmuch@notmuchmail.org
\r
29 Subject: [PATCH 3/4] test: initial tests for locking retry
\r
30 Date: Sat, 4 Jun 2016 09:29:15 -0300
\r
31 Message-Id: <1465043356-23420-4-git-send-email-david@tethera.net>
\r
32 X-Mailer: git-send-email 2.8.1
\r
33 In-Reply-To: <1465043356-23420-1-git-send-email-david@tethera.net>
\r
34 References: <m3wpnb0xc6.fsf@zsu.kismala.com>
\r
35 <1465043356-23420-1-git-send-email-david@tethera.net>
\r
36 X-BeenThere: notmuch@notmuchmail.org
\r
37 X-Mailman-Version: 2.1.20
\r
39 List-Id: "Use and development of the notmuch mail system."
\r
40 <notmuch.notmuchmail.org>
\r
41 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
42 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
44 List-Post: <mailto:notmuch@notmuchmail.org>
\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
46 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
48 X-List-Received-Date: Sat, 04 Jun 2016 12:29:59 -0000
\r
50 Currently there's not much to test, so we simulate contention, and check
\r
51 that the modifications to the database are serialized.
\r
53 test/T620-lock.sh | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
\r
54 1 file changed, 75 insertions(+)
\r
55 create mode 100755 test/T620-lock.sh
\r
57 diff --git a/test/T620-lock.sh b/test/T620-lock.sh
\r
58 new file mode 100755
\r
59 index 0000000..f46475e
\r
61 +++ b/test/T620-lock.sh
\r
63 +#!/usr/bin/env bash
\r
64 +test_description="locking"
\r
65 +. ./test-lib.sh || exit 1
\r
67 +if [ "${NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK}" = "0" ]; then
\r
68 + test_subtest_missing_external_prereq_["lock retry support"]=t
\r
73 +test_begin_subtest "blocking open"
\r
74 +test_C ${MAIL_DIR} <<'EOF'
\r
75 +#include <unistd.h>
\r
76 +#include <stdlib.h>
\r
77 +#include <sys/wait.h>
\r
78 +#include <notmuch-test.h>
\r
81 +taggit (notmuch_database_t *db, const char *tag)
\r
83 + notmuch_message_t *message;
\r
85 + EXPECT0 (notmuch_database_find_message (db, "4EFC743A.3060609@april.org", &message));
\r
86 + if (message == NULL) {
\r
87 + fprintf (stderr, "unable to find message");
\r
91 + EXPECT0 (notmuch_message_add_tag (message, tag));
\r
92 + notmuch_message_destroy (message);
\r
96 +main (int argc, char **argv)
\r
99 + const char *path = argv[1];
\r
102 + if (child == -1) {
\r
103 + fprintf (stderr, "fork failed\n");
\r
107 + if (child == 0) {
\r
108 + notmuch_database_t *db2;
\r
111 + EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, &db2));
\r
112 + taggit (db2, "child");
\r
113 + EXPECT0 (notmuch_database_close (db2));
\r
115 + notmuch_database_t *db;
\r
117 + EXPECT0 (notmuch_database_open (path, NOTMUCH_DATABASE_MODE_READ_WRITE, &db));
\r
118 + taggit (db, "parent");
\r
120 + EXPECT0 (notmuch_database_close (db));
\r
126 +notmuch search --output=tags id:4EFC743A.3060609@april.org >> OUTPUT
\r
127 +cat <<'EOF' >EXPECTED
\r
135 +test_expect_equal_file EXPECTED OUTPUT
\r