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 890B9431FBD
\r
6 for <notmuch@notmuchmail.org>; Sun, 23 Mar 2014 14:01:25 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 umAYWFbDynLk for <notmuch@notmuchmail.org>;
\r
16 Sun, 23 Mar 2014 14:01:19 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-6.mit.edu (dmz-mailsec-scanner-6.mit.edu
\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 C2642431FB6
\r
22 for <notmuch@notmuchmail.org>; Sun, 23 Mar 2014 14:01:18 -0700 (PDT)
\r
23 X-AuditID: 12074423-f79476d000000c51-28-532f4b9df6c2
\r
24 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])
\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-6.mit.edu (Symantec Messaging Gateway) with SMTP
\r
28 id 85.13.03153.D9B4F235; Sun, 23 Mar 2014 17:01:17 -0400 (EDT)
\r
29 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])
\r
30 by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id s2NL1FlT028087;
\r
31 Sun, 23 Mar 2014 17:01:15 -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 s2NL1Dt9010614
\r
37 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
38 Sun, 23 Mar 2014 17:01:15 -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 1WRpW0-0002Zy-58; Sun, 23 Mar 2014 17:01:08 -0400
\r
42 From: Austin Clements <amdragon@MIT.EDU>
\r
43 To: notmuch@notmuchmail.org
\r
44 Subject: [PATCH] test: Test thread linking in all possible delivery orders
\r
45 Date: Sun, 23 Mar 2014 17:00:56 -0400
\r
46 Message-Id: <1395608456-9673-1-git-send-email-amdragon@mit.edu>
\r
47 X-Mailer: git-send-email 1.8.4.rc3
\r
48 X-Brightmail-Tracker:
\r
49 H4sIAAAAAAAAA+NgFprJIsWRmVeSWpSXmKPExsUixG6nojvXWz/YYN8fA4vrN2cyOzB6PFt1
\r
50 izmAMYrLJiU1J7MstUjfLoEr4/SnJ0wFb4Urll/6zd7AuJ6/i5GTQ0LAROJmQy87hC0mceHe
\r
51 ejYQW0hgNpPEypXRXYxcQPZGRok1HVcYIRJ3mCSuTFSCSMxllLhyo50FJMEmoCGxbf9ysCIR
\r
52 AWmJnXdns3YxcnAwC6hJ/OlSAQkLC3hJHF7YBbaMRUBVYtr1DmYQm1fAXuLVqWZGiCOUJBae
\r
53 2sY6gZF3ASPDKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl0zvdzMEr3UlNJNjOAQcFHewfjnoNIh
\r
54 RgEORiUe3hOfdIOFWBPLiitzDzFKcjApifL+dtcPFuJLyk+pzEgszogvKs1JLT7EKMHBrCTC
\r
55 G+kKlONNSaysSi3Kh0lJc7AoifPKc2gHCwmkJ5akZqemFqQWwWRlODiUJHgzvIAaBYtS01Mr
\r
56 0jJzShDSTBycIMN5gIbP8wQZXlyQmFucmQ6RP8WoKCXOmwzSLACSyCjNg+uFxegrRnGgV4R5
\r
57 J4FU8QDjG677FdBgJqDB4U16IINLEhFSUg2MF/ZouJ/Unc3MItMZPnV5EstWv9KNzGX9F3Tf
\r
58 fm4I0P2zYSrT1F89O6/nll5t913Xz3MhQONDRrTq1x0fry5fOGliZef0FjGOvH4mrWvLNu49
\r
59 neB/5uD902bfmfWXiQv+UFh/jX/Cc40V74rThYSe5PnyZx68yH1HiKX/YGHht+9CNlnfe54H
\r
60 KbEUZyQaajEXFScCAFA3WyisAgAA
\r
61 X-BeenThere: notmuch@notmuchmail.org
\r
62 X-Mailman-Version: 2.1.13
\r
64 List-Id: "Use and development of the notmuch mail system."
\r
65 <notmuch.notmuchmail.org>
\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
69 List-Post: <mailto:notmuch@notmuchmail.org>
\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
73 X-List-Received-Date: Sun, 23 Mar 2014 21:01:25 -0000
\r
75 This test delivers all possible (single-root) four-message threads in
\r
76 all possible orders and checks that notmuch successfully links them
\r
77 into threads in every case.
\r
79 This is introduced as a new test (rather than just adding it to
\r
80 T050-new) because it's much easier for this to start with an empty
\r
84 I thought I saw a bug in the thread linking code. It turned out to be
\r
85 okay, but I wrote this test to convince myself.
\r
87 As far as I can tell, we don't have any tests specifically for thread
\r
88 linking. We certainly don't have any that are this systematic.
\r
90 test/T051-new-linking.sh | 43 +++++++++++++++++++++++++++++++++++++++++++
\r
91 1 file changed, 43 insertions(+)
\r
92 create mode 100755 test/T051-new-linking.sh
\r
94 diff --git a/test/T051-new-linking.sh b/test/T051-new-linking.sh
\r
95 new file mode 100755
\r
96 index 0000000..b6d778a
\r
98 +++ b/test/T051-new-linking.sh
\r
100 +#!/usr/bin/env bash
\r
101 +test_description='"notmuch new" thread linking'
\r
105 +test_begin_subtest "All four-message threads get linked in all delivery orders"
\r
106 +# Generate all possible single-root four message thread structures.
\r
107 +# Each line in THREADS is a thread structure, where the n'th field is
\r
108 +# the parent of message n.
\r
109 +THREADS=$(python -c '
\r
110 +def mkTrees(free, tree={}):
\r
112 + print(" ".join(map(str, [msg[1] for msg in sorted(tree.items())])))
\r
114 + # Attach each free message to each message in the tree (if there is
\r
115 + # no tree, make the free message the root)
\r
116 + for msg in sorted(free):
\r
117 + parents = sorted(tree.keys()) if tree else ["none"]
\r
118 + for parent in parents:
\r
119 + ntree = tree.copy()
\r
120 + ntree[msg] = parent
\r
121 + mkTrees(free - set([msg]), ntree)
\r
122 +mkTrees(set(range(4)))')
\r
123 +for ((n = 0; n < 4; n++)); do
\r
124 + # Deliver the n'th message of every thread
\r
126 + while read -a parents; do
\r
127 + parent=${parents[$n]}
\r
128 + generate_message \
\r
129 + [id]=m$n@t$thread [in-reply-to]="\<m$parent@t$thread\>" \
\r
130 + [subject]=p$thread [from]=m$n
\r
131 + thread=$((thread + 1))
\r
132 + done <<< "$THREADS"
\r
133 + notmuch new > /dev/null
\r
135 +output=$(notmuch search '*' | notmuch_search_sanitize)
\r
136 +nthreads=$(wc -l <<< "$THREADS")
\r
137 +expected=$(for ((i = 0; i < $nthreads; i++)); do
\r
138 + echo "thread:XXX 2001-01-05 [4/4] m3, m2, m1, m0; p$i (inbox unread)"
\r
140 +test_expect_equal "$output" "$expected"
\r