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 6435D431FBC
\r
6 for <notmuch@notmuchmail.org>; Tue, 7 Aug 2012 15:44:04 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 Kbw41tkgR2V8 for <notmuch@notmuchmail.org>;
\r
17 Tue, 7 Aug 2012 15:44:03 -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 3E891431FAE
\r
22 for <notmuch@notmuchmail.org>; Tue, 7 Aug 2012 15:44:03 -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 1SysVK-00047h-Hx; Tue, 07 Aug 2012 23:44:01 +0100
\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]
\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 1SysVK-0002rq-18; Tue, 07 Aug 2012 23:43:58 +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] test: Add test for messages with missing headers
\r
35 In-Reply-To: <1344374501-28185-1-git-send-email-amdragon@mit.edu>
\r
36 References: <1344374501-28185-1-git-send-email-amdragon@mit.edu>
\r
37 User-Agent: Notmuch/0.13.2+96~g634443c (http://notmuchmail.org) Emacs/23.4.1
\r
38 (x86_64-pc-linux-gnu)
\r
39 Date: Tue, 07 Aug 2012 23:43:51 +0100
\r
40 Message-ID: <87ipcumifs.fsf@qmul.ac.uk>
\r
42 Content-Type: text/plain; charset=us-ascii
\r
43 X-Sender-Host-Address: 94.192.233.223
\r
44 X-QM-SPAM-Info: Sender has good ham record. :)
\r
45 X-QM-Body-MD5: 164e43691eeaacaf685370cbfa71e8f3 (of first 20000 bytes)
\r
46 X-SpamAssassin-Score: -1.8
\r
47 X-SpamAssassin-SpamBar: -
\r
48 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
50 spam. We require at least 5.0 points to mark a message as spam.
\r
51 This message scored -1.8 points.
\r
52 Summary of the scoring:
\r
53 * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,
\r
55 * [138.37.6.40 listed in list.dnswl.org]
\r
56 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
57 provider * (markwalters1009[at]gmail.com)
\r
58 * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay
\r
60 * 0.5 AWL AWL: From: address is in the auto white-list
\r
61 X-QM-Scan-Virus: ClamAV says the message is clean
\r
62 X-BeenThere: notmuch@notmuchmail.org
\r
63 X-Mailman-Version: 2.1.13
\r
65 List-Id: "Use and development of the notmuch mail system."
\r
66 <notmuch.notmuchmail.org>
\r
67 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
70 List-Post: <mailto:notmuch@notmuchmail.org>
\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
72 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
74 X-List-Received-Date: Tue, 07 Aug 2012 22:44:04 -0000
\r
79 This generally looks good but there is a bug in the test from a
\r
80 hardcoded /tmp/ path (see below). And as confirmation with the patch in
\r
81 id:"874noe1o0r.fsf@qmul.ac.uk" the tests (modulo the test bug) pass.
\r
83 On Tue, 07 Aug 2012, Austin Clements <amdragon@MIT.EDU> wrote:
\r
84 > Currently the JSON tests for search and show are broken because
\r
85 > notmuch attempts to dereference a NULL pointer.
\r
87 > Things to bikeshed:
\r
89 > * Should we include From and Subject in the headers object when there
\r
90 > are no from or subject headers? Currently the schema says that
\r
91 > everything but those two and "Date" is optional (indeed, "To" is
\r
92 > missing from the second message) but that was just post facto
\r
95 I think Date and From are compulsory in an email but the others are not
\r
96 (but I am unsure which Date and which From so that may be unhelpful).
\r
97 If I am correct it might be sensible to always include those two.
\r
99 > * How should we format expected JSON in the test suite, now that we
\r
100 > can format it however we want? Here I've just pasted in the result
\r
101 > of python -mjson.tool. While that was very easy and the result is
\r
102 > quite readable, it's the antithesis of compact and the keys have
\r
103 > been alphabetized.
\r
105 I like this: making the tests readable is a big plus.
\r
107 > test/missing-headers | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++
\r
108 > test/notmuch-test | 1 +
\r
109 > 2 files changed, 163 insertions(+)
\r
110 > create mode 100755 test/missing-headers
\r
112 > diff --git a/test/missing-headers b/test/missing-headers
\r
113 > new file mode 100755
\r
114 > index 0000000..744c04e
\r
116 > +++ b/test/missing-headers
\r
117 > @@ -0,0 +1,162 @@
\r
118 > +#!/usr/bin/env bash
\r
119 > +test_description='messages with missing headers'
\r
122 > +# Notmuch requires at least one of from, subject, or to or it will
\r
123 > +# ignore the file. Generate two messages so that together they cover
\r
124 > +# all possible missing headers. We also give one of the messages a
\r
125 > +# date to ensure stable result ordering.
\r
127 > +cat <<EOF > "${MAIL_DIR}/msg-2"
\r
128 > +To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
129 > +Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
134 > +cat <<EOF > "${MAIL_DIR}/msg-1"
\r
135 > +From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
142 > +test_begin_subtest "Search: text"
\r
143 > +output=$(notmuch search '*' | notmuch_search_sanitize)
\r
144 > +test_expect_equal "$output" "\
\r
145 > +thread:XXX 2001-01-05 [1/1] (null); (inbox unread)
\r
146 > +thread:XXX 1970-01-01 [1/1] Notmuch Test Suite; (inbox unread)"
\r
148 > +test_begin_subtest "Search: json"
\r
149 > +test_subtest_known_broken
\r
150 > +output=$(notmuch search --format=json '*' | notmuch_search_sanitize)
\r
151 > +test_expect_equal_json "$output" '
\r
155 > + "date_relative": "2001-01-05",
\r
162 > + "thread": "XXX",
\r
163 > + "timestamp": 978709437,
\r
167 > + "authors": "Notmuch Test Suite",
\r
168 > + "date_relative": "1970-01-01",
\r
175 > + "thread": "XXX",
\r
176 > + "timestamp": 0,
\r
181 > +test_begin_subtest "Show: text"
\r
182 > +output=$(notmuch show '*')
\r
183 > +test_expect_equal "$output" "\
\r
185 message{ id:notmuch-sha1-7a6e4eac383ef958fcd3ebf2143db71b8ff01161 depth:0 match:1 excluded:0 filename:/tmp/nmtest/tmp.missing-headers/mail/msg-2
\r
187 The filename above has not been sanitised so contains your tmp path.
\r
195 > + (2001-01-05) (inbox unread)
\r
198 > +To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
199 > +Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
205 part{ ID: 1, Content-type: text/plain
\r
214 message{ id:notmuch-sha1-ca55943aff7a72baf2ab21fa74fab3d632401334 depth:0 match:1 excluded:0 filename:/tmp/nmtest/tmp.missing-headers/mail/msg-1
\r
217 > +Notmuch Test Suite <test_suite@notmuchmail.org> (1970-01-01) (inbox unread)
\r
219 > +From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
220 > +Date: Thu, 01 Jan 1970 00:00:00 +0000
\r
226 part{ ID: 1, Content-type: text/plain
\r
235 > +test_begin_subtest "Show: json"
\r
236 > +test_subtest_known_broken
\r
237 > +output=$(notmuch show --format=json '*' | notmuch_json_show_sanitize)
\r
238 > +test_expect_equal_json "$output" '
\r
245 > + "content": "Body\n",
\r
246 > + "content-type": "text/plain",
\r
250 > + "date_relative": "2001-01-05",
\r
251 > + "excluded": false,
\r
252 > + "filename": "YYYYY",
\r
254 > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000",
\r
257 > + "To": "Notmuch Test Suite <test_suite@notmuchmail.org>"
\r
265 > + "timestamp": 978709437
\r
275 > + "content": "Body\n",
\r
276 > + "content-type": "text/plain",
\r
280 > + "date_relative": "1970-01-01",
\r
281 > + "excluded": false,
\r
282 > + "filename": "YYYYY",
\r
284 > + "Date": "Thu, 01 Jan 1970 00:00:00 +0000",
\r
285 > + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
303 > diff --git a/test/notmuch-test b/test/notmuch-test
\r
304 > index ea39dfc..cc732c3 100755
\r
305 > --- a/test/notmuch-test
\r
306 > +++ b/test/notmuch-test
\r
307 > @@ -59,6 +59,7 @@ TESTS="
\r
308 > emacs-address-cleaning
\r
311 > + missing-headers
\r
313 > TESTS=${NOTMUCH_TESTS:=$TESTS}
\r
318 > _______________________________________________
\r
319 > notmuch mailing list
\r
320 > notmuch@notmuchmail.org
\r
321 > http://notmuchmail.org/mailman/listinfo/notmuch
\r