Re: [PATCH v4 13/16] add indexopts to notmuch python bindings.
[notmuch-archives.git] / 56 / 0f8df2533c0e795616fb970f1296cbf91bb63c
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 15991431FC3\r
6         for <notmuch@notmuchmail.org>; Mon, 19 Nov 2012 18:23:42 -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\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 9L18IKnSUDM2 for <notmuch@notmuchmail.org>;\r
16         Mon, 19 Nov 2012 18:23:40 -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 5A0F5431FBC\r
21         for <notmuch@notmuchmail.org>; Mon, 19 Nov 2012 18:23:40 -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 1TadUw-0004EO-LB; Mon, 19 Nov 2012 22:23:39 -0400\r
28 Received: from bremner by zancas.localnet with local (Exim 4.80)\r
29         (envelope-from <bremner@tethera.net>)\r
30         id 1TadUr-0007SO-37; Mon, 19 Nov 2012 22:23:33 -0400\r
31 From: david@tethera.net\r
32 To: notmuch@notmuchmail.org\r
33 Subject: [PATCH 2/2] test: initial performance testing infrastructure\r
34 Date: Mon, 19 Nov 2012 22:23:20 -0400\r
35 Message-Id: <1353378200-28625-2-git-send-email-david@tethera.net>\r
36 X-Mailer: git-send-email 1.7.10.4\r
37 In-Reply-To: <1353378200-28625-1-git-send-email-david@tethera.net>\r
38 References: <1353188234-29666-1-git-send-email-david@tethera.net>\r
39         <1353378200-28625-1-git-send-email-david@tethera.net>\r
40 X-Spam_bar: -\r
41 Cc: David Bremner <bremner@debian.org>\r
42 X-BeenThere: notmuch@notmuchmail.org\r
43 X-Mailman-Version: 2.1.13\r
44 Precedence: list\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: Tue, 20 Nov 2012 02:23:42 -0000\r
55 \r
56 From: David Bremner <bremner@debian.org>\r
57 \r
58 This is not near as fancy as as the unit tests, on the theory that\r
59 the code should typically be crashing when performance tuning.\r
60 Nonetheless, there is plenty of room for improvement.  Several more of\r
61 the pieces of the test infrastructure (e.g. the option parsing) could\r
62 be factored out into test/test-lib-common.sh\r
63 ---\r
64  Makefile                                           |    3 +-\r
65  performance-test/.gitignore                        |    1 +\r
66  performance-test/Makefile                          |    7 +++\r
67  performance-test/Makefile.local                    |   24 +++++++++\r
68  performance-test/README                            |   36 +++++++++++++\r
69  performance-test/basic                             |   15 ++++++\r
70  performance-test/download/.gitignore               |    1 +\r
71  .../download/notmuch-email-corpus-0.1.tar.gz.asc   |    9 ++++\r
72  performance-test/notmuch-perf-test                 |   25 +++++++++\r
73  performance-test/perf-test-lib.sh                  |   57 ++++++++++++++++++++\r
74  10 files changed, 177 insertions(+), 1 deletion(-)\r
75  create mode 100644 performance-test/.gitignore\r
76  create mode 100644 performance-test/Makefile\r
77  create mode 100644 performance-test/Makefile.local\r
78  create mode 100644 performance-test/README\r
79  create mode 100755 performance-test/basic\r
80  create mode 100644 performance-test/download/.gitignore\r
81  create mode 100644 performance-test/download/notmuch-email-corpus-0.1.tar.gz.asc\r
82  create mode 100755 performance-test/notmuch-perf-test\r
83  create mode 100644 performance-test/perf-test-lib.sh\r
84 \r
85 diff --git a/Makefile b/Makefile\r
86 index bb9c316..5decbea 100644\r
87 --- a/Makefile\r
88 +++ b/Makefile\r
89 @@ -3,7 +3,8 @@\r
90  all:\r
91  \r
92  # List all subdirectories here. Each contains its own Makefile.local\r
93 -subdirs = compat completion emacs lib man parse-time-string util test\r
94 +subdirs := compat completion emacs lib man parse-time-string\r
95 +subdirs := $(subdirs) performance-test util test\r
96  \r
97  # We make all targets depend on the Makefiles themselves.\r
98  global_deps = Makefile Makefile.config Makefile.local \\r
99 diff --git a/performance-test/.gitignore b/performance-test/.gitignore\r
100 new file mode 100644\r
101 index 0000000..53f2697\r
102 --- /dev/null\r
103 +++ b/performance-test/.gitignore\r
104 @@ -0,0 +1 @@\r
105 +tmp.*/\r
106 diff --git a/performance-test/Makefile b/performance-test/Makefile\r
107 new file mode 100644\r
108 index 0000000..de492a7\r
109 --- /dev/null\r
110 +++ b/performance-test/Makefile\r
111 @@ -0,0 +1,7 @@\r
112 +# See Makefile.local for the list of files to be compiled in this\r
113 +# directory.\r
114 +all:\r
115 +       $(MAKE) -C .. all\r
116 +\r
117 +.DEFAULT:\r
118 +       $(MAKE) -C .. $@\r
119 diff --git a/performance-test/Makefile.local b/performance-test/Makefile.local\r
120 new file mode 100644\r
121 index 0000000..d20457e\r
122 --- /dev/null\r
123 +++ b/performance-test/Makefile.local\r
124 @@ -0,0 +1,24 @@\r
125 +# -*- makefile -*-\r
126 +\r
127 +dir := performance-test\r
128 +\r
129 +PERFTEST_VERSION := 0.1\r
130 +\r
131 +TGZFILE := $(dir)/download/notmuch-email-corpus-$(PERFTEST_VERSION).tar.gz\r
132 +SIGFILE := $(TGZFILE).asc\r
133 +TEST_SCRIPT := $(dir)/notmuch-perf-test\r
134 +\r
135 +perf-test: setup-perf-test all\r
136 +       $(TEST_SCRIPT) $(OPTIONS)\r
137 +\r
138 +setup-perf-test: $(TGZFILE)\r
139 +       gpg --verify $(SIGFILE)\r
140 +\r
141 +$(TGZFILE):\r
142 +       @echo\r
143 +       @echo Please download ${TGZFILE}\r
144 +       @echo See http://notmuchmail.org/corpus for download locations\r
145 +       @echo\r
146 +       @false\r
147 +\r
148 +CLEAN := $(CLEAN) $(dir)/tmp.*\r
149 diff --git a/performance-test/README b/performance-test/README\r
150 new file mode 100644\r
151 index 0000000..1f98337\r
152 --- /dev/null\r
153 +++ b/performance-test/README\r
154 @@ -0,0 +1,36 @@\r
155 +Pre-requisites\r
156 +--------------\r
157 +\r
158 +In addition to having notmuch, you need:\r
159 +\r
160 +- gpg\r
161 +- gnu tar\r
162 +- gnu time\r
163 +\r
164 +Getting set up to run tests:\r
165 +----------------------------\r
166 +\r
167 +First, you need to get the corpus.\r
168 +\r
169 +It should work to run\r
170 +\r
171 +   % cd download\r
172 +   % wget http://notmuchmail.org/releases/notmuch-email-corpus-${V}.tar.gz\r
173 +\r
174 +Where $V is the current version.\r
175 +\r
176 +In case that fails or is too slow, check\r
177 +\r
178 +   http://notmuchmail.org/corpus\r
179 +\r
180 +for a list of mirrors.\r
181 +\r
182 +Running tests\r
183 +-------------\r
184 +\r
185 +The easiest way to run performance tests is to say "make perf-test", (or\r
186 +simply run the notmuch-perf-test script). Either command will run all\r
187 +available performance tests.\r
188 +\r
189 +Alternately, you can run a specific subset of tests by simply invoking\r
190 +one of the executable scripts in this directory, (such as ./basic).\r
191 diff --git a/performance-test/basic b/performance-test/basic\r
192 new file mode 100755\r
193 index 0000000..9d015ee\r
194 --- /dev/null\r
195 +++ b/performance-test/basic\r
196 @@ -0,0 +1,15 @@\r
197 +#!/bin/bash\r
198 +\r
199 +. ./perf-test-lib.sh\r
200 +\r
201 +add_email_corpus\r
202 +\r
203 +print_header\r
204 +\r
205 +time_run 'initial notmuch new' 'notmuch new'\r
206 +time_run 'second notmuch new' 'notmuch new'\r
207 +time_run 'dump *' 'notmuch dump > tags.out'\r
208 +time_run 'restore *' 'notmuch restore < tags.out'\r
209 +time_run 'tag * +new_tag' "notmuch tag +new_tag '*'"\r
210 +\r
211 +time_done\r
212 diff --git a/performance-test/download/.gitignore b/performance-test/download/.gitignore\r
213 new file mode 100644\r
214 index 0000000..335ec95\r
215 --- /dev/null\r
216 +++ b/performance-test/download/.gitignore\r
217 @@ -0,0 +1 @@\r
218 +*.tar.gz\r
219 diff --git a/performance-test/download/notmuch-email-corpus-0.1.tar.gz.asc b/performance-test/download/notmuch-email-corpus-0.1.tar.gz.asc\r
220 new file mode 100644\r
221 index 0000000..1041523\r
222 --- /dev/null\r
223 +++ b/performance-test/download/notmuch-email-corpus-0.1.tar.gz.asc\r
224 @@ -0,0 +1,9 @@\r
225 +-----BEGIN PGP SIGNATURE-----\r
226 +Version: GnuPG v1.4.12 (GNU/Linux)\r
227 +\r
228 +iJwEAAECAAYFAlCqaPMACgkQTiiN/0Um85mDdQP/c+AErVD2ix+1Jf159EigEpND\r
229 +Kzmak2c0Ae2bsfkjZa07GIc9T147lloSg+TKO3PMXTaXHCyYYolgNjZsD8SnP3Hp\r
230 +nF2zgNrRlVpaMysqJX005OMbb3cVUrKHQpOCZ764dFyVPCi7ag42HRy/XrODUD3w\r
231 +HJsx8ejTFbxfYi9c2+g=\r
232 +=4ZIO\r
233 +-----END PGP SIGNATURE-----\r
234 diff --git a/performance-test/notmuch-perf-test b/performance-test/notmuch-perf-test\r
235 new file mode 100755\r
236 index 0000000..1bea345\r
237 --- /dev/null\r
238 +++ b/performance-test/notmuch-perf-test\r
239 @@ -0,0 +1,25 @@\r
240 +#!/usr/bin/env bash\r
241 +\r
242 +# Run tests\r
243 +#\r
244 +# Copyright (c) 2005 Junio C Hamano\r
245 +#\r
246 +# Adapted from a Makefile to a shell script by Carl Worth (2010)\r
247 +\r
248 +if [ ${BASH_VERSINFO[0]} -lt 4 ]; then\r
249 +    echo "Error: The notmuch test suite requires a bash version >= 4.0"\r
250 +    echo "due to use of associative arrays within the test suite."\r
251 +    echo "Please try again with a newer bash (or help us fix the"\r
252 +    echo "test suite to be more portable). Thanks."\r
253 +    exit 1\r
254 +fi\r
255 +\r
256 +cd $(dirname "$0")\r
257 +\r
258 +TESTS="\r
259 +  basic\r
260 +"\r
261 +\r
262 +for test in $TESTS; do\r
263 +    ./$test "$@"\r
264 +done\r
265 diff --git a/performance-test/perf-test-lib.sh b/performance-test/perf-test-lib.sh\r
266 new file mode 100644\r
267 index 0000000..8e6004f\r
268 --- /dev/null\r
269 +++ b/performance-test/perf-test-lib.sh\r
270 @@ -0,0 +1,57 @@\r
271 +\r
272 +. ../test/test-lib-common.sh\r
273 +\r
274 +set -e\r
275 +\r
276 +if ! test -x ../notmuch\r
277 +then\r
278 +       echo >&2 'You do not seem to have built notmuch yet.'\r
279 +       exit 1\r
280 +fi\r
281 +\r
282 +add_email_corpus ()\r
283 +{\r
284 +    rm -rf ${MAIL_DIR}\r
285 +\r
286 +    arg=""\r
287 +    case "$1" in\r
288 +       --small)\r
289 +           arg="/enron/bailey-s"\r
290 +           ;;\r
291 +       --medium)\r
292 +           arg="/notmuch-archive"\r
293 +           ;;\r
294 +    esac\r
295 +\r
296 +    printf "Unpacking corpus\n"\r
297 +    tar --checkpoint=.5000 --extract --strip-components=1 \\r
298 +       --directory ${TMP_DIRECTORY} \\r
299 +       --file ../download/notmuch-email-corpus-0.1.tar.gz \\r
300 +       notmuch-email-corpus/mail"$arg"\r
301 +\r
302 +    printf "\n"\r
303 +}\r
304 +\r
305 +print_header () {\r
306 +    printf "                      Wall(s)\tUsr(s)\tSys(s)\tRes(K)\tIn\tOut\n"\r
307 +}\r
308 +\r
309 +time_run () {\r
310 +    printf "%-22s" "$1"\r
311 +    if test "$verbose" != "t"; then exec 4>test.output 3>&4; fi\r
312 +    if ! eval >&3 "/usr/bin/time -f '%e\t%U\t%S\t%M\t%I\t%O' $2" ; then\r
313 +       test_failure=$(($test_failure + 1))\r
314 +    fi\r
315 +}\r
316 +\r
317 +time_done () {\r
318 +    if [ "$test_failure" = "0" ]; then\r
319 +       rm -rf "$remove_tmp"\r
320 +       exit 0\r
321 +    else\r
322 +       exit 1\r
323 +    fi\r
324 +}\r
325 +\r
326 +cd -P "$test" || error "Cannot setup test environment"\r
327 +test_failure=0\r
328 -- \r
329 1.7.10.4\r
330 \r