Re: [PATCH v4 5/5] notmuch-emacs-mua: do not create a frame by default with --client
[notmuch-archives.git] / 34 / 3242098c7d91412c8d6c61606fd24b6cb8f1a2
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 69A08431FD9\r
6         for <notmuch@notmuchmail.org>; Sat, 14 Mar 2015 10:04:34 -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: 2.438\r
10 X-Spam-Level: **\r
11 X-Spam-Status: No, score=2.438 tagged_above=-999 required=5\r
12         tests=[DNS_FROM_AHBL_RHSBL=2.438] 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 0mrH15wFt-kA for <notmuch@notmuchmail.org>;\r
16         Sat, 14 Mar 2015 10:04:32 -0700 (PDT)\r
17 Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net\r
18         [87.98.215.224])\r
19         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 93086431FD7\r
22         for <notmuch@notmuchmail.org>; Sat, 14 Mar 2015 10:04:32 -0700 (PDT)\r
23 Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim\r
24         4.80) (envelope-from <bremner@tesseract.cs.unb.ca>)\r
25         id 1YWpTY-00027S-Cp; Sat, 14 Mar 2015 17:03:48 +0000\r
26 Received: (nullmailer pid 4985 invoked by uid 1000); Sat, 14 Mar 2015\r
27         17:02:41 -0000\r
28 From: David Bremner <david@tethera.net>\r
29 To: notmuch@notmuchmail.org\r
30 Subject: [Patch v4 3/9] test: add error reporting tests for lib/database.cc\r
31 Date: Sat, 14 Mar 2015 18:02:28 +0100\r
32 Message-Id: <1426352554-4383-4-git-send-email-david@tethera.net>\r
33 X-Mailer: git-send-email 2.1.4\r
34 In-Reply-To: <1426352554-4383-1-git-send-email-david@tethera.net>\r
35 References: <1426352554-4383-1-git-send-email-david@tethera.net>\r
36 X-BeenThere: notmuch@notmuchmail.org\r
37 X-Mailman-Version: 2.1.13\r
38 Precedence: list\r
39 List-Id: "Use and development of the notmuch mail system."\r
40         <notmuch.notmuchmail.org>\r
41 List-Unsubscribe: <http://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: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
48 X-List-Received-Date: Sat, 14 Mar 2015 17:04:34 -0000\r
49 \r
50 Unfortunately quite a few of the error handling paths here require\r
51 more sophisticated tests using e.g. gdb.\r
52 ---\r
53  test/T560-lib-error.sh | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++\r
54  1 file changed, 91 insertions(+)\r
55  create mode 100755 test/T560-lib-error.sh\r
56 \r
57 diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh\r
58 new file mode 100755\r
59 index 0000000..dc2022f\r
60 --- /dev/null\r
61 +++ b/test/T560-lib-error.sh\r
62 @@ -0,0 +1,91 @@\r
63 +#!/usr/bin/env bash\r
64 +test_description="error reporting for library"\r
65 +\r
66 +. ./test-lib.sh\r
67 +\r
68 +add_email_corpus\r
69 +\r
70 +test_expect_success "building database" "NOTMUCH_NEW"\r
71 +\r
72 +test_begin_subtest "Open null pointer"\r
73 +test_C <<EOF\r
74 +#include <stdio.h>\r
75 +#include <notmuch.h>\r
76 +int main (int argc, char** argv)\r
77 +{\r
78 +    notmuch_database_t *db;\r
79 +    notmuch_status_t stat;\r
80 +    stat = notmuch_database_open (NULL, 0, 0);\r
81 +}\r
82 +EOF\r
83 +cat <<EOF >EXPECTED\r
84 +== stdout ==\r
85 +== stderr ==\r
86 +Error: Cannot open a database for a NULL path.\r
87 +EOF\r
88 +test_expect_equal_file EXPECTED OUTPUT\r
89 +\r
90 +test_begin_subtest "Open nonexistent database"\r
91 +test_C <<EOF\r
92 +#include <stdio.h>\r
93 +#include <notmuch.h>\r
94 +int main (int argc, char** argv)\r
95 +{\r
96 +    notmuch_database_t *db;\r
97 +    notmuch_status_t stat;\r
98 +    stat = notmuch_database_open ("/nonexistent/foo", 0, 0);\r
99 +}\r
100 +EOF\r
101 +cat <<EOF >EXPECTED\r
102 +== stdout ==\r
103 +== stderr ==\r
104 +Error opening database at /nonexistent/foo/.notmuch: No such file or directory\r
105 +EOF\r
106 +test_expect_equal_file EXPECTED OUTPUT\r
107 +\r
108 +test_begin_subtest "Write to read-only database"\r
109 +test_C ${MAIL_DIR} <<EOF\r
110 +#include <stdio.h>\r
111 +#include <notmuch.h>\r
112 +int main (int argc, char** argv)\r
113 +{\r
114 +   notmuch_database_t *db;\r
115 +   notmuch_status_t stat;\r
116 +   stat = notmuch_database_open (argv[1], NOTMUCH_DATABASE_MODE_READ_ONLY, &db);\r
117 +   if (stat != NOTMUCH_STATUS_SUCCESS) {\r
118 +     fprintf (stderr, "error opening database: %d\n", stat);\r
119 +   }\r
120 +   stat = notmuch_database_add_message (db, "/dev/null", NULL);\r
121 +}\r
122 +EOF\r
123 +cat <<EOF >EXPECTED\r
124 +== stdout ==\r
125 +== stderr ==\r
126 +Cannot write to a read-only database.\r
127 +EOF\r
128 +test_expect_equal_file EXPECTED OUTPUT\r
129 +\r
130 +test_begin_subtest "compact, overwriting existing backup"\r
131 +test_C ${MAIL_DIR} <<EOF\r
132 +#include <stdio.h>\r
133 +#include <notmuch.h>\r
134 +static void\r
135 +status_cb (const char *msg, void *closure)\r
136 +{\r
137 +    printf ("%s\n", msg);\r
138 +}\r
139 +int main (int argc, char** argv)\r
140 +{\r
141 +   notmuch_database_t *db;\r
142 +   notmuch_status_t stat;\r
143 +   stat = notmuch_database_compact (argv[1], argv[1], status_cb, NULL);\r
144 +}\r
145 +EOF\r
146 +cat <<EOF >EXPECTED\r
147 +== stdout ==\r
148 +== stderr ==\r
149 +Path already exists: CWD/mail\r
150 +EOF\r
151 +test_expect_equal_file EXPECTED OUTPUT\r
152 +\r
153 +test_done\r
154 -- \r
155 2.1.4\r
156 \r