From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id E2DFC414394 for ; Sat, 14 Jan 2012 17:41:01 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.3 X-Spam-Level: X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3] 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 9byiJnbAuHs8 for ; Sat, 14 Jan 2012 17:41:00 -0800 (PST) Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 56C5641439E for ; Sat, 14 Jan 2012 17:40:52 -0800 (PST) Received: from zancas.localnet (fctnnbsc36w-156034076032.pppoe-dynamic.High-Speed.nb.bellaliant.net [156.34.76.32]) (authenticated bits=0) by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id q0F1egMs008576 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Sat, 14 Jan 2012 21:40:44 -0400 Received: from bremner by zancas.localnet with local (Exim 4.77) (envelope-from ) id 1RmF5N-000437-T0; Sat, 14 Jan 2012 21:40:41 -0400 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH v3 10/10] test: new random message-id and tags dump/restore test. Date: Sat, 14 Jan 2012 21:40:24 -0400 Message-Id: <1326591624-15493-11-git-send-email-david@tethera.net> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1326591624-15493-1-git-send-email-david@tethera.net> References: <874nwxbkhr.fsf@zancas.localnet> <1326591624-15493-1-git-send-email-david@tethera.net> Cc: David Bremner 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, 15 Jan 2012 01:41:02 -0000 From: David Bremner The idea is to generate a random dump file, and then generate minimal mail messages from that. Currently this relies on the behaviour of the gmime message-id parser that if it cannot find a leading '<' in the Message-Id field, it just copies the string without attempting to parse it. The alternative is to settle for some weaker notion of round-tripping in this test. --- test/dump-restore | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/test/dump-restore b/test/dump-restore index 60ae68e..c354a44 100755 --- a/test/dump-restore +++ b/test/dump-restore @@ -160,4 +160,29 @@ test_begin_subtest 'format=sup, restore=default' notmuch dump --format=sup > OUTPUT.$test_count test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count +test_begin_subtest 'random message-ids and tags' + + count=0 + + ${TEST_DIRECTORY}/random-dump sort > EXPECTED.$test_count + + while read id tags ; do + file=${MAIL_DIR}/cur/dump-$count:2, + count=$((count + 1)) + printf 'From: dump-test@example.com\n' > ${file} + printf 'To: example@example.net\n' > ${file} + printf 'Subject: StrangeMessageIDsAndTags\n' > ${file} + # the missing angle-braces are intentional, since they trigger + # gmime to pass the message-id through unparsed. + printf 'Message-Id: ' >> $file + ${TEST_DIRECTORY}/hex-xcode --direction=decode $id >> $file + done < EXPECTED.$test_count + + notmuch new + notmuch restore < EXPECTED.$test_count + notmuch dump --format=notmuch -- subject:StrangeMessageIDsAndTags | \ + sed 's/ *$//' | sort > OUTPUT.$test_count + +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count + test_done -- 1.7.7.3