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 82D18431FB6
\r
6 for <notmuch@notmuchmail.org>; Sun, 3 Jul 2011 19:00:33 -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 Q+R+u5PKW-N5 for <notmuch@notmuchmail.org>;
\r
17 Sun, 3 Jul 2011 19:00:32 -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 2C7F5431FD0
\r
22 for <notmuch@notmuchmail.org>; Sun, 3 Jul 2011 19:00:32 -0700 (PDT)
\r
23 Received: by mail-bw0-f53.google.com with SMTP id 12so4396763bwg.26
\r
24 for <notmuch@notmuchmail.org>; Sun, 03 Jul 2011 19:00:31 -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:date:message-id:x-mailer:in-reply-to:references;
\r
27 bh=Q69nW/X1GjQSSubDoOfpua8h4YUCUaNunihsreXWxuc=;
\r
28 b=au1qIlLbKiNU/2ApM6rcr8LiaF/gWFWSMIcnIT9S7rn+x/o2hmekLJ+I+lTHVgJt9W
\r
29 OnRyticL0SeaIZh/MA+cbX2aqYeeJB/jWYNhlyfeGbNcSH0FZr1OeAhQHfH2ztBIQBex
\r
30 xKdoABoj6I8Fqn1wKsT5KH7/ubLUOlWah475E=
\r
31 Received: by 10.204.19.19 with SMTP id y19mr4970270bka.164.1309744831406;
\r
32 Sun, 03 Jul 2011 19:00:31 -0700 (PDT)
\r
33 Received: from localhost ([91.144.186.21])
\r
34 by mx.google.com with ESMTPS id e6sm5101585bka.23.2011.07.03.19.00.29
\r
35 (version=TLSv1/SSLv3 cipher=OTHER);
\r
36 Sun, 03 Jul 2011 19:00:30 -0700 (PDT)
\r
37 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
38 To: notmuch@notmuchmail.org
\r
39 Subject: [PATCH 2/3] test: improve known broken tests support
\r
40 Date: Mon, 4 Jul 2011 05:59:02 +0400
\r
41 Message-Id: <1309744743-8556-2-git-send-email-dmitry.kurochkin@gmail.com>
\r
42 X-Mailer: git-send-email 1.7.5.4
\r
43 In-Reply-To: <1309744743-8556-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
44 References: <1309744743-8556-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
45 X-BeenThere: notmuch@notmuchmail.org
\r
46 X-Mailman-Version: 2.1.13
\r
48 List-Id: "Use and development of the notmuch mail system."
\r
49 <notmuch.notmuchmail.org>
\r
50 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
52 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
53 List-Post: <mailto:notmuch@notmuchmail.org>
\r
54 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
55 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
56 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
57 X-List-Received-Date: Mon, 04 Jul 2011 02:00:33 -0000
\r
59 There is existing support for broken tests. But it is not convenient
\r
60 to use. The primary issue is that we have to maintain a set of
\r
61 test_expect_*_failure functions which are equivalent to the normal
\r
62 test_expect_* counterparts except for what functions are called for
\r
63 result reporting. The patch adds test_subtest_known_broken function
\r
64 which marks a subset as broken, making the normal test_expect_*
\r
65 functions behave as test_expect_*_failure. All test_expect_*_failure
\r
66 functions are removed. Test_known_broken_failure_ is changed to
\r
67 format details the same way as test_failure_ does.
\r
69 Another benefit of this change is that the diff when a broken test is
\r
70 fixed would be small and nice.
\r
72 Documentation is updated accordingly.
\r
74 test/README | 17 ++++++++---------
\r
75 test/test-lib.sh | 53 +++++++++++++++--------------------------------------
\r
76 2 files changed, 23 insertions(+), 47 deletions(-)
\r
78 diff --git a/test/README b/test/README
\r
79 index a245bf1..f926b9f 100644
\r
82 @@ -132,20 +132,19 @@ library for your script to use.
\r
83 <script>. If it yields success, test is considered
\r
84 successful. <message> should state what it is testing.
\r
86 - test_expect_failure <message> <script>
\r
88 - This is NOT the opposite of test_expect_success, but is used
\r
89 - to mark a test that demonstrates a known breakage. Unlike
\r
90 - the usual test_expect_success tests, which say "ok" on
\r
91 - success and "FAIL" on failure, this will say "FIXED" on
\r
92 - success and "still broken" on failure. Failures from these
\r
93 - tests won't cause -i (immediate) to stop.
\r
95 test_begin_subtest <message>
\r
97 Set the test description message for a subsequent test_expect_equal
\r
98 invocation (see below).
\r
100 + test_subtest_known_broken
\r
102 + Mark the current test as broken. Such tests are expected to fail.
\r
103 + Unlike the normal tests, which say "PASS" on success and "FAIL" on
\r
104 + failure, these will say "FIXED" on success and "BROKEN" on failure.
\r
105 + Failures from these tests won't cause -i (immediate) to stop. This
\r
106 + must be called before any test_expect_* function.
\r
108 test_expect_equal <output> <expected>
\r
110 This is an often-used convenience function built on top of
\r
111 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
112 index 22e387e..0cd4170 100755
\r
113 --- a/test/test-lib.sh
\r
114 +++ b/test/test-lib.sh
\r
115 @@ -424,6 +424,7 @@ test_begin_subtest ()
\r
116 error "bug in test script: Missing test_expect_equal in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}"
\r
118 test_subtest_name="$1"
\r
119 + test_subtest_known_broken_=
\r
120 # Remember stdout and stderr file descriptors and redirect test
\r
121 # output to the previously prepared file descriptors 3 and 4 (see
\r
123 @@ -484,29 +485,6 @@ test_expect_equal_file ()
\r
127 -test_expect_equal_failure ()
\r
129 - exec 1>&6 2>&7 # Restore stdout and stderr
\r
131 - test "$#" = 3 && { prereq=$1; shift; } || prereq=
\r
133 - error "bug in the test script: not 2 or 3 parameters to test_expect_equal"
\r
137 - if ! test_skip "$@"
\r
139 - if [ "$output" = "$expected" ]; then
\r
140 - test_known_broken_ok_ "$test_subtest_name"
\r
142 - test_known_broken_failure_ "$test_subtest_name"
\r
143 - testname=$this_test.$test_count
\r
144 - echo "$expected" > $testname.expected
\r
145 - echo "$output" > $testname.output
\r
152 notmuch new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file'
\r
153 @@ -568,12 +546,20 @@ test_have_prereq () {
\r
154 # the text_expect_* functions instead.
\r
157 + if [ "$test_subtest_known_broken_" = 1 ]; then
\r
158 + test_known_broken_ok_ "$@"
\r
161 test_success=$(($test_success + 1))
\r
162 say_color pass "%-6s" "PASS"
\r
167 + if [ "$test_subtest_known_broken_" = 1 ]; then
\r
168 + test_known_broken_failure_ "$@"
\r
171 test_failure=$(($test_failure + 1))
\r
172 say_color error "%-6s" "FAIL"
\r
174 @@ -592,7 +578,10 @@ test_known_broken_ok_ () {
\r
175 test_known_broken_failure_ () {
\r
176 test_broken=$(($test_broken+1))
\r
177 say_color pass "%-6s" "BROKEN"
\r
181 + echo "$@" | sed -e 's/^/ /'
\r
182 + if test "$verbose" != "t"; then cat test.output; fi
\r
186 @@ -636,20 +625,8 @@ test_skip () {
\r
190 -test_expect_failure () {
\r
191 - test "$#" = 3 && { prereq=$1; shift; } || prereq=
\r
193 - error "bug in the test script: not 2 or 3 parameters to test-expect-failure"
\r
194 - if ! test_skip "$@"
\r
197 - if [ "$?" = 0 -a "$eval_ret" = 0 ]
\r
199 - test_known_broken_ok_ "$1"
\r
201 - test_known_broken_failure_ "$1"
\r
204 +test_subtest_known_broken () {
\r
205 + test_subtest_known_broken_=1
\r
208 test_expect_success () {
\r