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 E37CD431FD0
\r
6 for <notmuch@notmuchmail.org>; Sun, 3 Jul 2011 20:46:47 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 MsPksrHuTLFN for <notmuch@notmuchmail.org>;
\r
17 Sun, 3 Jul 2011 20:46:47 -0700 (PDT)
\r
18 Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com
\r
19 [209.85.214.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 D27C9431FB6
\r
22 for <notmuch@notmuchmail.org>; Sun, 3 Jul 2011 20:46:46 -0700 (PDT)
\r
23 Received: by bwg12 with SMTP id 12so4439605bwg.26
\r
24 for <notmuch@notmuchmail.org>; Sun, 03 Jul 2011 20:46:45 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
26 h=from:to:cc:subject:in-reply-to:references:user-agent:date
\r
27 :message-id:mime-version:content-type:content-transfer-encoding;
\r
28 bh=Xza8U2ez5XloopRtE2zm+BqLOxCbNXFCd1w6zoYLWaw=;
\r
29 b=RGS0ToXOul8IhBHJAV4JDG/II6m1KxM14G4Qu7stRmqnJXAt0dkWuXSWfTJos3jS8M
\r
30 WpSsNv8w3YDT7hcbnAbrA6lL7NJAoMC+w7p6b39f42sLNohrCGTqiKMJ9jbR9v7TgovP
\r
31 dD35zzHPdAk2fet4E7kmZ4oUGoHZn2mdoVIuY=
\r
32 Received: by 10.204.141.205 with SMTP id n13mr1572497bku.198.1309751205429;
\r
33 Sun, 03 Jul 2011 20:46:45 -0700 (PDT)
\r
34 Received: from localhost ([91.144.186.21])
\r
35 by mx.google.com with ESMTPS id c13sm5158402bkc.14.2011.07.03.20.46.43
\r
36 (version=TLSv1/SSLv3 cipher=OTHER);
\r
37 Sun, 03 Jul 2011 20:46:44 -0700 (PDT)
\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
39 To: Austin Clements <amdragon@mit.edu>
\r
40 Subject: Re: [PATCH 2/3] test: improve known broken tests support
\r
42 <CAH-f9WuKrBpEjBaBet0d95oHXo1kWzGv6oa7zz7Zqe4JK=4N+Q@mail.gmail.com>
\r
43 References: <1309744743-8556-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
44 <1309744743-8556-2-git-send-email-dmitry.kurochkin@gmail.com>
\r
45 <CAH-f9WuKrBpEjBaBet0d95oHXo1kWzGv6oa7zz7Zqe4JK=4N+Q@mail.gmail.com>
\r
46 User-Agent: Notmuch/0.5-321-g41686e2 (http://notmuchmail.org) Emacs/23.3.1
\r
47 (x86_64-pc-linux-gnu)
\r
48 Date: Mon, 04 Jul 2011 07:46:37 +0400
\r
49 Message-ID: <877h7y4siq.fsf@gmail.com>
\r
51 Content-Type: text/plain; charset=utf-8
\r
52 Content-Transfer-Encoding: quoted-printable
\r
53 Cc: notmuch@notmuchmail.org
\r
54 X-BeenThere: notmuch@notmuchmail.org
\r
55 X-Mailman-Version: 2.1.13
\r
57 List-Id: "Use and development of the notmuch mail system."
\r
58 <notmuch.notmuchmail.org>
\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
62 List-Post: <mailto:notmuch@notmuchmail.org>
\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
66 X-List-Received-Date: Mon, 04 Jul 2011 03:46:48 -0000
\r
68 On Sun, 3 Jul 2011 23:42:13 -0400, Austin Clements <amdragon@mit.edu> wrote:
\r
71 > Just a heads-up, this will conflict with the first two patches in the
\r
72 > atomicity series (though git may not detect the second conflict).
\r
73 > Both are trivial patches, though, so the merge should be easy.
\r
76 Oh. I hope atomicity will be there soon.
\r
78 > Three minor comments below.
\r
80 > On Sun, Jul 3, 2011 at 9:59 PM, Dmitry Kurochkin
\r
81 > <dmitry.kurochkin@gmail.com> wrote:
\r
82 > > There is existing support for broken tests. =C2=A0But it is not conveni=
\r
84 > > to use. =C2=A0The primary issue is that we have to maintain a set of
\r
85 > > test_expect_*_failure functions which are equivalent to the normal
\r
86 > > test_expect_* counterparts except for what functions are called for
\r
87 > > result reporting. =C2=A0The patch adds test_subtest_known_broken functi=
\r
89 > > which marks a subset as broken, making the normal test_expect_*
\r
90 > > functions behave as test_expect_*_failure. =C2=A0All test_expect_*_fail=
\r
92 > > functions are removed. =C2=A0Test_known_broken_failure_ is changed to
\r
93 > > format details the same way as test_failure_ does.
\r
95 > > Another benefit of this change is that the diff when a broken test is
\r
96 > > fixed would be small and nice.
\r
98 > > Documentation is updated accordingly.
\r
100 > > =C2=A0test/README =C2=A0 =C2=A0 =C2=A0| =C2=A0 17 ++++++++---------
\r
101 > > =C2=A0test/test-lib.sh | =C2=A0 53 +++++++++++++++---------------------=
\r
103 > > =C2=A02 files changed, 23 insertions(+), 47 deletions(-)
\r
105 > > diff --git a/test/README b/test/README
\r
106 > > index a245bf1..f926b9f 100644
\r
107 > > --- a/test/README
\r
108 > > +++ b/test/README
\r
109 > > @@ -132,20 +132,19 @@ library for your script to use.
\r
110 > > =C2=A0 =C2=A0<script>. =C2=A0If it yields success, test is considered
\r
111 > > =C2=A0 =C2=A0successful. =C2=A0<message> should state what it is testin=
\r
114 > > - test_expect_failure <message> <script>
\r
116 > > - =C2=A0 This is NOT the opposite of test_expect_success, but is used
\r
117 > > - =C2=A0 to mark a test that demonstrates a known breakage. =C2=A0Unlike
\r
118 > > - =C2=A0 the usual test_expect_success tests, which say "ok" on
\r
119 > > - =C2=A0 success and "FAIL" on failure, this will say "FIXED" on
\r
120 > > - =C2=A0 success and "still broken" on failure. =C2=A0Failures from the=
\r
122 > > - =C2=A0 tests won't cause -i (immediate) to stop.
\r
124 > > =C2=A0test_begin_subtest <message>
\r
126 > > =C2=A0 =C2=A0Set the test description message for a subsequent test_exp=
\r
128 > > =C2=A0 =C2=A0invocation (see below).
\r
130 > > + test_subtest_known_broken
\r
132 > > + =C2=A0 Mark the current test as broken. =C2=A0Such tests are expected=
\r
134 > > + =C2=A0 Unlike the normal tests, which say "PASS" on success and "FAIL=
\r
136 > > + =C2=A0 failure, these will say "FIXED" on success and "BROKEN" on fai=
\r
138 > > + =C2=A0 Failures from these tests won't cause -i (immediate) to stop. =
\r
140 > > + =C2=A0 must be called before any test_expect_* function.
\r
142 > Perhaps "A test must call this before any test_expect_* function"?
\r
143 > There can be earlier test_expect_* calls from other tests.
\r
149 > > =C2=A0test_expect_equal <output> <expected>
\r
151 > > =C2=A0 =C2=A0This is an often-used convenience function built on top of
\r
152 > > diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
153 > > index 22e387e..0cd4170 100755
\r
154 > > --- a/test/test-lib.sh
\r
155 > > +++ b/test/test-lib.sh
\r
156 > > @@ -424,6 +424,7 @@ test_begin_subtest ()
\r
157 > > =C2=A0 =C2=A0 =C2=A0 =C2=A0error "bug in test script: Missing test_expe=
\r
158 ct_equal in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}"
\r
159 > > =C2=A0 =C2=A0 fi
\r
160 > > =C2=A0 =C2=A0 test_subtest_name=3D"$1"
\r
161 > > + =C2=A0 =C2=A0test_subtest_known_broken_=3D
\r
162 > > =C2=A0 =C2=A0 # Remember stdout and stderr file descriptors and redirec=
\r
164 > > =C2=A0 =C2=A0 # output to the previously prepared file descriptors 3 an=
\r
166 > > =C2=A0 =C2=A0 # below)
\r
167 > > @@ -484,29 +485,6 @@ test_expect_equal_file ()
\r
168 > > =C2=A0 =C2=A0 fi
\r
171 > > -test_expect_equal_failure ()
\r
173 > > - =C2=A0 =C2=A0 =C2=A0 exec 1>&6 2>&7 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
\r
174 =A0# Restore stdout and stderr
\r
175 > > - =C2=A0 =C2=A0 =C2=A0 inside_subtest=3D
\r
176 > > - =C2=A0 =C2=A0 =C2=A0 test "$#" =3D 3 && { prereq=3D$1; shift; } || pr=
\r
178 > > - =C2=A0 =C2=A0 =C2=A0 test "$#" =3D 2 ||
\r
179 > > - =C2=A0 =C2=A0 =C2=A0 error "bug in the test script: not 2 or 3 parame=
\r
180 ters to test_expect_equal"
\r
182 > > - =C2=A0 =C2=A0 =C2=A0 output=3D"$1"
\r
183 > > - =C2=A0 =C2=A0 =C2=A0 expected=3D"$2"
\r
184 > > - =C2=A0 =C2=A0 =C2=A0 if ! test_skip "$@"
\r
185 > > - =C2=A0 =C2=A0 =C2=A0 then
\r
186 > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if [ "$output" =3D "=
\r
188 > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
\r
189 =C2=A0 test_known_broken_ok_ "$test_subtest_name"
\r
190 > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else
\r
191 > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
\r
192 =C2=A0 test_known_broken_failure_ "$test_subtest_name"
\r
193 > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
\r
194 =C2=A0 testname=3D$this_test.$test_count
\r
195 > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
\r
196 =C2=A0 echo "$expected" > $testname.expected
\r
197 > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
\r
198 =C2=A0 echo "$output" > $testname.output
\r
199 > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 fi
\r
200 > > - =C2=A0 =C2=A0fi
\r
203 > > =C2=A0NOTMUCH_NEW ()
\r
205 > > =C2=A0 =C2=A0 notmuch new | grep -v -E -e '^Processed [0-9]*( total)? f=
\r
206 ile|Found [0-9]* total file'
\r
207 > > @@ -568,12 +546,20 @@ test_have_prereq () {
\r
208 > > =C2=A0# the text_expect_* functions instead.
\r
210 > > =C2=A0test_ok_ () {
\r
211 > > + =C2=A0 =C2=A0 =C2=A0 if [ "$test_subtest_known_broken_" =3D 1 ]; then
\r
212 > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 test_known_broken_ok=
\r
214 > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return
\r
215 > > + =C2=A0 =C2=A0 =C2=A0 fi
\r
216 > > =C2=A0 =C2=A0 =C2=A0 =C2=A0test_success=3D$(($test_success + 1))
\r
217 > > =C2=A0 =C2=A0 =C2=A0 =C2=A0say_color pass "%-6s" "PASS"
\r
218 > > =C2=A0 =C2=A0 =C2=A0 =C2=A0echo " $@"
\r
221 > > =C2=A0test_failure_ () {
\r
222 > > + =C2=A0 =C2=A0 =C2=A0 if [ "$test_subtest_known_broken_" =3D 1 ]; then
\r
223 > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 test_known_broken_fa=
\r
225 > > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return
\r
226 > > + =C2=A0 =C2=A0 =C2=A0 fi
\r
227 > > =C2=A0 =C2=A0 =C2=A0 =C2=A0test_failure=3D$(($test_failure + 1))
\r
228 > > =C2=A0 =C2=A0 =C2=A0 =C2=A0say_color error "%-6s" "FAIL"
\r
229 > > =C2=A0 =C2=A0 =C2=A0 =C2=A0echo " $1"
\r
230 > > @@ -592,7 +578,10 @@ test_known_broken_ok_ () {
\r
231 > > =C2=A0test_known_broken_failure_ () {
\r
232 > > =C2=A0 =C2=A0 =C2=A0 =C2=A0test_broken=3D$(($test_broken+1))
\r
233 > > =C2=A0 =C2=A0 =C2=A0 =C2=A0say_color pass "%-6s" "BROKEN"
\r
234 > > - =C2=A0 =C2=A0 =C2=A0 echo " $@"
\r
235 > > + =C2=A0 =C2=A0 =C2=A0 echo " $1"
\r
236 > > + =C2=A0 =C2=A0 =C2=A0 shift
\r
237 > > + =C2=A0 =C2=A0 =C2=A0 echo "$@" | sed -e 's/^/ =C2=A0 =C2=A0 =C2=A0 =
\r
239 > > + =C2=A0 =C2=A0 =C2=A0 if test "$verbose" !=3D "t"; then cat test.outpu=
\r
242 > Would it be possible to keep just the one copy of the failure printing
\r
243 > code in test_failure_?
\r
246 Sure, it is possible if I am not so lazy.
\r
250 > > =C2=A0test_debug () {
\r
251 > > @@ -636,20 +625,8 @@ test_skip () {
\r
252 > > =C2=A0 =C2=A0 =C2=A0 =C2=A0esac
\r
255 > > -test_expect_failure () {
\r
256 > > - =C2=A0 =C2=A0 =C2=A0 test "$#" =3D 3 && { prereq=3D$1; shift; } || pr=
\r
258 > > - =C2=A0 =C2=A0 =C2=A0 test "$#" =3D 2 ||
\r
259 > > - =C2=A0 =C2=A0 =C2=A0 error "bug in the test script: not 2 or 3 parame=
\r
260 ters to test-expect-failure"
\r
261 > > - =C2=A0 =C2=A0 =C2=A0 if ! test_skip "$@"
\r
262 > > - =C2=A0 =C2=A0 =C2=A0 then
\r
263 > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 test_run_ "$2"
\r
264 > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if [ "$?" =3D 0 -a "=
\r
266 > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 then
\r
267 > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
\r
268 =C2=A0 test_known_broken_ok_ "$1"
\r
269 > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else
\r
270 > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
\r
271 =C2=A0 test_known_broken_failure_ "$1"
\r
272 > > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 fi
\r
273 > > - =C2=A0 =C2=A0 =C2=A0 fi
\r
274 > > +test_subtest_known_broken () {
\r
275 > > + =C2=A0 =C2=A0 =C2=A0 test_subtest_known_broken_=3D1
\r
277 > The convention in test-lib appears to be "t" for true variables.
\r
280 Thanks for the hint.
\r
282 Will follow with an amend.
\r
289 > > =C2=A0test_expect_success () {
\r