Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / bc / 402528f83731c4da9dd3c5bfa0759fe4f27372
1 Return-Path: <amdragon@mit.edu>\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 9EBBA431FBD\r
6         for <notmuch@notmuchmail.org>; Mon, 21 Apr 2014 12:58:32 -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.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 MLONvpHhLFhR for <notmuch@notmuchmail.org>;\r
16         Mon, 21 Apr 2014 12:58:26 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (dmz-mailsec-scanner-1.mit.edu\r
18         [18.9.25.12])\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 88E8B431FBC\r
22         for <notmuch@notmuchmail.org>; Mon, 21 Apr 2014 12:58:26 -0700 (PDT)\r
23 X-AuditID: 1209190c-f794a6d000000c27-fa-53557861ec90\r
24 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
25         (using TLS with cipher AES256-SHA (256/256 bits))\r
26         (Client did not present a certificate)\r
27         by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
28         id 2C.8E.03111.16875535; Mon, 21 Apr 2014 15:58:25 -0400 (EDT)\r
29 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
30         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id s3LJwKeu029665; \r
31         Mon, 21 Apr 2014 15:58:21 -0400\r
32 Received: from drake.dyndns.org\r
33         (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
34         [216.15.114.40]) (authenticated bits=0)\r
35         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
36         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s3LJwIfg023311\r
37         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
38         Mon, 21 Apr 2014 15:58:20 -0400\r
39 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
40         (envelope-from <amdragon@mit.edu>)\r
41         id 1WcKM6-0004AH-LS; Mon, 21 Apr 2014 15:58:18 -0400\r
42 From: Austin Clements <amdragon@MIT.EDU>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [PATCH v2] test: Test thread linking in all possible delivery orders\r
45 Date: Mon, 21 Apr 2014 15:58:11 -0400\r
46 Message-Id: <1398110291-15832-1-git-send-email-amdragon@mit.edu>\r
47 X-Mailer: git-send-email 1.9.1\r
48 In-Reply-To: <87y4zhfmrn.fsf@maritornes.cs.unb.ca>\r
49 References: <87y4zhfmrn.fsf@maritornes.cs.unb.ca>\r
50 X-Brightmail-Tracker:\r
51  H4sIAAAAAAAAA+NgFjrOIsWRmVeSWpSXmKPExsUixG6nrptYERps8PiWssWN1m5Gi9VzeSyu\r
52         35zJ7MDssXPWXXaPZ6tuMXtsOfSeOYA5issmJTUnsyy1SN8ugSvj5e4upoIrShXfzn9kaWB8\r
53         LtXFyMkhIWAicXL7d3YIW0ziwr31bF2MXBxCArOZJGY2/GeCcDYySlzoncQM4dxhkjj+/BFU\r
54         Zi6jRP/jm8wg/WwCGhLb9i9nBLFFBKQldt6dzQpiMwvESjS+XQZWIyzgK/FlYScbiM0ioCqx\r
55         7OgXMJtXwEFi782LTBB3yEmcPDYZrJdTwEhiz5LrYL1CAoYS314dZpvAyL+AkWEVo2xKbpVu\r
56         bmJmTnFqsm5xcmJeXmqRrqFebmaJXmpK6SZGUHhxSvLsYHxzUOkQowAHoxIPr4RBaLAQa2JZ\r
57         cWXuIUZJDiYlUV6BEqAQX1J+SmVGYnFGfFFpTmrxIUYJDmYlEd61aUA53pTEyqrUonyYlDQH\r
58         i5I471trq2AhgfTEktTs1NSC1CKYrAwHh5IEL3M5UKNgUWp6akVaZk4JQpqJgxNkOA/Q8Moy\r
59         kOHFBYm5xZnpEPlTjIpS4rwXQRICIImM0jy4Xlj8v2IUB3pFmPc2SBUPMHXAdb8CGswENPjJ\r
60         lhCQwSWJCCmpBkYW3V2/Vk/79Mzdeql+bf41d4HVHrIrMjKC3xcezTzGyNg9d7LghZ02Gjy/\r
61         ZzfxH7I6/mCFeUPgk/i0SS7bN3m357953OAkulHa/E7Fvg1f9Nq00q04H7gbPPvwq1V7+7ss\r
62         l8JA9dnNQtOnfdscqfbu9qLMUnE33Zh60+2Bx/Zv3d+qHL8k7oQSS3FGoqEWc1FxIgD4fHqu\r
63         2gIAAA==\r
64 X-BeenThere: notmuch@notmuchmail.org\r
65 X-Mailman-Version: 2.1.13\r
66 Precedence: list\r
67 List-Id: "Use and development of the notmuch mail system."\r
68         <notmuch.notmuchmail.org>\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
72 List-Post: <mailto:notmuch@notmuchmail.org>\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
75         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
76 X-List-Received-Date: Mon, 21 Apr 2014 19:58:32 -0000\r
77 \r
78 These tests deliver all possible (single-root) four-message threads in\r
79 all possible orders and check that notmuch successfully links them\r
80 into threads.\r
81 \r
82 There are two variants of the test: one delivers messages that\r
83 reference only their immediate parent and the other delivers messages\r
84 that reference all of their parents.  The latter test is currently\r
85 known-broken.\r
86 \r
87 This is introduced as a new test (rather than just adding it to\r
88 T050-new) because it's much easier for this to start with an empty\r
89 database.\r
90 ---\r
91 \r
92 This version hopefully addresses David's comments in\r
93 id:87y4zhfmrn.fsf@maritornes.cs.unb.ca and adds a second test that\r
94 demonstrates the bug Mark in figured out in\r
95 id:8738h7kv2q.fsf@qmul.ac.uk.\r
96 \r
97 test/T051-new-linking.sh | 91 ++++++++++++++++++++++++++++++++++++++++++++++++\r
98  1 file changed, 91 insertions(+)\r
99  create mode 100755 test/T051-new-linking.sh\r
100 \r
101 diff --git a/test/T051-new-linking.sh b/test/T051-new-linking.sh\r
102 new file mode 100755\r
103 index 0000000..9ccbc52\r
104 --- /dev/null\r
105 +++ b/test/T051-new-linking.sh\r
106 @@ -0,0 +1,91 @@\r
107 +#!/usr/bin/env bash\r
108 +test_description='"notmuch new" thread linking'\r
109 +\r
110 +. ./test-lib.sh\r
111 +\r
112 +# Generate all possible single-root four message thread structures.\r
113 +# Each line in THREADS is a thread structure, where the n'th field is\r
114 +# the parent of message n.  We'll use this for multiple tests below.\r
115 +THREADS=$(python -c '\r
116 +def mkTrees(free, tree={}):\r
117 +    if free == set():\r
118 +        print(" ".join(map(str, [msg[1] for msg in sorted(tree.items())])))\r
119 +        return\r
120 +    # Attach each free message to each message in the tree (if there is\r
121 +    # no tree, make the free message the root), backtracking after each\r
122 +    for msg in sorted(free):\r
123 +        parents = sorted(tree.keys()) if tree else ["none"]\r
124 +        for parent in parents:\r
125 +            ntree = tree.copy()\r
126 +            ntree[msg] = parent\r
127 +            mkTrees(free - set([msg]), ntree)\r
128 +mkTrees(set(range(4)))')\r
129 +nthreads=$(wc -l <<< "$THREADS")\r
130 +\r
131 +test_begin_subtest "All four-message threads get linked in all delivery orders (one parent)"\r
132 +# In the first variant, this delivers messages that reference only\r
133 +# their immediate parent.  Hence, we should only expect threads to be\r
134 +# fully joined at the end.\r
135 +for ((n = 0; n < 4; n++)); do\r
136 +    # Deliver the n'th message of every thread\r
137 +    thread=0\r
138 +    while read -a parents; do\r
139 +        parent=${parents[$n]}\r
140 +        generate_message \\r
141 +            [id]=m$n@t$thread [in-reply-to]="\<m$parent@t$thread\>" \\r
142 +            [subject]=p$thread [from]=m$n\r
143 +        thread=$((thread + 1))\r
144 +    done <<< "$THREADS"\r
145 +    notmuch new > /dev/null\r
146 +done\r
147 +output=$(notmuch search --sort=newest-first '*' | notmuch_search_sanitize)\r
148 +expected=$(for ((i = 0; i < $nthreads; i++)); do\r
149 +        echo "thread:XXX   2001-01-05 [4/4] m3, m2, m1, m0; p$i (inbox unread)"\r
150 +    done)\r
151 +test_expect_equal "$output" "$expected"\r
152 +\r
153 +test_begin_subtest "The same (full parent linkage)"\r
154 +test_subtest_known_broken\r
155 +# Here we do the same thing as the previous test, but each message\r
156 +# references all of its parents.  Since every message references the\r
157 +# root of the thread, each thread should always be fully joined.  This\r
158 +# is currently broken because of the bug detailed in\r
159 +# id:8738h7kv2q.fsf@qmul.ac.uk.\r
160 +rm ${MAIL_DIR}/*\r
161 +notmuch new\r
162 +output=""\r
163 +expected=""\r
164 +for ((n = 0; n < 4; n++)); do\r
165 +    # Deliver the n'th message of every thread\r
166 +    thread=0\r
167 +    while read -a parents; do\r
168 +        references=""\r
169 +        parent=${parents[$n]}\r
170 +        while [[ $parent != none ]]; do\r
171 +            references="<m$parent@t$thread> $references"\r
172 +            parent=${parents[$parent]}\r
173 +        done\r
174 +\r
175 +        generate_message \\r
176 +            [id]=m$n@t$thread [references]="'$references'" \\r
177 +            [subject]=p$thread [from]=m$n\r
178 +        thread=$((thread + 1))\r
179 +    done <<< "$THREADS"\r
180 +    notmuch new > /dev/null\r
181 +\r
182 +    output="$output\r
183 +$(notmuch search --sort=newest-first '*' | notmuch_search_sanitize)"\r
184 +\r
185 +    # Construct expected output\r
186 +    template="thread:XXX   2001-01-05 [$((n+1))/$((n+1))]"\r
187 +    for ((m = n; m > 0; m--)); do\r
188 +        template="$template m$m,"\r
189 +    done\r
190 +    expected="$expected\r
191 +$(for ((i = 0; i < $nthreads; i++)); do\r
192 +        echo "$template m0; p$i (inbox unread)"\r
193 +    done)"\r
194 +done\r
195 +test_expect_equal "$output" "$expected"\r
196 +\r
197 +test_done\r
198 -- \r
199 1.9.1\r
200 \r