[PATCH 06/10] cli: Introduce "notmuch address" command
[notmuch-archives.git] / c0 / e1ad393798e4fa52f11a759cd4caf335042035
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 0EF11429E34\r
6         for <notmuch@notmuchmail.org>; Tue, 11 Mar 2014 16:02:19 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\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 lVlqvLzWw8ZM for <notmuch@notmuchmail.org>;\r
16         Tue, 11 Mar 2014 16:02:18 -0700 (PDT)\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
18         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 3953D431FD0\r
21         for <notmuch@notmuchmail.org>; Tue, 11 Mar 2014 16:02:01 -0700 (PDT)\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
23         (envelope-from <bremner@tethera.net>)\r
24         id 1WNVgO-0001uX-AX; Tue, 11 Mar 2014 20:02:00 -0300\r
25 Received: (nullmailer pid 25857 invoked by uid 1000); Tue, 11 Mar 2014\r
26         23:01:46 -0000\r
27 From: David Bremner <david@tethera.net>\r
28 To: notmuch@notmuchmail.org\r
29 Subject: [Patch v6 09/14] test: add database upgrade test from format version\r
30         1 to 2\r
31 Date: Tue, 11 Mar 2014 20:01:35 -0300\r
32 Message-Id: <1394578900-25618-10-git-send-email-david@tethera.net>\r
33 X-Mailer: git-send-email 1.8.5.3\r
34 In-Reply-To: <1394578900-25618-1-git-send-email-david@tethera.net>\r
35 References: <1394578900-25618-1-git-send-email-david@tethera.net>\r
36 X-BeenThere: notmuch@notmuchmail.org\r
37 X-Mailman-Version: 2.1.13\r
38 Precedence: list\r
39 List-Id: "Use and development of the notmuch mail system."\r
40         <notmuch.notmuchmail.org>\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
42         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
44 List-Post: <mailto:notmuch@notmuchmail.org>\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
48 X-List-Received-Date: Tue, 11 Mar 2014 23:02:19 -0000\r
49 \r
50 From: Jani Nikula <jani@nikula.org>\r
51 \r
52 Test the upgrade from probabilistic to boolean folder: terms, and\r
53 addition of path: terms.\r
54 \r
55 The test depends on the pre-built test corpus and database tarball and\r
56 checksum file being in place. If it's not, the test is skipped. The\r
57 mechanism to fetch the test database will be added later.\r
58 \r
59 At the time of writing, a working test database and checksum file is\r
60 available at\r
61 \r
62    http://notmuchmail.org/releases/test-databases/\r
63 \r
64 It has been noted that some non-GNU environments make lack\r
65 sha256sum. We leave this portability issue for a followup patch.\r
66 ---\r
67  test/T530-upgrade.sh | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++\r
68  1 file changed, 111 insertions(+)\r
69  create mode 100755 test/T530-upgrade.sh\r
70 \r
71 diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh\r
72 new file mode 100755\r
73 index 0000000..2139618\r
74 --- /dev/null\r
75 +++ b/test/T530-upgrade.sh\r
76 @@ -0,0 +1,111 @@\r
77 +#!/usr/bin/env bash\r
78 +test_description="database upgrade"\r
79 +\r
80 +. ./test-lib.sh\r
81 +\r
82 +dbtarball=database-v1.tar.xz\r
83 +\r
84 +# XXX: Accomplish the same with test lib helpers\r
85 +if [ ! -e ${TEST_DIRECTORY}/test-databases/${dbtarball} ]; then\r
86 +    test_subtest_missing_external_prereq_["${dbtarball}"]=t\r
87 +fi\r
88 +\r
89 +test_expect_success \\r
90 +    'database checksum' \\r
91 +    '( cd $TEST_DIRECTORY/test-databases &&\r
92 +       sha256sum --quiet --check --status ${dbtarball}.sha256 )'\r
93 +\r
94 +tar xf $TEST_DIRECTORY/test-databases/${dbtarball} -C ${MAIL_DIR} --strip-components=1\r
95 +\r
96 +test_begin_subtest "folder: search does not work with old database version"\r
97 +output=$(notmuch search folder:foo)\r
98 +test_expect_equal "$output" ""\r
99 +\r
100 +test_begin_subtest "path: search does not work with old database version"\r
101 +output=$(notmuch search path:foo)\r
102 +test_expect_equal "$output" ""\r
103 +\r
104 +test_begin_subtest "database upgrade from format version 1"\r
105 +output=$(notmuch new)\r
106 +test_expect_equal "$output" "\\r
107 +Welcome to a new version of notmuch! Your database will now be upgraded.\r
108 +Your notmuch database has now been upgraded to database format version 2.\r
109 +No new mail."\r
110 +\r
111 +test_begin_subtest "folder: no longer matches in the middle of path"\r
112 +output=$(notmuch search folder:baz)\r
113 +test_expect_equal "$output" ""\r
114 +\r
115 +test_begin_subtest "folder: search"\r
116 +output=$(notmuch search --output=files folder:foo | notmuch_search_files_sanitize | sort)\r
117 +test_expect_equal "$output" "MAIL_DIR/foo/06:2,\r
118 +MAIL_DIR/foo/cur/07:2,\r
119 +MAIL_DIR/foo/cur/08:2,\r
120 +MAIL_DIR/foo/new/03:2,\r
121 +MAIL_DIR/foo/new/09:2,\r
122 +MAIL_DIR/foo/new/10:2,"\r
123 +\r
124 +test_begin_subtest "top level folder: search"\r
125 +output=$(notmuch search --output=files folder:'""' | notmuch_search_files_sanitize | sort)\r
126 +# bar/18:2, is a duplicate of cur/51:2,\r
127 +test_expect_equal "$output" "MAIL_DIR/01:2,\r
128 +MAIL_DIR/02:2,\r
129 +MAIL_DIR/bar/18:2,\r
130 +MAIL_DIR/cur/29:2,\r
131 +MAIL_DIR/cur/30:2,\r
132 +MAIL_DIR/cur/31:2,\r
133 +MAIL_DIR/cur/32:2,\r
134 +MAIL_DIR/cur/33:2,\r
135 +MAIL_DIR/cur/34:2,\r
136 +MAIL_DIR/cur/35:2,\r
137 +MAIL_DIR/cur/36:2,\r
138 +MAIL_DIR/cur/37:2,\r
139 +MAIL_DIR/cur/38:2,\r
140 +MAIL_DIR/cur/39:2,\r
141 +MAIL_DIR/cur/40:2,\r
142 +MAIL_DIR/cur/41:2,\r
143 +MAIL_DIR/cur/42:2,\r
144 +MAIL_DIR/cur/43:2,\r
145 +MAIL_DIR/cur/44:2,\r
146 +MAIL_DIR/cur/45:2,\r
147 +MAIL_DIR/cur/46:2,\r
148 +MAIL_DIR/cur/47:2,\r
149 +MAIL_DIR/cur/48:2,\r
150 +MAIL_DIR/cur/49:2,\r
151 +MAIL_DIR/cur/50:2,\r
152 +MAIL_DIR/cur/51:2,\r
153 +MAIL_DIR/cur/52:2,\r
154 +MAIL_DIR/cur/53:2,\r
155 +MAIL_DIR/new/04:2,"\r
156 +\r
157 +test_begin_subtest "path: search"\r
158 +output=$(notmuch search --output=files path:"bar" | notmuch_search_files_sanitize | sort)\r
159 +# cur/51:2, is a duplicate of bar/18:2,\r
160 +test_expect_equal "$output" "MAIL_DIR/bar/17:2,\r
161 +MAIL_DIR/bar/18:2,\r
162 +MAIL_DIR/cur/51:2,"\r
163 +\r
164 +test_begin_subtest "top level path: search"\r
165 +output=$(notmuch search --output=files path:'""' | notmuch_search_files_sanitize | sort)\r
166 +test_expect_equal "$output" "MAIL_DIR/01:2,\r
167 +MAIL_DIR/02:2,"\r
168 +\r
169 +test_begin_subtest "recursive path: search"\r
170 +output=$(notmuch search --output=files path:"bar/**" | notmuch_search_files_sanitize | sort)\r
171 +# cur/51:2, is a duplicate of bar/18:2,\r
172 +test_expect_equal "$output" "MAIL_DIR/bar/17:2,\r
173 +MAIL_DIR/bar/18:2,\r
174 +MAIL_DIR/bar/baz/05:2,\r
175 +MAIL_DIR/bar/baz/23:2,\r
176 +MAIL_DIR/bar/baz/24:2,\r
177 +MAIL_DIR/bar/baz/cur/25:2,\r
178 +MAIL_DIR/bar/baz/cur/26:2,\r
179 +MAIL_DIR/bar/baz/new/27:2,\r
180 +MAIL_DIR/bar/baz/new/28:2,\r
181 +MAIL_DIR/bar/cur/19:2,\r
182 +MAIL_DIR/bar/cur/20:2,\r
183 +MAIL_DIR/bar/new/21:2,\r
184 +MAIL_DIR/bar/new/22:2,\r
185 +MAIL_DIR/cur/51:2,"\r
186 +\r
187 +test_done\r
188 -- \r
189 1.8.5.3\r
190 \r