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 97FC3429E25
\r
6 for <notmuch@notmuchmail.org>; Sun, 27 Nov 2011 18:42:20 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 gRplxTeb3adG for <notmuch@notmuchmail.org>;
\r
16 Sun, 27 Nov 2011 18:42:19 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id C088B431FB6
\r
20 for <notmuch@notmuchmail.org>; Sun, 27 Nov 2011 18:42:19 -0800 (PST)
\r
21 X-AuditID: 1209190e-b7f4a6d0000008e5-ef-4ed2f50bc965
\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])
\r
23 by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 9B.87.02277.B05F2DE4; Sun, 27 Nov 2011 21:42:19 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id pAS2gIs7007692;
\r
27 Sun, 27 Nov 2011 21:42:19 -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 pAS2gHKv023245
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Sun, 27 Nov 2011 21:42:18 -0500 (EST)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1RUrCh-0000RK-Lj; Sun, 27 Nov 2011 21:44:23 -0500
\r
37 From: Austin Clements <amdragon@MIT.EDU>
\r
38 To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>, notmuch@notmuchmail.org
\r
39 Subject: Re: [PATCH 1/3] test: add functions to count how much times notmuch
\r
41 In-Reply-To: <1322271878-32614-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
42 References: <1322271878-32614-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
43 User-Agent: Notmuch/0.9+77~gfdb7dac (http://notmuchmail.org) Emacs/23.3.1
\r
45 Date: Sun, 27 Nov 2011 21:44:23 -0500
\r
46 Message-ID: <87ipm52cfs.fsf@awakening.csail.mit.edu>
\r
48 Content-Type: text/plain; charset=us-ascii
\r
49 X-Brightmail-Tracker:
\r
50 H4sIAAAAAAAAA+NgFrrLIsWRmVeSWpSXmKPExsUixG6nosv99ZKfwcH/EhZXt/azW1y/OZPZ
\r
51 gclj56y77B7PVt1iDmCK4rJJSc3JLEst0rdL4Mp49m4TS8Fa+YrN/V/YGhjfSXQxcnJICJhI
\r
52 fNiwkRHCFpO4cG89G4gtJLCPUWLOUr4uRi4gewOjxI9b81khnJNMEg/OvGeBqFrCKNF4ORrE
\r
53 ZhPQkNi2fznYJBEBL4lP1zuYQWxhgXCJXfdXAzVzcHAKeEv8/80CYgoBlUxZzgpSISoQK/F2
\r
54 9kRmkDCLgKrEozP2IGFeoNM2fD7AAmELSpyc+QTMZhbQkrjx7yXTBEaBWUhSs5CkFjAyrWKU
\r
55 Tcmt0s1NzMwpTk3WLU5OzMtLLdI11svNLNFLTSndxAgKRU5Jvh2MXw8qHWIU4GBU4uHluHbJ
\r
56 T4g1say4MvcQoyQHk5Io7+XPQCG+pPyUyozE4oz4otKc1OJDjBIczEoivD1HgXK8KYmVValF
\r
57 +TApaQ4WJXHe1Tsc/IQE0hNLUrNTUwtSi2CyMhwcShK8fl+AGgWLUtNTK9Iyc0oQ0kwcnCDD
\r
58 eYCGd4Es5i0uSMwtzkyHyJ9iVJQS5w0HaRYASWSU5sH1wlLFK0ZxoFeEeZ1BqniAaQau+xXQ
\r
59 YCagwRwzL4AMLklESEk1MIafXG0e/zpAw6pFrKZk0V8xqU29DyX+VfesKSjxM/939aud06N1
\r
60 jZ3z1+d09Oyb+Gzn5Aneb5Z++f/OKmeHj3mPoURjWYHNk2qHrc/v3T2etsbWoCA1MGfitcJ5
\r
61 MdcOS/f/WPVyZpzJUSODCwI/nrZ9bX60u/zkGRdhn/qLUusN5/wNYzk+97wSS3FGoqEWc1Fx
\r
63 X-BeenThere: notmuch@notmuchmail.org
\r
64 X-Mailman-Version: 2.1.13
\r
66 List-Id: "Use and development of the notmuch mail system."
\r
67 <notmuch.notmuchmail.org>
\r
68 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
69 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
70 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
71 List-Post: <mailto:notmuch@notmuchmail.org>
\r
72 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
73 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
74 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
75 X-List-Received-Date: Mon, 28 Nov 2011 02:42:20 -0000
\r
77 On Sat, 26 Nov 2011 05:44:36 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
\r
78 > The patch adds two auxiliary functions and a variable:
\r
80 > notmuch_counter_reset
\r
84 > They allow to count how many times notmuch binary is called.
\r
85 > notmuch_counter_reset() function generates a script that counts how
\r
86 > many times it is called and resets the counter to zero. The function
\r
87 > sets $notmuch_counter variable to the path to the generated script
\r
88 > that should be called instead of notmuch to do the counting. The
\r
89 > notmuch_counter() function returns the current counter value.
\r
94 > test/README | 16 ++++++++++++++--
\r
95 > test/test-lib.sh | 32 ++++++++++++++++++++++++++++++++
\r
96 > 2 files changed, 46 insertions(+), 2 deletions(-)
\r
98 > diff --git a/test/README b/test/README
\r
99 > index 2481f16..1570f7c 100644
\r
100 > --- a/test/README
\r
101 > +++ b/test/README
\r
102 > @@ -187,8 +187,8 @@ library for your script to use.
\r
103 > is to summarize successes and failures in the test script and
\r
104 > exit with an appropriate error code.
\r
106 > -There are also a number of mail-specific functions which are useful in
\r
108 > +There are also a number of notmuch-specific auxiliary functions and
\r
109 > +variables which are useful in writing tests:
\r
113 > @@ -212,3 +212,15 @@ writing tests:
\r
114 > will initialize the mail database to a known state of 50 sample
\r
115 > messages, (culled from the early history of the notmuch mailing
\r
118 > + notmuch_counter_reset
\r
119 > + $notmuch_counter
\r
120 > + notmuch_counter
\r
122 >From the name, I would expect $notmuch_counter to be the counter value
\r
123 (ignoring the difficulty of implementing that). Perhaps
\r
124 $notmuch_counter_command, since it's meant to be bound to
\r
127 notmuch_counter is okay, but maybe notmuch_counter_value?
\r
130 > + These allow to count how many times notmuch binary is called.
\r
131 > + notmuch_counter_reset() function generates a script that counts
\r
132 > + how many times it is called and resets the counter to zero. The
\r
133 > + function sets $notmuch_counter variable to the path to the
\r
134 > + generated script that should be called instead of notmuch to do
\r
135 > + the counting. The notmuch_counter() function returns the current
\r
138 It doesn't return the counter value, it prints it.
\r
140 > diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
141 > index 93867b0..e3b85d0 100755
\r
142 > --- a/test/test-lib.sh
\r
143 > +++ b/test/test-lib.sh
\r
144 > @@ -864,6 +864,38 @@ test_emacs () {
\r
145 > emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"
\r
148 > +# Creates a script that counts how much time it is executed and calls
\r
149 > +# notmuch. $notmuch_counter is set to the path to the generated
\r
150 > +# script. Use notmuch_counter() function to get the current counter
\r
152 > +notmuch_counter_reset () {
\r
153 > + notmuch_counter="$TMP_DIRECTORY/notmuch_counter"
\r
154 > + if [ ! -x "$notmuch_counter" ]; then
\r
155 > + notmuch_counter_state_path="$TMP_DIRECTORY/notmuch_counter.state"
\r
156 > + cat <<EOF >"$notmuch_counter"
\r
158 This is totally a stylistic pet peeve, but consider
\r
159 cat >"$notmuch_counter" <<EOF
\r
163 > +count=\$(cat "$notmuch_counter_state_path")
\r
164 > +echo -n \$(expr \$count + 1) > "$notmuch_counter_state_path"
\r
166 > +exec notmuch "\$@"
\r
168 > + chmod +x "$notmuch_counter" || return
\r
171 > + echo -n 0 > "$notmuch_counter_state_path" || return
\r
173 What are the || return's for?
\r
177 > +# Returns the current notmuch counter value.
\r
178 > +notmuch_counter () {
\r
179 > + if [ -r "$notmuch_counter_state_path" ]; then
\r
180 > + count=$(cat "$notmuch_counter_state_path")
\r
188 > find_notmuch_path ()
\r
193 > _______________________________________________
\r
194 > notmuch mailing list
\r
195 > notmuch@notmuchmail.org
\r
196 > http://notmuchmail.org/mailman/listinfo/notmuch
\r