Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / cf / c181607d8671514ccd5cd7808938bbc2551f9c
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
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 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
25         usage\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
34 Precedence: list\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
45 \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
49 ---\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
58 \r
59 diff --git a/test/README b/test/README\r
60 index d12cff2..79a9b1b 100644\r
61 --- a/test/README\r
62 +++ b/test/README\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
66  \r
67 +Quiet Execution\r
68 +---------------\r
69 +\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
74 +\r
75  Skipping Tests\r
76  --------------\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
80 --- a/test/basic\r
81 +++ b/test/basic\r
82 @@ -73,14 +73,22 @@ suppress_diff_date() {\r
83         -e 's/\(.*\+\+\+ test-verbose\.4\.\output\).*/\1/'\r
84  }\r
85  \r
86 +if [ -z "$NOTMUCH_TEST_QUIET" ]\r
87 +then\r
88 +       test_verbose_no=$EXPECTED/test-verbose-no\r
89 +       test_verbose_yes=$EXPECTED/test-verbose-yes\r
90 +else\r
91 +       test_verbose_no=$EXPECTED/test-quiet-verbose-no\r
92 +       test_verbose_yes=$EXPECTED/test-quiet-verbose-yes\r
93 +fi\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
99  \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
112         echo\r
113         echo $this_test: "Testing ${test_description}"\r
114  }\r
115 -print_test_description\r
116 +if [ -z "$NOTMUCH_TEST_QUIET" ]\r
117 +then\r
118 +       print_test_description\r
119 +fi\r
120  \r
121  exec 5>&1\r
122  \r
123 @@ -703,6 +706,9 @@ test_ok_ () {\r
124                 return\r
125         fi\r
126         test_success=$(($test_success + 1))\r
127 +       if test -n "$NOTMUCH_TEST_QUIET"; then\r
128 +               return 0\r
129 +       fi\r
130         say_color pass "%-6s" "PASS"\r
131         echo " $test_subtest_name"\r
132  }\r
133 @@ -713,6 +719,9 @@ test_failure_ () {\r
134                 return\r
135         fi\r
136         test_failure=$(($test_failure + 1))\r
137 +       if test -n "$NOTMUCH_TEST_QUIET"; then\r
138 +               print_test_description\r
139 +       fi\r
140         test_failure_message_ "FAIL" "$test_subtest_name" "$@"\r
141         test "$immediate" = "" || { GIT_EXIT_OK=t; exit 1; }\r
142         return 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
146 --- /dev/null\r
147 +++ b/test/test.expected-output/test-quiet-verbose-no\r
148 @@ -0,0 +1,20 @@\r
149 +\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
152 +       \r
153 +         echo "hello stdout" &&\r
154 +         echo "hello stderr" >&2 &&\r
155 +         false\r
156 +       \r
157 +hello stdout\r
158 +hello stderr\r
159 +\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
164 +       @@ -1 +1 @@\r
165 +       -b\r
166 +       +a\r
167 +hello stdout\r
168 +hello stderr\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
172 --- /dev/null\r
173 +++ b/test/test.expected-output/test-quiet-verbose-yes\r
174 @@ -0,0 +1,24 @@\r
175 +hello stdout\r
176 +hello stderr\r
177 +hello stdout\r
178 +hello stderr\r
179 +\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
182 +       \r
183 +         echo "hello stdout" &&\r
184 +         echo "hello stderr" >&2 &&\r
185 +         false\r
186 +       \r
187 +hello stdout\r
188 +hello stderr\r
189 +hello stdout\r
190 +hello stderr\r
191 +\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
196 +       @@ -1 +1 @@\r
197 +       -b\r
198 +       +a\r
199 -- \r
200 1.8.3.1\r
201 \r