From 36bbe4401b2993dcc52a892d9c7cdd496adb075b Mon Sep 17 00:00:00 2001 From: David Bremner Date: Tue, 8 Apr 2014 07:37:48 +2100 Subject: [PATCH] Re: [PATCH] test: Test thread linking in all possible delivery orders --- ef/3b7c4dfb320f13fdefbb882f6c253aa0ba25e4 | 86 +++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 ef/3b7c4dfb320f13fdefbb882f6c253aa0ba25e4 diff --git a/ef/3b7c4dfb320f13fdefbb882f6c253aa0ba25e4 b/ef/3b7c4dfb320f13fdefbb882f6c253aa0ba25e4 new file mode 100644 index 000000000..8c7f3c714 --- /dev/null +++ b/ef/3b7c4dfb320f13fdefbb882f6c253aa0ba25e4 @@ -0,0 +1,86 @@ +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 D7056431FBC + for ; Mon, 7 Apr 2014 03:40:12 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 YkiKpMzYtA-b for ; + Mon, 7 Apr 2014 03:40:08 -0700 (PDT) +Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net + [87.98.215.224]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 13324431FB6 + for ; Mon, 7 Apr 2014 03:40:08 -0700 (PDT) +Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim + 4.72) (envelope-from ) + id 1WX6wJ-0007XK-Rx; Mon, 07 Apr 2014 10:38:07 +0000 +Received: (nullmailer pid 22010 invoked by uid 1000); Mon, 07 Apr 2014 + 10:37:48 -0000 +From: David Bremner +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH] test: Test thread linking in all possible delivery orders +In-Reply-To: <1395608456-9673-1-git-send-email-amdragon@mit.edu> +References: <1395608456-9673-1-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.17+174~g4efbc9f (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-pc-linux-gnu) +Date: Mon, 07 Apr 2014 07:37:48 -0300 +Message-ID: <87y4zhfmrn.fsf@maritornes.cs.unb.ca> +MIME-Version: 1.0 +Content-Type: text/plain +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: Mon, 07 Apr 2014 10:40:13 -0000 + +Austin Clements writes: +> +THREADS=$(python -c ' +> +def mkTrees(free, tree={}): +> + if not free: + +I'm not sure if using not for an empty set is idiomatic python or not, +but it did confuse me a moment. + +> + 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)))') + +FWIW, it took me a while to understand this. I might have twigged +faster if the initial comment said something like "via backtracking". + +> +output=$(notmuch search '*' | notmuch_search_sanitize) + +> +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" + +It seems to me this summary line depends on the default search order. +It might be worth specifying the search order in the "notmuch search" +command just to make it a bit more robust. + +d -- 2.26.2