1 Return-Path: <bremner@tethera.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 1B33E431FBF
\r
6 for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 11:05:36 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id 6KG9EgqPE4zO for <notmuch@notmuchmail.org>;
\r
16 Sun, 18 Nov 2012 11:05:34 -0800 (PST)
\r
17 Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])
\r
18 (using TLSv1 with cipher AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id A662A431FDE
\r
21 for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 11:05:19 -0800 (PST)
\r
22 Received: from fctnnbsc30w-156034089108.dhcp-dynamic.fibreop.nb.bellaliant.net
\r
23 ([156.34.89.108] helo=zancas.localnet)
\r
24 by tesseract.cs.unb.ca with esmtpsa
\r
25 (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72)
\r
26 (envelope-from <bremner@tethera.net>)
\r
27 id 1TaABC-00028D-Th; Sun, 18 Nov 2012 15:05:19 -0400
\r
28 Received: from bremner by zancas.localnet with local (Exim 4.80)
\r
29 (envelope-from <bremner@tethera.net>)
\r
30 id 1TaAB7-0001JA-FG; Sun, 18 Nov 2012 15:05:13 -0400
\r
31 From: david@tethera.net
\r
32 To: notmuch@notmuchmail.org
\r
33 Subject: [PATCH 13/16] test: second set of dump/restore --format=batch-tag
\r
35 Date: Sun, 18 Nov 2012 15:04:55 -0400
\r
36 Message-Id: <1353265498-3839-14-git-send-email-david@tethera.net>
\r
37 X-Mailer: git-send-email 1.7.10.4
\r
38 In-Reply-To: <1353265498-3839-1-git-send-email-david@tethera.net>
\r
39 References: <1353265498-3839-1-git-send-email-david@tethera.net>
\r
41 Cc: David Bremner <bremner@debian.org>
\r
42 X-BeenThere: notmuch@notmuchmail.org
\r
43 X-Mailman-Version: 2.1.13
\r
45 List-Id: "Use and development of the notmuch mail system."
\r
46 <notmuch.notmuchmail.org>
\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
50 List-Post: <mailto:notmuch@notmuchmail.org>
\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
54 X-List-Received-Date: Sun, 18 Nov 2012 19:05:36 -0000
\r
56 From: David Bremner <bremner@debian.org>
\r
58 These one need the completed functionality in notmuch-restore. Fairly
\r
59 exotic tags are tested, but no weird message id's.
\r
61 We test each possible input to autodetection, both explicit (with
\r
62 --format=auto) and implicit (without --format).
\r
64 test/dump-restore | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++
\r
65 1 file changed, 73 insertions(+)
\r
67 diff --git a/test/dump-restore b/test/dump-restore
\r
68 index e08b656..7b67d03 100755
\r
69 --- a/test/dump-restore
\r
70 +++ b/test/dump-restore
\r
71 @@ -85,6 +85,79 @@ test_begin_subtest "dump --output=outfile -- from:cworth"
\r
72 notmuch dump --output=dump-outfile-dash-inbox.actual -- from:cworth
\r
73 test_expect_equal_file dump-cworth.expected dump-outfile-dash-inbox.actual
\r
75 +test_begin_subtest "Check for a safe set of message-ids"
\r
76 +notmuch search --output=messages from:cworth > EXPECTED.$test_count
\r
77 +notmuch search --output=messages from:cworth |\
\r
78 + $TEST_DIRECTORY/hex-xcode --direction=encode > OUTPUT.$test_count
\r
79 +test_expect_equal_file OUTPUT.$test_count EXPECTED.$test_count
\r
81 +test_begin_subtest "format=batch-tag, # round-trip"
\r
82 +notmuch dump --format=sup | sort > EXPECTED.$test_count
\r
83 +notmuch dump --format=batch-tag | notmuch restore --format=batch-tag
\r
84 +notmuch dump --format=sup | sort > OUTPUT.$test_count
\r
85 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
\r
87 +tag1='comic_swear=$&^%$^%\\//-+$^%$'
\r
88 +enc1=$($TEST_DIRECTORY/hex-xcode --direction=encode "$tag1")
\r
90 +tag2=$(printf 'this\n tag\t has\n spaces')
\r
91 +enc2=$($TEST_DIRECTORY/hex-xcode --direction=encode "$tag2")
\r
93 +enc3='%c3%91%c3%a5%c3%b0%c3%a3%c3%a5%c3%a9-%c3%8f%c3%8a'
\r
94 +tag3=$($TEST_DIRECTORY/hex-xcode --direction=decode $enc3)
\r
96 +notmuch dump --format=batch-tag > BACKUP
\r
98 +notmuch tag +"$tag1" +"$tag2" +"$tag3" -inbox -unread "*"
\r
100 +test_begin_subtest 'format=batch-tag, round trip with strange tags'
\r
101 + notmuch dump --format=batch-tag > EXPECTED.$test_count
\r
102 + notmuch dump --format=batch-tag | notmuch restore --format=batch-tag
\r
103 + notmuch dump --format=batch-tag > OUTPUT.$test_count
\r
104 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
\r
106 +test_begin_subtest 'format=batch-tag, checking encoded output'
\r
107 + cp /dev/null EXPECTED.$test_count
\r
108 + notmuch dump --format=batch-tag -- from:cworth |\
\r
109 + awk "{ print \"+$enc1 +$enc2 +$enc3 -- \" \$5 }" > EXPECTED.$test_count
\r
111 + notmuch dump --format=batch-tag -- from:cworth > OUTPUT.$test_count
\r
112 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
\r
114 +test_begin_subtest 'restoring sane tags'
\r
115 + notmuch restore --format=batch-tag < BACKUP
\r
116 + notmuch dump --format=batch-tag > OUTPUT.$test_count
\r
117 +test_expect_equal_file BACKUP OUTPUT.$test_count
\r
119 +test_begin_subtest 'format=batch-tag, restore=auto'
\r
120 + notmuch dump --format=batch-tag > EXPECTED.$test_count
\r
121 + notmuch tag -inbox -unread "*"
\r
122 + notmuch restore --format=auto < EXPECTED.$test_count
\r
123 + notmuch dump --format=batch-tag > OUTPUT.$test_count
\r
124 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
\r
126 +test_begin_subtest 'format=sup, restore=auto'
\r
127 + notmuch dump --format=sup > EXPECTED.$test_count
\r
128 + notmuch tag -inbox -unread "*"
\r
129 + notmuch restore --format=auto < EXPECTED.$test_count
\r
130 + notmuch dump --format=sup > OUTPUT.$test_count
\r
131 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
\r
133 +test_begin_subtest 'format=batch-tag, restore=default'
\r
134 + notmuch dump --format=batch-tag > EXPECTED.$test_count
\r
135 + notmuch tag -inbox -unread "*"
\r
136 + notmuch restore < EXPECTED.$test_count
\r
137 + notmuch dump --format=batch-tag > OUTPUT.$test_count
\r
138 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
\r
140 +test_begin_subtest 'format=sup, restore=default'
\r
141 + notmuch dump --format=sup > EXPECTED.$test_count
\r
142 + notmuch tag -inbox -unread "*"
\r
143 + notmuch restore < EXPECTED.$test_count
\r
144 + notmuch dump --format=sup > OUTPUT.$test_count
\r
145 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
\r
147 +notmuch dump --format=batch-tag --output=save.tags
\r
149 test_expect_success 'roundtripping random message-ids and tags' \
\r
150 '${TEST_DIRECTORY}/random-corpus --num-messages=100 --config-path=${NOTMUCH_CONFIG} &&
\r