1 Return-Path: <too@guru-group.fi>
\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 98887431FD7
\r
6 for <notmuch@notmuchmail.org>; Tue, 12 Nov 2013 12:41:26 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 iJa5g7vEtoDC for <notmuch@notmuchmail.org>;
\r
16 Tue, 12 Nov 2013 12:41:22 -0800 (PST)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 05277431FDA
\r
19 for <notmuch@notmuchmail.org>; Tue, 12 Nov 2013 12:41:18 -0800 (PST)
\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)
\r
21 id BDB7710009D; Tue, 12 Nov 2013 22:41:13 +0200 (EET)
\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
23 To: notmuch@notmuchmail.org
\r
24 Subject: [PATCH 3/3] test: implement and document NOTMUCH_TEST_QUIET variable
\r
26 Date: Tue, 12 Nov 2013 22:41:08 +0200
\r
27 Message-Id: <1384288868-23903-3-git-send-email-tomi.ollila@iki.fi>
\r
28 X-Mailer: git-send-email 1.8.0
\r
29 In-Reply-To: <1384288868-23903-1-git-send-email-tomi.ollila@iki.fi>
\r
30 References: <1384288868-23903-1-git-send-email-tomi.ollila@iki.fi>
\r
31 Cc: tomi.ollila@iki.fi
\r
32 X-BeenThere: notmuch@notmuchmail.org
\r
33 X-Mailman-Version: 2.1.13
\r
35 List-Id: "Use and development of the notmuch mail system."
\r
36 <notmuch.notmuchmail.org>
\r
37 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
38 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
39 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
40 List-Post: <mailto:notmuch@notmuchmail.org>
\r
41 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
42 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
44 X-List-Received-Date: Tue, 12 Nov 2013 20:41:27 -0000
\r
46 When NOTMUCH_TEST_QUIET environment variable is set to non-null value
\r
47 messages when new test script starts and when test PASSes are disabled.
\r
48 This eases picking the cases when tests FAIL (as those are still printed).
\r
50 test/README | 8 ++++++++
\r
51 test/basic | 12 ++++++++++--
\r
52 test/test-lib.sh | 11 ++++++++++-
\r
53 test/test.expected-output/test-quiet-verbose-no | 20 ++++++++++++++++++++
\r
54 test/test.expected-output/test-quiet-verbose-yes | 24 ++++++++++++++++++++++++
\r
55 5 files changed, 72 insertions(+), 3 deletions(-)
\r
56 create mode 100644 test/test.expected-output/test-quiet-verbose-no
\r
57 create mode 100644 test/test.expected-output/test-quiet-verbose-yes
\r
59 diff --git a/test/README b/test/README
\r
60 index d12cff2..79a9b1b 100644
\r
63 @@ -76,6 +76,14 @@ the tests in one of the following ways.
\r
64 TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient ./emacs
\r
65 make test TEST_EMACS=my-special-emacs TEST_EMACSCLIENT=my-emacsclient
\r
70 +Normally, when new script starts and when test PASSes you get a message
\r
71 +printed on screen. This printing can be disabled by setting the
\r
72 +NOTMUCH_TEST_QUIET variable to a non-null value. Message on test
\r
73 +failures and skips are still printed.
\r
77 If, for any reason, you need to skip one or more tests, you can do so
\r
78 diff --git a/test/basic b/test/basic
\r
79 index 64eb7d7..3b7668b 100755
\r
82 @@ -73,14 +73,22 @@ suppress_diff_date() {
\r
83 -e 's/\(.*\+\+\+ test-verbose\.4\.\output\).*/\1/'
\r
86 +if [ -z "$NOTMUCH_TEST_QUIET" ]
\r
88 + test_verbose_no=$EXPECTED/test-verbose-no
\r
89 + test_verbose_yes=$EXPECTED/test-verbose-yes
\r
91 + test_verbose_no=$EXPECTED/test-quiet-verbose-no
\r
92 + test_verbose_yes=$EXPECTED/test-quiet-verbose-yes
\r
94 test_begin_subtest "Ensure that test output is suppressed unless the test fails"
\r
95 output=$(cd $TEST_DIRECTORY; ./test-verbose 2>&1 | suppress_diff_date)
\r
96 -expected=$(cat $EXPECTED/test-verbose-no | suppress_diff_date)
\r
97 +expected=$(cat ${test_verbose_no} | suppress_diff_date)
\r
98 test_expect_equal "$output" "$expected"
\r
100 test_begin_subtest "Ensure that -v does not suppress test output"
\r
101 output=$(cd $TEST_DIRECTORY; ./test-verbose -v 2>&1 | suppress_diff_date)
\r
102 -expected=$(cat $EXPECTED/test-verbose-yes | suppress_diff_date)
\r
103 +expected=$(cat ${test_verbose_yes} | suppress_diff_date)
\r
104 # Do not include the results of test-verbose in totals
\r
105 rm $TEST_DIRECTORY/test-results/test-verbose
\r
106 rm -r $TEST_DIRECTORY/tmp.test-verbose
\r
107 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
108 index e022e46..4b342ac 100644
\r
109 --- a/test/test-lib.sh
\r
110 +++ b/test/test-lib.sh
\r
111 @@ -195,7 +195,10 @@ print_test_description ()
\r
113 echo $this_test: "Testing ${test_description}"
\r
115 -print_test_description
\r
116 +if [ -z "$NOTMUCH_TEST_QUIET" ]
\r
118 + print_test_description
\r
123 @@ -703,6 +706,9 @@ test_ok_ () {
\r
126 test_success=$(($test_success + 1))
\r
127 + if test -n "$NOTMUCH_TEST_QUIET"; then
\r
130 say_color pass "%-6s" "PASS"
\r
131 echo " $test_subtest_name"
\r
133 @@ -713,6 +719,9 @@ test_failure_ () {
\r
136 test_failure=$(($test_failure + 1))
\r
137 + if test -n "$NOTMUCH_TEST_QUIET"; then
\r
138 + print_test_description
\r
140 test_failure_message_ "FAIL" "$test_subtest_name" "$@"
\r
141 test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; }
\r
143 diff --git a/test/test.expected-output/test-quiet-verbose-no b/test/test.expected-output/test-quiet-verbose-no
\r
144 new file mode 100644
\r
145 index 0000000..74840b9
\r
147 +++ b/test/test.expected-output/test-quiet-verbose-no
\r
150 +test-verbose: Testing the verbosity options of the test framework itself.
\r
151 + FAIL print something in test_expect_success and fail
\r
153 + echo "hello stdout" &&
\r
154 + echo "hello stderr" >&2 &&
\r
160 +test-verbose: Testing the verbosity options of the test framework itself.
\r
161 + FAIL print something test_begin_subtest and test_expect_equal and fail
\r
162 + --- test-verbose.4.expected
\r
163 + +++ test-verbose.4.output
\r
169 diff --git a/test/test.expected-output/test-quiet-verbose-yes b/test/test.expected-output/test-quiet-verbose-yes
\r
170 new file mode 100644
\r
171 index 0000000..51e759d
\r
173 +++ b/test/test.expected-output/test-quiet-verbose-yes
\r
180 +test-verbose: Testing the verbosity options of the test framework itself.
\r
181 + FAIL print something in test_expect_success and fail
\r
183 + echo "hello stdout" &&
\r
184 + echo "hello stderr" >&2 &&
\r
192 +test-verbose: Testing the verbosity options of the test framework itself.
\r
193 + FAIL print something test_begin_subtest and test_expect_equal and fail
\r
194 + --- test-verbose.4.expected
\r
195 + +++ test-verbose.4.output
\r