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 A8B24418C25 for ; Wed, 21 Apr 2010 14:56:27 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham 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 b3kWWHS4e1HE for ; Wed, 21 Apr 2010 14:56:26 -0700 (PDT) Received: from mail.hohndel.org (mail.hohndel.org [65.23.157.147]) by olra.theworths.org (Postfix) with ESMTP id 82755431FC1 for ; Wed, 21 Apr 2010 14:56:26 -0700 (PDT) Received: by mail.hohndel.org (Postfix, from userid 112) id 3F4C7340FA; Wed, 21 Apr 2010 17:56:26 -0400 (EDT) Received: from x200.gr8dns.org (unknown [65.23.157.147]) by mail.hohndel.org (Postfix) with ESMTP id F1575340F4; Wed, 21 Apr 2010 17:56:24 -0400 (EDT) Received: by x200.gr8dns.org (Postfix, from userid 500) id B6A3CC0212; Wed, 21 Apr 2010 14:56:24 -0700 (PDT) From: Dirk Hohndel To: Subject: [PATCH 1/2] add From guessing tests to test suite Date: Wed, 21 Apr 2010 14:55:57 -0700 Message-Id: <1271886958-3276-2-git-send-email-hohndel@infradead.org> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1271886958-3276-1-git-send-email-hohndel@infradead.org> References: <1271886958-3276-1-git-send-email-hohndel@infradead.org> 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: Wed, 21 Apr 2010 21:56:27 -0000 right now these are not trying to be overly fancy simply one test per strategy that we apply to figure out the best from address - including the fallback if there's nothing to go on Signed-off-by: Dirk Hohndel --- test/notmuch-test | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 102 insertions(+), 1 deletions(-) diff --git a/test/notmuch-test b/test/notmuch-test index 53ee189..855850c 100755 --- a/test/notmuch-test +++ b/test/notmuch-test @@ -60,6 +60,7 @@ increment_mtime () # '[cc]="Some User "' # [reply-to]=some-address # [in-reply-to]= +# '[header]=full header line, including keyword' # # Additional values for email headers. If these are not provided # then the relevant headers will simply not appear in the @@ -114,6 +115,11 @@ generate_message () fi additional_headers="" + if [ ! -z "${template[header]}" ]; then + additional_headers="${template[header]} +${additional_headers}" + fi + if [ ! -z "${template[reply-to]}" ]; then additional_headers="Reply-To: ${template[reply-to]} ${additional_headers}" @@ -129,6 +135,7 @@ ${additional_headers}" ${additional_headers}" fi + cat <$gen_msg_filename From: ${template[from]} To: ${template[to]} @@ -203,7 +210,7 @@ path=${MAIL_DIR} [user] name=Notmuch Test Suite primary_email=test_suite@notmuchmail.org -other_email=test_suite_other@notmuchmail.org +other_email=test_suite_other@notmuchmail.org;test_suite@otherdomain.org EOF printf "Testing \"notmuch new\" in several variations:\n" @@ -629,6 +636,100 @@ printf " Searching returns all three messages in one thread..." output=$($NOTMUCH search foo | notmuch_search_sanitize) pass_if_equal "$output" "thread:XXX 2000-01-01 [3/3] Notmuch Test Suite; brokenthreadtest (inbox unread)" +printf " Magic from guessing (nothing to go on)...\t" +add_message '[from]="Sender "' \ + [to]=mailinglist@notmuchmail.org \ + [subject]=notmuch-reply-test \ + '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +pass_if_equal "$output" "From: Notmuch Test Suite +Subject: Re: notmuch-reply-test +To: Sender , mailinglist@notmuchmail.org +In-Reply-To: <${gen_msg_id}> +References: <${gen_msg_id}> + +On Tue, 05 Jan 2010 15:43:56 -0800, Sender wrote: +> from guessing test" + +printf " Magic from guessing (Envelope-to:)...\t\t" +add_message '[from]="Sender "' \ + [to]=mailinglist@notmuchmail.org \ + [subject]=notmuch-reply-test \ + '[header]="Envelope-To: test_suite_other@notmuchmail.org"' \ + '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +pass_if_equal "$output" "From: Notmuch Test Suite +Subject: Re: notmuch-reply-test +To: Sender , mailinglist@notmuchmail.org +In-Reply-To: <${gen_msg_id}> +References: <${gen_msg_id}> + +On Tue, 05 Jan 2010 15:43:56 -0800, Sender wrote: +> from guessing test" + +printf " Magic from guessing (X-Original-To:)...\t" +add_message '[from]="Sender "' \ + [to]=mailinglist@notmuchmail.org \ + [subject]=notmuch-reply-test \ + '[header]="X-Original-To: test_suite_other@notmuchmail.org"' \ + '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +pass_if_equal "$output" "From: Notmuch Test Suite +Subject: Re: notmuch-reply-test +To: Sender , mailinglist@notmuchmail.org +In-Reply-To: <${gen_msg_id}> +References: <${gen_msg_id}> + +On Tue, 05 Jan 2010 15:43:56 -0800, Sender wrote: +> from guessing test" + +printf " Magic from guessing (Received: .. for ..)...\t" +add_message '[from]="Sender "' \ + [to]=mailinglist@notmuchmail.org \ + [subject]=notmuch-reply-test \ + '[header]="Received: from mail.example.com (mail.example.com [1.1.1.1])\ + by mail.notmuchmail.org (some MTA) with ESMTP id 12345678\ + for ; Sat, 10 Apr 2010 07:54:51 -0400 (EDT)"' \ + '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +pass_if_equal "$output" "From: Notmuch Test Suite +Subject: Re: notmuch-reply-test +To: Sender , mailinglist@notmuchmail.org +In-Reply-To: <${gen_msg_id}> +References: <${gen_msg_id}> + +On Tue, 05 Jan 2010 15:43:56 -0800, Sender wrote: +> from guessing test" + +printf " Magic from guessing (Received: domain)...\t" +add_message '[from]="Sender "' \ + [to]=mailinglist@notmuchmail.org \ + [subject]=notmuch-reply-test \ + '[header]="Received: from mail.example.com (mail.example.com [1.1.1.1])\ + by mail.otherdomain.org (some MTA) with ESMTP id 12345678\ + Sat, 10 Apr 2010 07:54:51 -0400 (EDT)"' \ + '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \ + '[body]="from guessing test"' + +output=$($NOTMUCH reply id:${gen_msg_id}) +pass_if_equal "$output" "From: Notmuch Test Suite +Subject: Re: notmuch-reply-test +To: Sender , mailinglist@notmuchmail.org +In-Reply-To: <${gen_msg_id}> +References: <${gen_msg_id}> + +On Tue, 05 Jan 2010 15:43:56 -0800, Sender wrote: +> from guessing test" + + echo "" echo "Notmuch test suite complete." -- 1.6.6.1