Re: [PATCH 2/5] rename g:notmuch_sendmail -> g:notmuch_rb_sendmail
[notmuch-archives.git] / e2 / 3791632e5450d9684d5046a0baffcbe29d8d50
1 Return-Path: <amdragon@mit.edu>\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 10A75431FAF\r
6         for <notmuch@notmuchmail.org>; Sun, 25 Nov 2012 13:40:29 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 hwi1UAfsSmTO for <notmuch@notmuchmail.org>;\r
16         Sun, 25 Nov 2012 13:40:28 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU\r
18         [18.9.25.13])\r
19         by olra.theworths.org (Postfix) with ESMTP id D1AEB431FAE\r
20         for <notmuch@notmuchmail.org>; Sun, 25 Nov 2012 13:40:27 -0800 (PST)\r
21 X-AuditID: 1209190d-b7f906d0000008de-d4-50b2904b98d3\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 88.19.02270.B4092B05; Sun, 25 Nov 2012 16:40:27 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id qAPLeQR9008328; \r
27         Sun, 25 Nov 2012 16:40:26 -0500\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qAPLeOjh003344\r
32         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
33         Sun, 25 Nov 2012 16:40:25 -0500 (EST)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1Tcjw8-0004MD-13; Sun, 25 Nov 2012 16:40:24 -0500\r
37 Date: Sun, 25 Nov 2012 16:40:24 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: david@tethera.net\r
40 Subject: Re: [Patch v4 2/2] test: initial performance testing infrastructure\r
41 Message-ID: <20121125214023.GO4562@mit.edu>\r
42 References: <1353855745-11697-1-git-send-email-david@tethera.net>\r
43         <1353855745-11697-3-git-send-email-david@tethera.net>\r
44 MIME-Version: 1.0\r
45 Content-Type: text/plain; charset=us-ascii\r
46 Content-Disposition: inline\r
47 In-Reply-To: <1353855745-11697-3-git-send-email-david@tethera.net>\r
48 User-Agent: Mutt/1.5.21 (2010-09-15)\r
49 X-Brightmail-Tracker:\r
50  H4sIAAAAAAAAA+NgFprBKsWRmVeSWpSXmKPExsUixG6nrus9YVOAwb1WUYuNy34yW9xo7Wa0\r
51         uH5zJrMDs8evtrnMHs9W3WL22HLoPXMAcxSXTUpqTmZZapG+XQJXxsKDx5gKOkMqVnd3MzUw\r
52         vnXsYuTkkBAwkZj7djsThC0mceHeerYuRi4OIYF9jBJ9a5exgySEBDYwSrw+xwuRuMgkce/Q\r
53         TDaIxBJGiVkvM0BsFgFVicaFB1hBbDYBDYlt+5czgtgiAqISpzdNAoszC9hLLJo9CWyosICP\r
54         xLlds8A28wpoS0y98R9qWaXE5/mvmSHighInZz5hgejVkrjx7yVQPQeQLS2x/B8HSJhTwEli\r
55         zpoNYCWiAioSU05uY5vAKDQLSfcsJN2zELoXMDKvYpRNya3SzU3MzClOTdYtTk7My0st0jXS\r
56         y80s0UtNKd3ECAp0TkneHYzvDiodYhTgYFTi4b2RuDFAiDWxrLgy9xCjJAeTkihvc+umACG+\r
57         pPyUyozE4oz4otKc1OJDjBIczEoivBOZgHK8KYmVValF+TApaQ4WJXHeKyk3/YUE0hNLUrNT\r
58         UwtSi2CyMhwcShK8Bv1AjYJFqempFWmZOSUIaSYOTpDhPEDDU0BqeIsLEnOLM9Mh8qcYdTl6\r
59         /3U9YRRiycvPS5US57UFKRIAKcoozYObA0tQrxjFgd4S5k0GqeIBJje4Sa+AljABLUm+vhFk\r
60         SUkiQkqqgbHzq6PKyh2L695Gad5t7bvtzfK93InNsS7av7Ct5eb+j3t94ufzFlW9vxb1R2aL\r
61         v48d0/EHf1J6F975c13U1El6zr+yy4Y2xWwegZ8XmVauLGB5t+Tkkdtzs9xkZLcvcplQt2v5\r
62         moz2L43/2nZ/E/15xEpt93KxEwrPl7xmnZp/Qyq674F24mwlluKMREMt5qLiRACFNW0uKwMA        AA==\r
63 Cc: notmuch@notmuchmail.org, David Bremner <bremner@debian.org>\r
64 X-BeenThere: notmuch@notmuchmail.org\r
65 X-Mailman-Version: 2.1.13\r
66 Precedence: list\r
67 List-Id: "Use and development of the notmuch mail system."\r
68         <notmuch.notmuchmail.org>\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
72 List-Post: <mailto:notmuch@notmuchmail.org>\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
75         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
76 X-List-Received-Date: Sun, 25 Nov 2012 21:40:29 -0000\r
77 \r
78 Quoth david@tethera.net on Nov 25 at 11:02 am:\r
79 > From: David Bremner <bremner@debian.org>\r
80\r
81 > This is not near as fancy as as the unit tests, on the theory that\r
82 > the code should typically be crashing when performance tuning.\r
83 > Nonetheless, there is plenty of room for improvement.  Several more of\r
84 > the pieces of the test infrastructure (e.g. the option parsing) could\r
85 > be factored out into test/test-lib-common.sh\r
86 > ---\r
87 >  Makefile                                           |    3 +-\r
88 >  performance-test/.gitignore                        |    1 +\r
89 >  performance-test/Makefile                          |    7 +++\r
90 >  performance-test/Makefile.local                    |   32 ++++++++++\r
91 >  performance-test/README                            |   50 +++++++++++++++\r
92 >  performance-test/basic                             |   15 +++++\r
93 >  performance-test/download/.gitignore               |    2 +\r
94 >  .../download/notmuch-email-corpus-0.2.tar.xz.asc   |    9 +++\r
95 >  performance-test/notmuch-perf-test                 |   25 ++++++++\r
96 >  performance-test/perf-test-lib.sh                  |   65 ++++++++++++++++++++\r
97 >  performance-test/version.sh                        |    3 +\r
98 >  11 files changed, 211 insertions(+), 1 deletion(-)\r
99 >  create mode 100644 performance-test/.gitignore\r
100 >  create mode 100644 performance-test/Makefile\r
101 >  create mode 100644 performance-test/Makefile.local\r
102 >  create mode 100644 performance-test/README\r
103 >  create mode 100755 performance-test/basic\r
104 >  create mode 100644 performance-test/download/.gitignore\r
105 >  create mode 100644 performance-test/download/notmuch-email-corpus-0.2.tar.xz.asc\r
106 >  create mode 100755 performance-test/notmuch-perf-test\r
107 >  create mode 100644 performance-test/perf-test-lib.sh\r
108 >  create mode 100644 performance-test/version.sh\r
109\r
110 > diff --git a/Makefile b/Makefile\r
111 > index bb9c316..5decbea 100644\r
112 > --- a/Makefile\r
113 > +++ b/Makefile\r
114 > @@ -3,7 +3,8 @@\r
115 >  all:\r
116 >  \r
117 >  # List all subdirectories here. Each contains its own Makefile.local\r
118 > -subdirs = compat completion emacs lib man parse-time-string util test\r
119 > +subdirs := compat completion emacs lib man parse-time-string\r
120 > +subdirs := $(subdirs) performance-test util test\r
121 \r
122 += ?\r
123 \r
124 >  \r
125 >  # We make all targets depend on the Makefiles themselves.\r
126 >  global_deps = Makefile Makefile.config Makefile.local \\r
127 > diff --git a/performance-test/.gitignore b/performance-test/.gitignore\r
128 > new file mode 100644\r
129 > index 0000000..53f2697\r
130 > --- /dev/null\r
131 > +++ b/performance-test/.gitignore\r
132 > @@ -0,0 +1 @@\r
133 > +tmp.*/\r
134 > diff --git a/performance-test/Makefile b/performance-test/Makefile\r
135 > new file mode 100644\r
136 > index 0000000..de492a7\r
137 > --- /dev/null\r
138 > +++ b/performance-test/Makefile\r
139 > @@ -0,0 +1,7 @@\r
140 > +# See Makefile.local for the list of files to be compiled in this\r
141 > +# directory.\r
142 > +all:\r
143 > +     $(MAKE) -C .. all\r
144 > +\r
145 > +.DEFAULT:\r
146 > +     $(MAKE) -C .. $@\r
147 > diff --git a/performance-test/Makefile.local b/performance-test/Makefile.local\r
148 > new file mode 100644\r
149 > index 0000000..1114ec1\r
150 > --- /dev/null\r
151 > +++ b/performance-test/Makefile.local\r
152 > @@ -0,0 +1,32 @@\r
153 > +# -*- makefile -*-\r
154 > +\r
155 > +dir := performance-test\r
156 > +\r
157 > +include $(dir)/version.sh\r
158 > +\r
159 > +CORPUS_NAME := notmuch-email-corpus-$(PERFTEST_VERSION).tar.xz\r
160 \r
161 Would it make sense to split out the different size corpora so a user\r
162 could, say, only download the small one?\r
163 \r
164 > +TXZFILE := ${dir}/download/${CORPUS_NAME}\r
165 > +SIGFILE := ${TXZFILE}.asc\r
166 > +TEST_SCRIPT := ${dir}/notmuch-perf-test\r
167 > +DEFAULT_URL :=  http://notmuchmail.org/releases/${CORPUS_NAME}\r
168 > +\r
169 > +perf-test: setup-perf-test all\r
170 > +     $(TEST_SCRIPT) $(OPTIONS)\r
171 > +\r
172 > +.PHONY: download-corpus setup-perf-test\r
173 > +\r
174 > +# Note that this intentionally does not depend on download-corpus.\r
175 > +setup-perf-test: $(TXZFILE)\r
176 > +     gpg --verify $(SIGFILE)\r
177 > +\r
178 > +$(TXZFILE):\r
179 > +     @printf "\nPlease download ${TXZFILE}.\n\n"\r
180 \r
181 "\nPlease download ${TXZFILE} using\n\n"?\r
182 \r
183 > +     @printf "\t%% make download-corpus\n\n"\r
184 > +     @echo or see http://notmuchmail.org/corpus for download locations\r
185 > +     @echo\r
186 > +     @false\r
187 > +\r
188 > +download-corpus:\r
189 > +     wget -O ${TXZFILE} ${DEFAULT_URL}\r
190 > +\r
191 > +CLEAN := $(CLEAN) $(dir)/tmp.*\r
192 > diff --git a/performance-test/README b/performance-test/README\r
193 > new file mode 100644\r
194 > index 0000000..239d2fb\r
195 > --- /dev/null\r
196 > +++ b/performance-test/README\r
197 > @@ -0,0 +1,50 @@\r
198 > +Pre-requisites\r
199 > +--------------\r
200 > +\r
201 > +In addition to having notmuch, you need:\r
202 > +\r
203 > +- gpg\r
204 > +- gnu tar\r
205 > +- gnu time\r
206 > +- xz. Some speedup can be gotten by installing "pixz", but this is\r
207 > +  probably only worthwhile if you are debugging the tests.\r
208 > +\r
209 > +Getting set up to run tests:\r
210 > +----------------------------\r
211 > +\r
212 > +First, you need to get the corpus.\r
213 > +\r
214 > +It should work to run\r
215 > +\r
216 > +   % make download-corpus\r
217 > +\r
218 > +In case that fails or is too slow, check\r
219 > +\r
220 > +   http://notmuchmail.org/corpus\r
221 > +\r
222 > +for a list of mirrors.\r
223 > +\r
224 > +Running tests\r
225 > +-------------\r
226 > +\r
227 > +The easiest way to run performance tests is to say "make perf-test", (or\r
228 > +simply run the notmuch-perf-test script). Either command will run all\r
229 > +available performance tests.\r
230 > +\r
231 > +Alternately, you can run a specific subset of tests by simply invoking\r
232 > +one of the executable scripts in this directory, (such as ./basic).\r
233 > +\r
234 > +\r
235 > +Writing tests\r
236 > +-------------\r
237 > +\r
238 > +Have a look at "basic" for an example.\r
239 > +\r
240 > +add_email_corpus takes arguments "--small" and "--medium" for when you\r
241 > +want smaller corpuses to check.\r
242 \r
243 "corpora"?\r
244 \r
245 > +\r
246 > +time_done does the cleanup; comment it out or define "$debug" to leave\r
247 > +the temporary files around.\r
248 > +\r
249 > +Currently there is no option processing (e.g. --debug) in the\r
250 > +performance tests.\r
251 > diff --git a/performance-test/basic b/performance-test/basic\r
252 > new file mode 100755\r
253 > index 0000000..9d015ee\r
254 > --- /dev/null\r
255 > +++ b/performance-test/basic\r
256 > @@ -0,0 +1,15 @@\r
257 > +#!/bin/bash\r
258 > +\r
259 > +. ./perf-test-lib.sh\r
260 > +\r
261 > +add_email_corpus\r
262 > +\r
263 > +print_header\r
264 > +\r
265 > +time_run 'initial notmuch new' 'notmuch new'\r
266 > +time_run 'second notmuch new' 'notmuch new'\r
267 > +time_run 'dump *' 'notmuch dump > tags.out'\r
268 > +time_run 'restore *' 'notmuch restore < tags.out'\r
269 > +time_run 'tag * +new_tag' "notmuch tag +new_tag '*'"\r
270 > +\r
271 > +time_done\r
272 > diff --git a/performance-test/download/.gitignore b/performance-test/download/.gitignore\r
273 > new file mode 100644\r
274 > index 0000000..7b09234\r
275 > --- /dev/null\r
276 > +++ b/performance-test/download/.gitignore\r
277 > @@ -0,0 +1,2 @@\r
278 > +*.tar.gz\r
279 > +*.tar.xz\r
280 > diff --git a/performance-test/download/notmuch-email-corpus-0.2.tar.xz.asc b/performance-test/download/notmuch-email-corpus-0.2.tar.xz.asc\r
281 > new file mode 100644\r
282 > index 0000000..c8b4b3d\r
283 > --- /dev/null\r
284 > +++ b/performance-test/download/notmuch-email-corpus-0.2.tar.xz.asc\r
285 > @@ -0,0 +1,9 @@\r
286 > +-----BEGIN PGP SIGNATURE-----\r
287 > +Version: GnuPG v1.4.12 (GNU/Linux)\r
288 > +\r
289 > +iJwEAAECAAYFAlCsvx0ACgkQTiiN/0Um85kZAwP9GgOQ22jK8mr5X4pT/mB8EjSH\r
290 > +QbndlxxbRrP0ChTqjBQoD3IsTHjNL7W572BfXb/MNo94R/iIQ7yTHCDVNuwBhvKd\r
291 > +7qgIuW2FUS1uTfJRP5KBNf8JPuin+6wqGe8/+y/iOs+XJSdiYg1ElS49Ntnpg0yl\r
292 > +btImgEcxTxQ2qfzDS1g=\r
293 > +=iuZR\r
294 > +-----END PGP SIGNATURE-----\r
295 > diff --git a/performance-test/notmuch-perf-test b/performance-test/notmuch-perf-test\r
296 > new file mode 100755\r
297 > index 0000000..1bea345\r
298 > --- /dev/null\r
299 > +++ b/performance-test/notmuch-perf-test\r
300 > @@ -0,0 +1,25 @@\r
301 > +#!/usr/bin/env bash\r
302 > +\r
303 > +# Run tests\r
304 > +#\r
305 > +# Copyright (c) 2005 Junio C Hamano\r
306 > +#\r
307 > +# Adapted from a Makefile to a shell script by Carl Worth (2010)\r
308 > +\r
309 > +if [ ${BASH_VERSINFO[0]} -lt 4 ]; then\r
310 > +    echo "Error: The notmuch test suite requires a bash version >= 4.0"\r
311 > +    echo "due to use of associative arrays within the test suite."\r
312 > +    echo "Please try again with a newer bash (or help us fix the"\r
313 > +    echo "test suite to be more portable). Thanks."\r
314 > +    exit 1\r
315 > +fi\r
316 > +\r
317 > +cd $(dirname "$0")\r
318 > +\r
319 > +TESTS="\r
320 > +  basic\r
321 > +"\r
322 > +\r
323 > +for test in $TESTS; do\r
324 > +    ./$test "$@"\r
325 > +done\r
326 > diff --git a/performance-test/perf-test-lib.sh b/performance-test/perf-test-lib.sh\r
327 > new file mode 100644\r
328 > index 0000000..11ccc77\r
329 > --- /dev/null\r
330 > +++ b/performance-test/perf-test-lib.sh\r
331 > @@ -0,0 +1,65 @@\r
332 > +. ./version.sh\r
333 > +\r
334 > +. ../test/test-lib-common.sh\r
335 > +\r
336 > +set -e\r
337 > +\r
338 > +if ! test -x ../notmuch\r
339 > +then\r
340 > +     echo >&2 'You do not seem to have built notmuch yet.'\r
341 > +     exit 1\r
342 > +fi\r
343 > +\r
344 > +add_email_corpus ()\r
345 > +{\r
346 > +    rm -rf ${MAIL_DIR}\r
347 > +\r
348 > +    arg=""\r
349 > +    case "$1" in\r
350 > +     --small)\r
351 > +         arg="/enron/bailey-s"\r
352 > +         ;;\r
353 > +     --medium)\r
354 > +         arg="/notmuch-archive"\r
355 > +         ;;\r
356 > +    esac\r
357 > +\r
358 > +    if command -v pixz > /dev/null; then\r
359 > +     XZ=pixz\r
360 > +    else\r
361 > +     XZ=xz\r
362 > +    fi\r
363 > +\r
364 > +    printf "Unpacking corpus\n"\r
365 > +    tar --checkpoint=.5000 --extract --strip-components=1 \\r
366 > +     --directory ${TMP_DIRECTORY} \\r
367 > +     --use-compress-program ${XZ} \\r
368 > +     --file ../download/notmuch-email-corpus-${PERFTEST_VERSION}.tar.xz \\r
369 > +     notmuch-email-corpus/mail"$arg"\r
370 \r
371 I'm a bit confused by this.  What happens if you don't specify --small\r
372 or --medium?  Is the "large"/default corpus just the combined small\r
373 and medium corpora?  Would be worth a comment, at least.\r
374 \r
375 This probably doesn't matter now, but I wonder if we want to unpack on\r
376 first use to somewhere not test-specific and then cp -rl the corpus\r
377 into the test directory.  I haven't tried unpacking the corpus yet,\r
378 but if you're running tests repeatedly to compare results, or running\r
379 more than one performance test, it seems like a full decompress and\r
380 unpack could get onerous.\r
381 \r
382 > +\r
383 > +    printf "\n"\r
384 > +}\r
385 > +\r
386 > +print_header () {\r
387 > +    printf "                      Wall(s)\tUsr(s)\tSys(s)\tRes(K)\tIn\tOut\n"\r
388 \r
389 Should the header include which corpus size is in use?  This would be\r
390 important when emailing around performance results.\r
391 \r
392 > +}\r
393 > +\r
394 > +time_run () {\r
395 > +    printf "%-22s" "$1"\r
396 > +    if test "$verbose" != "t"; then exec 4>test.output 3>&4; fi\r
397 > +    if ! eval >&3 "/usr/bin/time -f '%e\t%U\t%S\t%M\t%I\t%O' $2" ; then\r
398 > +     test_failure=$(($test_failure + 1))\r
399 > +    fi\r
400 > +}\r
401 > +\r
402 > +time_done () {\r
403 > +    if [ "$test_failure" = "0" ]; then\r
404 > +     rm -rf "$remove_tmp"\r
405 > +     exit 0\r
406 > +    else\r
407 > +     exit 1\r
408 > +    fi\r
409 > +}\r
410 > +\r
411 > +cd -P "$test" || error "Cannot setup test environment"\r
412 > +test_failure=0\r
413 > diff --git a/performance-test/version.sh b/performance-test/version.sh\r
414 > new file mode 100644\r
415 > index 0000000..d9270b1\r
416 > --- /dev/null\r
417 > +++ b/performance-test/version.sh\r
418 > @@ -0,0 +1,3 @@\r
419 > +# this should be both a valid Makefile fragment and valid POSIX(ish) shell.\r
420 > +\r
421 > +PERFTEST_VERSION=0.2\r