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 E3D1B429E29
\r
6 for <notmuch@notmuchmail.org>; Sun, 3 Jul 2011 21:07:48 -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 79DbUf4A0Edy for <notmuch@notmuchmail.org>;
\r
17 Sun, 3 Jul 2011 21:07: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 77E1E429E27
\r
22 for <notmuch@notmuchmail.org>; Sun, 3 Jul 2011 21:07:46 -0700 (PDT)
\r
23 Received: by mail-bw0-f53.google.com with SMTP id 12so4447816bwg.26
\r
24 for <notmuch@notmuchmail.org>; Sun, 03 Jul 2011 21:07:46 -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=iaKsBaNzcMfINVTxJGc9kh1yf5VG/MPdUZnozS4quF0=;
\r
28 b=AT0/xd0zoENCuBNz8dc9qglAwwdvCon53o1xbUTHF78r6kLF+IKCqnacOpx00bprmI
\r
29 da40IZpHT/UUUfFCmHp5Z+VI2LQYEdJV6OfgMSm8ZhOqfQopwQ43ZogxFIleX7JKGwfk
\r
30 EcVE5pOej5kkfV7l4q9vR6PD+fFO3AlQyIZI8=
\r
31 Received: by 10.204.135.211 with SMTP id o19mr5239652bkt.63.1309752466162;
\r
32 Sun, 03 Jul 2011 21:07:46 -0700 (PDT)
\r
33 Received: from localhost ([91.144.186.21])
\r
34 by mx.google.com with ESMTPS id af13sm5167838bkc.19.2011.07.03.21.07.44
\r
35 (version=TLSv1/SSLv3 cipher=OTHER);
\r
36 Sun, 03 Jul 2011 21:07:45 -0700 (PDT)
\r
37 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
38 To: notmuch@notmuchmail.org
\r
39 Subject: [PATCH v2 2/3] test: improve known broken tests support
\r
40 Date: Mon, 4 Jul 2011 08:07:20 +0400
\r
41 Message-Id: <1309752441-10651-3-git-send-email-dmitry.kurochkin@gmail.com>
\r
42 X-Mailer: git-send-email 1.7.5.4
\r
43 In-Reply-To: <1309752441-10651-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
44 References: <1309744743-8556-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
45 <1309752441-10651-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
46 X-BeenThere: notmuch@notmuchmail.org
\r
47 X-Mailman-Version: 2.1.13
\r
49 List-Id: "Use and development of the notmuch mail system."
\r
50 <notmuch.notmuchmail.org>
\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
54 List-Post: <mailto:notmuch@notmuchmail.org>
\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
57 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
58 X-List-Received-Date: Mon, 04 Jul 2011 04:07:49 -0000
\r
60 There is existing support for broken tests. But it is not convenient
\r
61 to use. The primary issue is that we have to maintain a set of
\r
62 test_expect_*_failure functions which are equivalent to the normal
\r
63 test_expect_* counterparts except for what functions are called for
\r
64 result reporting. The patch adds test_subtest_known_broken function
\r
65 which marks a subset as broken, making the normal test_expect_*
\r
66 functions behave as test_expect_*_failure. All test_expect_*_failure
\r
67 functions are removed. Test_known_broken_failure_ is changed to
\r
68 format details the same way as test_failure_ does.
\r
70 Another benefit of this change is that the diff when a broken test is
\r
71 fixed would be small and nice.
\r
73 Documentation is updated accordingly.
\r
75 test/README | 17 ++++++-------
\r
76 test/test-lib.sh | 63 +++++++++++++++++------------------------------------
\r
77 2 files changed, 28 insertions(+), 52 deletions(-)
\r
79 diff --git a/test/README b/test/README
\r
80 index a245bf1..0b54748 100644
\r
83 @@ -132,20 +132,19 @@ library for your script to use.
\r
84 <script>. If it yields success, test is considered
\r
85 successful. <message> should state what it is testing.
\r
87 - test_expect_failure <message> <script>
\r
89 - This is NOT the opposite of test_expect_success, but is used
\r
90 - to mark a test that demonstrates a known breakage. Unlike
\r
91 - the usual test_expect_success tests, which say "ok" on
\r
92 - success and "FAIL" on failure, this will say "FIXED" on
\r
93 - success and "still broken" on failure. Failures from these
\r
94 - tests won't cause -i (immediate) to stop.
\r
96 test_begin_subtest <message>
\r
98 Set the test description message for a subsequent test_expect_equal
\r
99 invocation (see below).
\r
101 + test_subtest_known_broken
\r
103 + Mark the current test as broken. Such tests are expected to fail.
\r
104 + Unlike the normal tests, which say "PASS" on success and "FAIL" on
\r
105 + failure, these will say "FIXED" on success and "BROKEN" on failure.
\r
106 + Failures from these tests won't cause -i (immediate) to stop. A
\r
107 + test must call this before any test_expect_* function.
\r
109 test_expect_equal <output> <expected>
\r
111 This is an often-used convenience function built on top of
\r
112 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
113 index 22e387e..196ef49 100755
\r
114 --- a/test/test-lib.sh
\r
115 +++ b/test/test-lib.sh
\r
116 @@ -424,6 +424,7 @@ test_begin_subtest ()
\r
117 error "bug in test script: Missing test_expect_equal in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}"
\r
119 test_subtest_name="$1"
\r
120 + test_subtest_known_broken_=
\r
121 # Remember stdout and stderr file descriptors and redirect test
\r
122 # output to the previously prepared file descriptors 3 and 4 (see
\r
124 @@ -484,29 +485,6 @@ test_expect_equal_file ()
\r
128 -test_expect_equal_failure ()
\r
130 - exec 1>&6 2>&7 # Restore stdout and stderr
\r
132 - test "$#" = 3 && { prereq=$1; shift; } || prereq=
\r
134 - error "bug in the test script: not 2 or 3 parameters to test_expect_equal"
\r
138 - if ! test_skip "$@"
\r
140 - if [ "$output" = "$expected" ]; then
\r
141 - test_known_broken_ok_ "$test_subtest_name"
\r
143 - test_known_broken_failure_ "$test_subtest_name"
\r
144 - testname=$this_test.$test_count
\r
145 - echo "$expected" > $testname.expected
\r
146 - echo "$output" > $testname.output
\r
153 notmuch new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file'
\r
154 @@ -568,19 +546,31 @@ test_have_prereq () {
\r
155 # the text_expect_* functions instead.
\r
158 + if test "$test_subtest_known_broken_" = "t"; then
\r
159 + test_known_broken_ok_ "$@"
\r
162 test_success=$(($test_success + 1))
\r
163 say_color pass "%-6s" "PASS"
\r
168 + if test "$test_subtest_known_broken_" = "t"; then
\r
169 + test_known_broken_failure_ "$@"
\r
172 test_failure=$(($test_failure + 1))
\r
173 - say_color error "%-6s" "FAIL"
\r
176 + test_failure_message_ "FAIL" "$@"
\r
177 + test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; }
\r
180 +test_failure_message_ () {
\r
181 + say_color error "%-6s" "$1"
\r
184 echo "$@" | sed -e 's/^/ /'
\r
185 if test "$verbose" != "t"; then cat test.output; fi
\r
186 - test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; }
\r
189 test_known_broken_ok_ () {
\r
190 @@ -591,8 +581,7 @@ test_known_broken_ok_ () {
\r
192 test_known_broken_failure_ () {
\r
193 test_broken=$(($test_broken+1))
\r
194 - say_color pass "%-6s" "BROKEN"
\r
196 + test_failure_message_ "BROKEN" "$@"
\r
200 @@ -636,20 +625,8 @@ test_skip () {
\r
204 -test_expect_failure () {
\r
205 - test "$#" = 3 && { prereq=$1; shift; } || prereq=
\r
207 - error "bug in the test script: not 2 or 3 parameters to test-expect-failure"
\r
208 - if ! test_skip "$@"
\r
211 - if [ "$?" = 0 -a "$eval_ret" = 0 ]
\r
213 - test_known_broken_ok_ "$1"
\r
215 - test_known_broken_failure_ "$1"
\r
218 +test_subtest_known_broken () {
\r
219 + test_subtest_known_broken_=t
\r
222 test_expect_success () {
\r