Re: [PATCH v4 07/11] lib: added interface notmuch_thread_get_flag_messages
[notmuch-archives.git] / bd / bdc877025f4b291eafaed127d6df0a2154f693
1 Return-Path: <dmitry.kurochkin@gmail.com>\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 CA8EF429E27\r
6         for <notmuch@notmuchmail.org>; Mon,  9 May 2011 22:59:02 -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.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id MyoZ4PuZPFGr for <notmuch@notmuchmail.org>;\r
17         Mon,  9 May 2011 22:59:01 -0700 (PDT)\r
18 Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com\r
19         [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 72BC5429E26\r
22         for <notmuch@notmuchmail.org>; Mon,  9 May 2011 22:59:01 -0700 (PDT)\r
23 Received: by fxm8 with SMTP id 8so4396316fxm.26\r
24         for <notmuch@notmuchmail.org>; Mon, 09 May 2011 22:59:00 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=domainkey-signature:from:to:cc:subject:in-reply-to:references\r
27         :user-agent:date:message-id:mime-version:content-type\r
28         :content-transfer-encoding;\r
29         bh=pMdRAwsy/sjc0B44OZT/Uf7RiyvPr26JbtcF1rpahug=;\r
30         b=a2pg/OsrMYPbixwHVugFpnVBUallsinUXPy5cIliOlkY2mlUluC0bt1cJ1w+LKFYgH\r
31         XRjZ2IcaQXlu6F2shnJqNH1SpWV6AAmXKrCH1KiqYDFIZ4pxwmC9bY6O8G3n/I2yhUlE\r
32         zjOX4y9xo7jI13E4pFJUDx32cNVkf5Nia+vvk=\r
33 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
34         h=from:to:cc:subject:in-reply-to:references:user-agent:date\r
35         :message-id:mime-version:content-type:content-transfer-encoding;\r
36         b=jFeyRhA+UtWxcqjMnzRWuWmikaKhN5el9vi9xKtN6nKJJRMWkluLojKvHFeGr6HElZ\r
37         CyKywRhDsit12NxwI1CTd4uIZzgkxeiQ8OC+gO603cPKxuTOyfH4Lk0hOExp7NTwFpYQ\r
38         bXuP0fsI73LTSoErOdeD28byIeZwLkNxX8Y2w=\r
39 Received: by 10.223.134.68 with SMTP id i4mr2880933fat.87.1305007139175;\r
40         Mon, 09 May 2011 22:58:59 -0700 (PDT)\r
41 Received: from localhost ([91.144.186.21])\r
42         by mx.google.com with ESMTPS id s17sm734916fau.37.2011.05.09.22.58.57\r
43         (version=TLSv1/SSLv3 cipher=OTHER);\r
44         Mon, 09 May 2011 22:58:58 -0700 (PDT)\r
45 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
46 To: Austin Clements <amdragon@mit.edu>\r
47 Subject: Re: [PATCH] test: add "%s" format string to all `message' calls in\r
48         emacs tests\r
49 In-Reply-To: <BANLkTi=7nAq=Hx=AwaPe=wKrC_t95OETQw@mail.gmail.com>\r
50 References: <1305006007-26445-1-git-send-email-dmitry.kurochkin@gmail.com>\r
51         <BANLkTi=7nAq=Hx=AwaPe=wKrC_t95OETQw@mail.gmail.com>\r
52 User-Agent: Notmuch/ (http://notmuchmail.org) Emacs/23.3.1\r
53         (x86_64-pc-linux-gnu)\r
54 Date: Tue, 10 May 2011 09:59:17 +0400\r
55 Message-ID: <87y62fxfii.fsf@gmail.com>\r
56 MIME-Version: 1.0\r
57 Content-Type: text/plain; charset=utf-8\r
58 Content-Transfer-Encoding: quoted-printable\r
59 Cc: Notmuch Mail <notmuch@notmuchmail.org>\r
60 X-BeenThere: notmuch@notmuchmail.org\r
61 X-Mailman-Version: 2.1.13\r
62 Precedence: list\r
63 List-Id: "Use and development of the notmuch mail system."\r
64         <notmuch.notmuchmail.org>\r
65 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
67 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
68 List-Post: <mailto:notmuch@notmuchmail.org>\r
69 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
70 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
72 X-List-Received-Date: Tue, 10 May 2011 05:59:02 -0000\r
73 \r
74 On Tue, 10 May 2011 01:47:17 -0400, Austin Clements <amdragon@mit.edu> wrot=\r
75 e:\r
76 > This looks good to me (and is certainly more correct), but seems\r
77 > rather roundabout.  Is there a reason this code doesn't simply (princ\r
78 > (buffer-string))?\r
79 >=20\r
80 \r
81 Thanks, Austin!\r
82 \r
83 I am, unfortunately, not an Emacs Lisp expert.  I did not know about\r
84 princ, so I improved what we had :) Princ seems to work fine.  And\r
85 certainly looks cleaner than using message and capturing stderr.  It\r
86 also fixes the segfault.\r
87 \r
88 I will send another patch that uses princ instead of message.\r
89 \r
90 Regards,\r
91   Dmitry\r
92 \r
93 > On Tue, May 10, 2011 at 1:40 AM, Dmitry Kurochkin\r
94 > <dmitry.kurochkin@gmail.com> wrote:\r
95 > > The patch replaces all (message (buffer-string)) calls in emacs\r
96 > > tests with (message "%s" (buffer-string)). =C2=A0This works around an\r
97 > > Emacs (23.3+1-1 on current Debian Unstable) segfault in "Ensure\r
98 > > that emacs doesn't drop results" test. =C2=A0Note: the segfault does\r
99 > > not happen on every test run. =C2=A0Though, it seems to be\r
100 > > consistently reproducible if the test uses 300 messages instead\r
101 > > of 30. =C2=A0Hopefully, it is the crash described in Emacs bug #8545\r
102 > > [1] which is already fixed.\r
103 > >\r
104 > > Also, the patch makes the code more correct - we want to avoid\r
105 > > accidentally interpreting '%' as format specifiers.\r
106 > >\r
107 > > [1] http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D8545\r
108 > > ---\r
109 > >\r
110 > > The patch applies to the release-candidate/0.6 branch.\r
111 > >\r
112 > > Regards,\r
113 > > =C2=A0Dmitry\r
114 > >\r
115 > >\r
116 > > =C2=A0test/emacs =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=\r
117 =A0 =C2=A0 =C2=A0 | =C2=A0 18 +++++++++---------\r
118 > > =C2=A0test/emacs-large-search-buffer | =C2=A0 =C2=A05 +++--\r
119 > > =C2=A02 files changed, 12 insertions(+), 11 deletions(-)\r
120 > >\r
121 > > diff --git a/test/emacs b/test/emacs\r
122 > > index b376033..5b39423 100755\r
123 > > --- a/test/emacs\r
124 > > +++ b/test/emacs\r
125 > > @@ -7,38 +7,38 @@ EXPECTED=3D../emacs.expected-output\r
126 > > =C2=A0add_email_corpus\r
127 > >\r
128 > > =C2=A0test_begin_subtest "Basic notmuch-hello view in emacs"\r
129 > > -output=3D$(test_emacs '(notmuch-hello) (message (buffer-string))' 2>&1)\r
130 > > +output=3D$(test_emacs '(notmuch-hello) (message "%s" (buffer-string))'=\r
131  2>&1)\r
132 > > =C2=A0expected=3D$(cat $EXPECTED/notmuch-hello)\r
133 > > =C2=A0test_expect_equal "$output" "$expected"\r
134 > >\r
135 > > =C2=A0test_begin_subtest "Saved search with 0 results"\r
136 > > -output=3D$(test_emacs '(setq notmuch-show-empty-saved-searches t) (set=\r
137 q notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unre=\r
138 ad") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (message (buffer-stri=\r
139 ng))' 2>&1)\r
140 > > +output=3D$(test_emacs '(setq notmuch-show-empty-saved-searches t) (set=\r
141 q notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unre=\r
142 ad") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (message "%s" (buffer=\r
143 -string))' 2>&1)\r
144 > > =C2=A0expected=3D$(cat $EXPECTED/notmuch-hello-with-empty)\r
145 > > =C2=A0test_expect_equal "$output" "$expected"\r
146 > >\r
147 > > =C2=A0test_begin_subtest "No saved searches displayed (all with 0 resul=\r
148 ts)"\r
149 > > -output=3D$(test_emacs '(setq notmuch-saved-searches '\''(("empty" . "t=\r
150 ag:doesnotexist"))) (notmuch-hello) (message (buffer-string))' 2>&1)\r
151 > > +output=3D$(test_emacs '(setq notmuch-saved-searches '\''(("empty" . "t=\r
152 ag:doesnotexist"))) (notmuch-hello) (message "%s" (buffer-string))' 2>&1)\r
153 > > =C2=A0expected=3D$(cat $EXPECTED/notmuch-hello-no-saved-searches)\r
154 > > =C2=A0test_expect_equal "$output" "$expected"\r
155 > >\r
156 > > =C2=A0test_begin_subtest "Basic notmuch-search view in emacs"\r
157 > > -output=3D$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait=\r
158 ) (message (buffer-string))' 2>&1)\r
159 > > +output=3D$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait=\r
160 ) (message "%s" (buffer-string))' 2>&1)\r
161 > > =C2=A0expected=3D$(cat $EXPECTED/notmuch-search-tag-inbox)\r
162 > > =C2=A0test_expect_equal "$output" "$expected"\r
163 > >\r
164 > > =C2=A0test_begin_subtest "Navigation of notmuch-hello to search results"\r
165 > > -output=3D$(test_emacs '(notmuch-hello) (goto-char (point-min)) (re-sea=\r
166 rch-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) (mes=\r
167 sage (buffer-string))' 2>&1)\r
168 > > +output=3D$(test_emacs '(notmuch-hello) (goto-char (point-min)) (re-sea=\r
169 rch-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) (mes=\r
170 sage "%s" (buffer-string))' 2>&1)\r
171 > > =C2=A0expected=3D$(cat $EXPECTED/notmuch-hello-view-inbox)\r
172 > > =C2=A0test_expect_equal "$output" "$expected"\r
173 > >\r
174 > > =C2=A0test_begin_subtest "Basic notmuch-show view in emacs"\r
175 > > =C2=A0maildir_storage_thread=3D$(notmuch search --output=3Dthreads id:2=\r
176 0091117190054.GU3165@dottiness.seas.harvard.edu)\r
177 > > -output=3D$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (mes=\r
178 sage (buffer-string))" 2>&1)\r
179 > > +output=3D$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (mes=\r
180 sage \"%s\" (buffer-string))" 2>&1)\r
181 > > =C2=A0expected=3D$(cat $EXPECTED/notmuch-show-thread-maildir-storage)\r
182 > > =C2=A0test_expect_equal "$output" "$expected"\r
183 > >\r
184 > > =C2=A0test_begin_subtest "Navigation of notmuch-search to thread view"\r
185 > > -output=3D$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait=\r
186 ) (goto-char (point-min)) (re-search-forward "Working with Maildir") (notmu=\r
187 ch-search-show-thread) (notmuch-test-wait) (message (buffer-string))' 2>&1)\r
188 > > +output=3D$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait=\r
189 ) (goto-char (point-min)) (re-search-forward "Working with Maildir") (notmu=\r
190 ch-search-show-thread) (notmuch-test-wait) (message "%s" (buffer-string))' =\r
191 2>&1)\r
192 > > =C2=A0test_expect_equal "$output" "$expected"\r
193 > >\r
194 > > =C2=A0test_begin_subtest "Add tag from search view"\r
195 > > @@ -102,7 +102,7 @@ test_expect_equal "$output" "thread:XXX =C2=A0 1974=\r
196 -03-29 [1/1] Notmuch Test Suite; T\r
197 > > =C2=A0test_begin_subtest "Reply within emacs"\r
198 > > =C2=A0# We sed away everything before the ^From in the output to avoid =\r
199 getting\r
200 > > =C2=A0# confused by messages such as "Parsing /home/cworth/.mailrc... d=\r
201 one"\r
202 > > -output=3D$(test_emacs '(notmuch-search "subject:\"testing message sent=\r
203  via SMTP\"") (notmuch-test-wait) (notmuch-search-reply-to-thread) (message=\r
204  (buffer-string))' 2>&1 | sed -ne '/^From/,$ p' | sed -e 's/^In-Reply-To: <=\r
205 .*>$/In-Reply-To: <XXX>/')\r
206 > > +output=3D$(test_emacs '(notmuch-search "subject:\"testing message sent=\r
207  via SMTP\"") (notmuch-test-wait) (notmuch-search-reply-to-thread) (message=\r
208  "%s" (buffer-string))' 2>&1 | sed -ne '/^From/,$ p' | sed -e 's/^In-Reply-=\r
209 To: <.*>$/In-Reply-To: <XXX>/')\r
210 > > =C2=A0test_expect_equal "$output" "From: Notmuch Test Suite <test_suite=\r
211 @notmuchmail.org>\r
212 > > =C2=A0To: user@example.com\r
213 > > =C2=A0Subject: Re: Testing message sent via SMTP\r
214 > > @@ -125,7 +125,7 @@ test_expect_equal_file "$EXPECTED/attachment" attac=\r
215 hment2.gz\r
216 > > =C2=A0test_begin_subtest "View raw message within emacs"\r
217 > > =C2=A0expected=3D$(cat $EXPECTED/raw-message-cf0c4d-52ad0a)\r
218 > > =C2=A0first_line=3D$(echo "$expected" | head -n1)\r
219 > > -output=3D$(test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9=\r
220 cf9aa31f052ad0a@mail.gmail.com") (notmuch-show-view-raw-message) (message (=\r
221 buffer-string))' 2>&1 | sed -ne "/$first_line/,\$ p")\r
222 > > +output=3D$(test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9=\r
223 cf9aa31f052ad0a@mail.gmail.com") (notmuch-show-view-raw-message) (message "=\r
224 %s" (buffer-string))' 2>&1 | sed -ne "/$first_line/,\$ p")\r
225 > > =C2=A0test_expect_equal "$output" "$expected"\r
226 > >\r
227 > > =C2=A0test_done\r
228 > > diff --git a/test/emacs-large-search-buffer b/test/emacs-large-search-b=\r
229 uffer\r
230 > > index a3b5c79..77878b5 100755\r
231 > > --- a/test/emacs-large-search-buffer\r
232 > > +++ b/test/emacs-large-search-buffer\r
233 > > @@ -21,11 +21,12 @@ notmuch new > /dev/null\r
234 > > =C2=A0test_begin_subtest "Ensure that emacs doesn't drop results"\r
235 > > =C2=A0expected=3D"$(notmuch search '*' | sed -e 's/^thread:[0-9a-f]* =\r
236 =C2=A0//' -e 's/;//' -e =C2=A0's/xx*/[BLOB]/')\r
237 > > =C2=A0End of search results."\r
238 > > -output=3D$(test_emacs '(notmuch-search "*") (notmuch-test-wait) (messa=\r
239 ge (buffer-string))' 2>&1 | sed -e s', =C2=A0*, ,g' -e 's/xxx*/[BLOB]/g')\r
240 > > +\r
241 > > +output=3D$(test_emacs '(notmuch-search "*") (notmuch-test-wait) (messa=\r
242 ge "%s" (buffer-string))' 2>&1 | sed -e s', =C2=A0*, ,g' -e 's/xxx*/[BLOB]/=\r
243 g')\r
244 > > =C2=A0test_expect_equal "$output" "$expected"\r
245 > >\r
246 > > =C2=A0test_begin_subtest "Ensure that emacs doesn't drop error messages"\r
247 > > -output=3D$(test_emacs '(notmuch-search "--this-option-does-not-exist")=\r
248  (notmuch-test-wait) (message (buffer-string))' 2>&1)\r
249 > > +output=3D$(test_emacs '(notmuch-search "--this-option-does-not-exist")=\r
250  (notmuch-test-wait) (message "%s" (buffer-string))' 2>&1)\r
251 > > =C2=A0test_expect_equal "$output" "Error: Unexpected output from notmuc=\r
252 h search:\r
253 > > =C2=A0Unrecognized option: --this-option-does-not-exist\r
254 > > =C2=A0End of search results. (process returned 1)"\r
255 > > --\r
256 > > 1.7.5.1\r
257 > >\r
258 > > _______________________________________________\r
259 > > notmuch mailing list\r
260 > > notmuch@notmuchmail.org\r
261 > > http://notmuchmail.org/mailman/listinfo/notmuch\r
262 > >\r