[PATCH v3 5/7] Introduce _notmuch_message_has_term()
[notmuch-archives.git] / ca / 9cca9aa6b97eba1d684817285b217fe46c3432
1 Return-Path: <bremner@tesseract.cs.unb.ca>\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 olra.theworths.org (Postfix) with ESMTP id 03CFE431FD7\r
6         for <notmuch@notmuchmail.org>; Mon, 29 Sep 2014 12:49:51 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id BoXQFKEx3oHD for <notmuch@notmuchmail.org>;\r
16         Mon, 29 Sep 2014 12:49:46 -0700 (PDT)\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
18         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id A6CA7431FD2\r
21         for <notmuch@notmuchmail.org>; Mon, 29 Sep 2014 12:49:46 -0700 (PDT)\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
23         (envelope-from <bremner@tesseract.cs.unb.ca>)\r
24         id 1XYgx6-000326-BZ; Mon, 29 Sep 2014 16:49:44 -0300\r
25 Received: (nullmailer pid 17559 invoked by uid 1000); Mon, 29 Sep 2014\r
26         19:49:35 -0000\r
27 From: David Bremner <david@tethera.net>\r
28 To: notmuch@notmuchmail.org\r
29 Subject: [PATCH] WIP: new insert tests for failing indexing.\r
30 Date: Mon, 29 Sep 2014 21:49:32 +0200\r
31 Message-Id: <1412020172-17193-1-git-send-email-david@tethera.net>\r
32 X-Mailer: git-send-email 2.1.0\r
33 In-Reply-To: <cover.1411914914.git.jani@nikula.org>\r
34 References: <cover.1411914914.git.jani@nikula.org>\r
35 X-BeenThere: notmuch@notmuchmail.org\r
36 X-Mailman-Version: 2.1.13\r
37 Precedence: list\r
38 List-Id: "Use and development of the notmuch mail system."\r
39         <notmuch.notmuchmail.org>\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
41         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
43 List-Post: <mailto:notmuch@notmuchmail.org>\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
47 X-List-Received-Date: Mon, 29 Sep 2014 19:49:51 -0000\r
48 \r
49 The second one fails because the initial write lock fails.\r
50 I guess this is maybe a doc bug.\r
51 ---\r
52  test/T070-insert.sh | 21 +++++++++++++++++++++\r
53  1 file changed, 21 insertions(+)\r
54 \r
55 This is what I came up with when trying to induce indexing\r
56 failure. The best I could do was make the initial notmuch open fail.\r
57 This means my second test is broken.  When I was writing the commit\r
58 message I was thinking the man page was therefore wrong, but actually\r
59 it's ok.\r
60 \r
61 I did wonder if it might be a good idea to move the database open\r
62 after the message is written to disk, is we want to maximize the\r
63 chance of insert --keep "succeeding".\r
64 \r
65 diff --git a/test/T070-insert.sh b/test/T070-insert.sh\r
66 index aacc643..e7d0ae1 100755\r
67 --- a/test/T070-insert.sh\r
68 +++ b/test/T070-insert.sh\r
69 @@ -183,4 +183,25 @@ test_expect_code 1 "Invalid tags set exit code" \\r
70  \r
71  notmuch config set new.tags $OLDCONFIG\r
72  \r
73 +\r
74 +gen_insert_msg\r
75 +test_python <<EOF &\r
76 +import notmuch, time, os\r
77 +with open("write-locker.pid","w") as pidfile:\r
78 +    pidfile.write(str(os.getpid()))\r
79 +db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE)\r
80 +time.sleep(120)\r
81 +EOF\r
82 +\r
83 +# give time for the background process to get started\r
84 +sleep 1\r
85 +\r
86 +test_expect_code 1 "Non-zero exit code due to write lock" \\r
87 +    'notmuch insert < "$gen_msg_filename" 2>&1'\r
88 +\r
89 +test_expect_code 0 "Zero exit code due to --keep flag" \\r
90 +    'notmuch insert --keep < "$gen_msg_filename" 2>&1'\r
91 +\r
92 +kill $(cat ${TMP_DIRECTORY}/write-locker.pid) >/dev/null 2>&1\r
93 +\r
94  test_done\r
95 -- \r
96 2.1.0\r
97 \r