From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 8C5CA6DE00CB for ; Sat, 19 Sep 2015 09:30:32 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.113 X-Spam-Level: X-Spam-Status: No, score=0.113 tagged_above=-999 required=5 tests=[AWL=0.113] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gitF3RI1j43o for ; Sat, 19 Sep 2015 09:30:31 -0700 (PDT) X-Greylist: delayed 2620 seconds by postgrey-1.35 at arlo; Sat, 19 Sep 2015 09:30:30 PDT Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224]) by arlo.cworth.org (Postfix) with ESMTPS id CB6DA6DE009A for ; Sat, 19 Sep 2015 09:30:30 -0700 (PDT) Received: from remotemail by gitolite.debian.net with local (Exim 4.80) (envelope-from ) id 1ZdKL1-0002fw-EB; Sat, 19 Sep 2015 15:46:07 +0000 Received: (nullmailer pid 25920 invoked by uid 1000); Sat, 19 Sep 2015 15:45:48 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH] test: add sanity tests for threading Date: Sat, 19 Sep 2015 12:45:42 -0300 Message-Id: <1442677542-25879-1-git-send-email-david@tethera.net> X-Mailer: git-send-email 2.5.1 In-Reply-To: References: X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.18 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: Sat, 19 Sep 2015 16:30:32 -0000 These tests are inspired by a problem report id:CAJhTkNh7_hXDLsAGyD7nwkXV4ca6ymkLtFG945USvfqK4ZJEdQ@mail.gmail.com Of course I can't duplicate the mentioned problem, it probably depends on specific message data. --- test/T580-thread-search.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 test/T580-thread-search.sh diff --git a/test/T580-thread-search.sh b/test/T580-thread-search.sh new file mode 100755 index 0000000..6f7106d --- /dev/null +++ b/test/T580-thread-search.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2015 David Bremner +# + +test_description='test of searching by thread-id' + +. ./test-lib.sh || exit 1 + +add_email_corpus + +test_begin_subtest "Every message is found in exactly one thread" + +count=0 +success=0 +for id in $(notmuch search --output=messages '*'); do + count=$((count +1)) + matches=$(notmuch search --output=threads "$id" | wc -l) + if [ "$matches" = 1 ]; then + success=$((success + 1)) + fi +done + +test_expect_equal "$count" "$success" + +test_begin_subtest "roundtripping message-ids via thread-ids" + +count=0 +success=0 +for id in $(notmuch search --output=messages '*'); do + count=$((count +1)) + thread=$(notmuch search --output=threads "$id") + matched=$(notmuch search --output=messages "$thread" | grep "$id") + if [ "$matched" = "$id" ]; then + success=$((success + 1)) + fi +done + +test_expect_equal "$count" "$success" + + +test_done -- 2.5.1