From 77c46cb6fc7484e95ad596f37a5ca517cac32323 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Mon, 24 Mar 2014 17:00:56 +2000 Subject: [PATCH] [PATCH] test: Test thread linking in all possible delivery orders --- 74/32575560043c9aa2ce4ee09ec27d380e2fed6f | 145 ++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 74/32575560043c9aa2ce4ee09ec27d380e2fed6f diff --git a/74/32575560043c9aa2ce4ee09ec27d380e2fed6f b/74/32575560043c9aa2ce4ee09ec27d380e2fed6f new file mode 100644 index 000000000..d04542430 --- /dev/null +++ b/74/32575560043c9aa2ce4ee09ec27d380e2fed6f @@ -0,0 +1,145 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 890B9431FBD + for ; Sun, 23 Mar 2014 14:01:25 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id umAYWFbDynLk for ; + Sun, 23 Mar 2014 14:01:19 -0700 (PDT) +Received: from dmz-mailsec-scanner-6.mit.edu (dmz-mailsec-scanner-6.mit.edu + [18.7.68.35]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id C2642431FB6 + for ; Sun, 23 Mar 2014 14:01:18 -0700 (PDT) +X-AuditID: 12074423-f79476d000000c51-28-532f4b9df6c2 +Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) + (using TLS with cipher AES256-SHA (256/256 bits)) + (Client did not present a certificate) + by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP + id 85.13.03153.D9B4F235; Sun, 23 Mar 2014 17:01:17 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id s2NL1FlT028087; + Sun, 23 Mar 2014 17:01:15 -0400 +Received: from drake.dyndns.org + (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com + [216.15.114.40]) (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s2NL1Dt9010614 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Sun, 23 Mar 2014 17:01:15 -0400 +Received: from amthrax by drake.dyndns.org with local (Exim 4.77) + (envelope-from ) + id 1WRpW0-0002Zy-58; Sun, 23 Mar 2014 17:01:08 -0400 +From: Austin Clements +To: notmuch@notmuchmail.org +Subject: [PATCH] test: Test thread linking in all possible delivery orders +Date: Sun, 23 Mar 2014 17:00:56 -0400 +Message-Id: <1395608456-9673-1-git-send-email-amdragon@mit.edu> +X-Mailer: git-send-email 1.8.4.rc3 +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFprJIsWRmVeSWpSXmKPExsUixG6nojvXWz/YYN8fA4vrN2cyOzB6PFt1 + izmAMYrLJiU1J7MstUjfLoEr4/SnJ0wFb4Urll/6zd7AuJ6/i5GTQ0LAROJmQy87hC0mceHe + ejYQW0hgNpPEypXRXYxcQPZGRok1HVcYIRJ3mCSuTFSCSMxllLhyo50FJMEmoCGxbf9ysCIR + AWmJnXdns3YxcnAwC6hJ/OlSAQkLC3hJHF7YBbaMRUBVYtr1DmYQm1fAXuLVqWZGiCOUJBae + 2sY6gZF3ASPDKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl0zvdzMEr3UlNJNjOAQcFHewfjnoNIh + RgEORiUe3hOfdIOFWBPLiitzDzFKcjApifL+dtcPFuJLyk+pzEgszogvKs1JLT7EKMHBrCTC + G+kKlONNSaysSi3Kh0lJc7AoifPKc2gHCwmkJ5akZqemFqQWwWRlODiUJHgzvIAaBYtS01Mr + 0jJzShDSTBycIMN5gIbP8wQZXlyQmFucmQ6RP8WoKCXOmwzSLACSyCjNg+uFxegrRnGgV4R5 + J4FU8QDjG677FdBgJqDB4U16IINLEhFSUg2MF/ZouJ/Unc3MItMZPnV5EstWv9KNzGX9F3Tf + fm4I0P2zYSrT1F89O6/nll5t913Xz3MhQONDRrTq1x0fry5fOGliZef0FjGOvH4mrWvLNu49 + neB/5uD902bfmfWXiQv+UFh/jX/Cc40V74rThYSe5PnyZx68yH1HiKX/YGHht+9CNlnfe54H + KbEUZyQaajEXFScCAFA3WyisAgAA +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 23 Mar 2014 21:01:25 -0000 + +This test delivers all possible (single-root) four-message threads in +all possible orders and checks that notmuch successfully links them +into threads in every case. + +This is introduced as a new test (rather than just adding it to +T050-new) because it's much easier for this to start with an empty +database. +--- + +I thought I saw a bug in the thread linking code. It turned out to be +okay, but I wrote this test to convince myself. + +As far as I can tell, we don't have any tests specifically for thread +linking. We certainly don't have any that are this systematic. + + test/T051-new-linking.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 43 insertions(+) + create mode 100755 test/T051-new-linking.sh + +diff --git a/test/T051-new-linking.sh b/test/T051-new-linking.sh +new file mode 100755 +index 0000000..b6d778a +--- /dev/null ++++ b/test/T051-new-linking.sh +@@ -0,0 +1,43 @@ ++#!/usr/bin/env bash ++test_description='"notmuch new" thread linking' ++ ++. ./test-lib.sh ++ ++test_begin_subtest "All four-message threads get linked in all delivery orders" ++# Generate all possible single-root four message thread structures. ++# Each line in THREADS is a thread structure, where the n'th field is ++# the parent of message n. ++THREADS=$(python -c ' ++def mkTrees(free, tree={}): ++ if not free: ++ print(" ".join(map(str, [msg[1] for msg in sorted(tree.items())]))) ++ return ++ # Attach each free message to each message in the tree (if there is ++ # no tree, make the free message the root) ++ for msg in sorted(free): ++ parents = sorted(tree.keys()) if tree else ["none"] ++ for parent in parents: ++ ntree = tree.copy() ++ ntree[msg] = parent ++ mkTrees(free - set([msg]), ntree) ++mkTrees(set(range(4)))') ++for ((n = 0; n < 4; n++)); do ++ # Deliver the n'th message of every thread ++ thread=0 ++ while read -a parents; do ++ parent=${parents[$n]} ++ generate_message \ ++ [id]=m$n@t$thread [in-reply-to]="\" \ ++ [subject]=p$thread [from]=m$n ++ thread=$((thread + 1)) ++ done <<< "$THREADS" ++ notmuch new > /dev/null ++done ++output=$(notmuch search '*' | notmuch_search_sanitize) ++nthreads=$(wc -l <<< "$THREADS") ++expected=$(for ((i = 0; i < $nthreads; i++)); do ++ echo "thread:XXX 2001-01-05 [4/4] m3, m2, m1, m0; p$i (inbox unread)" ++ done) ++test_expect_equal "$output" "$expected" ++ ++test_done +-- +1.8.4.rc3 + -- 2.26.2