Re: Hi all
[notmuch-archives.git] / 9c / 7a7f6be4394547369bc8120c55f04c8a0c1191
1 Return-Path: <m.walters@qmul.ac.uk>\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 6544C431FBD\r
6         for <notmuch@notmuchmail.org>; Wed,  8 Aug 2012 00:36:33 -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: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id HDAI1lXYXCkB for <notmuch@notmuchmail.org>;\r
17         Wed,  8 Aug 2012 00:36:32 -0700 (PDT)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id AFEA5431FAE\r
22         for <notmuch@notmuchmail.org>; Wed,  8 Aug 2012 00:36:31 -0700 (PDT)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1Sz0od-00027N-Eu; Wed, 08 Aug 2012 08:36:29 +0100\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
28         helo=localhost)\r
29         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
30         (envelope-from <m.walters@qmul.ac.uk>)\r
31         id 1Sz0od-0000Wb-0r; Wed, 08 Aug 2012 08:36:27 +0100\r
32 From: Mark Walters <markwalters1009@gmail.com>\r
33 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
34 Subject: Re: [PATCH v2] test: Add test for messages with missing headers\r
35 In-Reply-To: <1344389313-7886-1-git-send-email-amdragon@mit.edu>\r
36 References: <1344374501-28185-1-git-send-email-amdragon@mit.edu>\r
37         <1344389313-7886-1-git-send-email-amdragon@mit.edu>\r
38 User-Agent: Notmuch/0.13.2+96~g634443c (http://notmuchmail.org) Emacs/23.4.1\r
39         (x86_64-pc-linux-gnu)\r
40 Date: Wed, 08 Aug 2012 08:36:21 +0100\r
41 Message-ID: <87628t3kei.fsf@qmul.ac.uk>\r
42 MIME-Version: 1.0\r
43 Content-Type: text/plain; charset=us-ascii\r
44 X-Sender-Host-Address: 94.192.233.223\r
45 X-QM-SPAM-Info: Sender has good ham record.  :)\r
46 X-QM-Body-MD5: d65b4b6cda6ec7a9b633692dbd1a2548 (of first 20000 bytes)\r
47 X-SpamAssassin-Score: -1.8\r
48 X-SpamAssassin-SpamBar: -\r
49 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
50         determine if it is\r
51         spam. We require at least 5.0 points to mark a message as spam.\r
52         This message scored -1.8 points.\r
53         Summary of the scoring: \r
54         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
55         *      medium trust\r
56         *      [138.37.6.40 listed in list.dnswl.org]\r
57         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
58         provider *      (markwalters1009[at]gmail.com)\r
59         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
60         *      domain\r
61         *  0.5 AWL AWL: From: address is in the auto white-list\r
62 X-QM-Scan-Virus: ClamAV says the message is clean\r
63 X-BeenThere: notmuch@notmuchmail.org\r
64 X-Mailman-Version: 2.1.13\r
65 Precedence: list\r
66 List-Id: "Use and development of the notmuch mail system."\r
67         <notmuch.notmuchmail.org>\r
68 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
69         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
70 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
71 List-Post: <mailto:notmuch@notmuchmail.org>\r
72 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
73 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
74         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
75 X-List-Received-Date: Wed, 08 Aug 2012 07:36:33 -0000\r
76 \r
77 \r
78 On Wed, 08 Aug 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
79 > Currently the JSON tests for search and show are broken because\r
80 > notmuch attempts to dereference a NULL pointer.\r
81 > ---\r
82 > This version fixes the "Show: text" test so that it sanitize its\r
83 > output and doesn't hard-code my test paths.\r
84 \r
85 LGTM +1. Tests work as expected and all tests pass with\r
86 id:"874noe1o0r.fsf@qmul.ac.uk" applied.\r
87 \r
88 Best wishes\r
89 \r
90 Mark\r
91 \r
92 >  test/missing-headers |  162 ++++++++++++++++++++++++++++++++++++++++++++++++++\r
93 >  test/notmuch-test    |    1 +\r
94 >  2 files changed, 163 insertions(+)\r
95 >  create mode 100755 test/missing-headers\r
96 >\r
97 > diff --git a/test/missing-headers b/test/missing-headers\r
98 > new file mode 100755\r
99 > index 0000000..e79f922\r
100 > --- /dev/null\r
101 > +++ b/test/missing-headers\r
102 > @@ -0,0 +1,162 @@\r
103 > +#!/usr/bin/env bash\r
104 > +test_description='messages with missing headers'\r
105 > +. ./test-lib.sh\r
106 > +\r
107 > +# Notmuch requires at least one of from, subject, or to or it will\r
108 > +# ignore the file.  Generate two messages so that together they cover\r
109 > +# all possible missing headers.  We also give one of the messages a\r
110 > +# date to ensure stable result ordering.\r
111 > +\r
112 > +cat <<EOF > "${MAIL_DIR}/msg-2"\r
113 > +To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
114 > +Date: Fri, 05 Jan 2001 15:43:57 +0000\r
115 > +\r
116 > +Body\r
117 > +EOF\r
118 > +\r
119 > +cat <<EOF > "${MAIL_DIR}/msg-1"\r
120 > +From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
121 > +\r
122 > +Body\r
123 > +EOF\r
124 > +\r
125 > +NOTMUCH_NEW\r
126 > +\r
127 > +test_begin_subtest "Search: text"\r
128 > +output=$(notmuch search '*' | notmuch_search_sanitize)\r
129 > +test_expect_equal "$output" "\\r
130 > +thread:XXX   2001-01-05 [1/1] (null);  (inbox unread)\r
131 > +thread:XXX   1970-01-01 [1/1] Notmuch Test Suite;  (inbox unread)"\r
132 > +\r
133 > +test_begin_subtest "Search: json"\r
134 > +test_subtest_known_broken\r
135 > +output=$(notmuch search --format=json '*' | notmuch_search_sanitize)\r
136 > +test_expect_equal_json "$output" '\r
137 > +[\r
138 > +    {\r
139 > +        "authors": "",\r
140 > +        "date_relative": "2001-01-05",\r
141 > +        "matched": 1,\r
142 > +        "subject": "",\r
143 > +        "tags": [\r
144 > +            "inbox",\r
145 > +            "unread"\r
146 > +        ],\r
147 > +        "thread": "XXX",\r
148 > +        "timestamp": 978709437,\r
149 > +        "total": 1\r
150 > +    },\r
151 > +    {\r
152 > +        "authors": "Notmuch Test Suite",\r
153 > +        "date_relative": "1970-01-01",\r
154 > +        "matched": 1,\r
155 > +        "subject": "",\r
156 > +        "tags": [\r
157 > +            "inbox",\r
158 > +            "unread"\r
159 > +        ],\r
160 > +        "thread": "XXX",\r
161 > +        "timestamp": 0,\r
162 > +        "total": 1\r
163 > +    }\r
164 > +]'\r
165 > +\r
166 > +test_begin_subtest "Show: text"\r
167 > +output=$(notmuch show '*' | notmuch_show_sanitize)\r
168 > +test_expect_equal "$output" "\\r
169 > +\f\r
170 message{ id:notmuch-sha1-7a6e4eac383ef958fcd3ebf2143db71b8ff01161 depth:0 match:1 excluded:0 filename:/XXX/mail/msg-2\r
171 > +\f\r
172 header{\r
173 > + (2001-01-05) (inbox unread)\r
174 > +Subject: (null)\r
175 > +From: (null)\r
176 > +To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
177 > +Date: Fri, 05 Jan 2001 15:43:57 +0000\r
178 > +\f\r
179 header}\r
180 > +\f\r
181 body{\r
182 > +\f\r
183 part{ ID: 1, Content-type: text/plain\r
184 > +Body\r
185 > +\f\r
186 part}\r
187 > +\f\r
188 body}\r
189 > +\f\r
190 message}\r
191 > +\f\r
192 message{ id:notmuch-sha1-ca55943aff7a72baf2ab21fa74fab3d632401334 depth:0 match:1 excluded:0 filename:/XXX/mail/msg-1\r
193 > +\f\r
194 header{\r
195 > +Notmuch Test Suite <test_suite@notmuchmail.org> (1970-01-01) (inbox unread)\r
196 > +Subject: (null)\r
197 > +From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
198 > +Date: Thu, 01 Jan 1970 00:00:00 +0000\r
199 > +\f\r
200 header}\r
201 > +\f\r
202 body{\r
203 > +\f\r
204 part{ ID: 1, Content-type: text/plain\r
205 > +Body\r
206 > +\f\r
207 part}\r
208 > +\f\r
209 body}\r
210 > +\f\r
211 message}"\r
212 > +\r
213 > +test_begin_subtest "Show: json"\r
214 > +test_subtest_known_broken\r
215 > +output=$(notmuch show --format=json '*' | notmuch_json_show_sanitize)\r
216 > +test_expect_equal_json "$output" '\r
217 > +[\r
218 > +    [\r
219 > +        [\r
220 > +            {\r
221 > +                "body": [\r
222 > +                    {\r
223 > +                        "content": "Body\n",\r
224 > +                        "content-type": "text/plain",\r
225 > +                        "id": 1\r
226 > +                    }\r
227 > +                ],\r
228 > +                "date_relative": "2001-01-05",\r
229 > +                "excluded": false,\r
230 > +                "filename": "YYYYY",\r
231 > +                "headers": {\r
232 > +                    "Date": "Fri, 05 Jan 2001 15:43:57 +0000",\r
233 > +                    "From": "",\r
234 > +                    "Subject": "",\r
235 > +                    "To": "Notmuch Test Suite <test_suite@notmuchmail.org>"\r
236 > +                },\r
237 > +                "id": "XXXXX",\r
238 > +                "match": true,\r
239 > +                "tags": [\r
240 > +                    "inbox",\r
241 > +                    "unread"\r
242 > +                ],\r
243 > +                "timestamp": 978709437\r
244 > +            },\r
245 > +            []\r
246 > +        ]\r
247 > +    ],\r
248 > +    [\r
249 > +        [\r
250 > +            {\r
251 > +                "body": [\r
252 > +                    {\r
253 > +                        "content": "Body\n",\r
254 > +                        "content-type": "text/plain",\r
255 > +                        "id": 1\r
256 > +                    }\r
257 > +                ],\r
258 > +                "date_relative": "1970-01-01",\r
259 > +                "excluded": false,\r
260 > +                "filename": "YYYYY",\r
261 > +                "headers": {\r
262 > +                    "Date": "Thu, 01 Jan 1970 00:00:00 +0000",\r
263 > +                    "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
264 > +                    "Subject": ""\r
265 > +                },\r
266 > +                "id": "XXXXX",\r
267 > +                "match": true,\r
268 > +                "tags": [\r
269 > +                    "inbox",\r
270 > +                    "unread"\r
271 > +                ],\r
272 > +                "timestamp": 0\r
273 > +            },\r
274 > +            []\r
275 > +        ]\r
276 > +    ]\r
277 > +]'\r
278 > +\r
279 > +\r
280 > +test_done\r
281 > diff --git a/test/notmuch-test b/test/notmuch-test\r
282 > index ea39dfc..cc732c3 100755\r
283 > --- a/test/notmuch-test\r
284 > +++ b/test/notmuch-test\r
285 > @@ -59,6 +59,7 @@ TESTS="\r
286 >    emacs-address-cleaning\r
287 >    emacs-hello\r
288 >    emacs-show\r
289 > +  missing-headers\r
290 >  "\r
291 >  TESTS=${NOTMUCH_TESTS:=$TESTS}\r
292 >  \r
293 > -- \r
294 > 1.7.10\r
295 >\r
296 > _______________________________________________\r
297 > notmuch mailing list\r
298 > notmuch@notmuchmail.org\r
299 > http://notmuchmail.org/mailman/listinfo/notmuch\r