[PATCH 4/4] Update NEWS for user.other_name
[notmuch-archives.git] / b1 / 1c3fbc1a134ccb11696b5314bf58f7661222d1
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 arlo.cworth.org (Postfix) with ESMTP id 01A466DE1502\r
6  for <notmuch@notmuchmail.org>; Thu,  3 Sep 2015 12:11:32 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.215\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.215 tagged_above=-999 required=5 tests=[AWL=0.755, \r
12  RP_MATCHES_RCVD=-0.55, T_HEADER_FROM_DIFFERENT_DOMAINS=0.01]\r
13  autolearn=disabled\r
14 Received: from arlo.cworth.org ([127.0.0.1])\r
15  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
16  with ESMTP id 1KF7CbfJxemo for <notmuch@notmuchmail.org>;\r
17  Thu,  3 Sep 2015 12:11:29 -0700 (PDT)\r
18 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
19  by arlo.cworth.org (Postfix) with ESMTP id 1503D6DE1479\r
20  for <notmuch@notmuchmail.org>; Thu,  3 Sep 2015 12:11:29 -0700 (PDT)\r
21 Received: by guru.guru-group.fi (Postfix, from userid 501)\r
22  id B959C10019C; Thu,  3 Sep 2015 22:09:57 +0300 (EEST)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: notmuch@notmuchmail.org\r
25 Subject: [PATCH] test: add "set -u" to test-lib.sh\r
26 Date: Thu,  3 Sep 2015 22:09:55 +0300\r
27 Message-Id: <1441307395-2218-1-git-send-email-tomi.ollila@iki.fi>\r
28 X-Mailer: git-send-email 2.0.0\r
29 Cc: tomi.ollila@iki.fi\r
30 X-BeenThere: notmuch@notmuchmail.org\r
31 X-Mailman-Version: 2.1.18\r
32 Precedence: list\r
33 List-Id: "Use and development of the notmuch mail system."\r
34  <notmuch.notmuchmail.org>\r
35 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
36  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
37 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
38 List-Post: <mailto:notmuch@notmuchmail.org>\r
39 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
40 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
41  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
42 X-List-Received-Date: Thu, 03 Sep 2015 19:11:32 -0000\r
43 \r
44 This prohibits unset variables to expand to empty strings.\r
45 Without this e.g misspelled variables cause unintentional results.\r
46 \r
47 Now all the test variables are either initialized, or in case of\r
48 optional arguments and user-provided environment variables the\r
49 form ${variable-} is used.\r
50 \r
51 Two unusable lines (leftovers?) in T360-symbol-hiding.sh were removed;\r
52 this was the only non-lib test code that needed to be edited for this\r
53 change to work.\r
54 ---\r
55  test/T360-symbol-hiding.sh |  3 ---\r
56  test/test-lib.sh           | 63 ++++++++++++++++++++++++++--------------------\r
57  2 files changed, 36 insertions(+), 30 deletions(-)\r
58 \r
59 diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh\r
60 index 4ec0ea6..1e6814b 100755\r
61 --- a/test/T360-symbol-hiding.sh\r
62 +++ b/test/T360-symbol-hiding.sh\r
63 @@ -23,9 +23,6 @@ caught No chert database found at path \`CWD/nonexistent'\r
64  EOF\r
65  test_expect_equal_file EXPECTED OUTPUT\r
66  \r
67 -test_begin_subtest 'checking output'\r
68 -test_expect_equal "$result" "$output"\r
69 -\r
70  test_begin_subtest 'comparing existing to exported symbols'\r
71  nm -P $TEST_DIRECTORY/../lib/libnotmuch.so | awk '$2 == "T" && $1 ~ "^notmuch" {print $1}' | sort | uniq > ACTUAL\r
72  sed -n 's/[[:blank:]]*\(notmuch_[^;]*\);/\1/p' $TEST_DIRECTORY/../notmuch.sym | sort | uniq > EXPORTED\r
73 diff --git a/test/test-lib.sh b/test/test-lib.sh\r
74 index 126911f..c85d149 100644\r
75 --- a/test/test-lib.sh\r
76 +++ b/test/test-lib.sh\r
77 @@ -22,6 +22,9 @@ if [ ${BASH_VERSINFO[0]} -lt 4 ]; then\r
78      exit 1\r
79  fi\r
80  \r
81 +# Make sure misspelled variables are not to be expanded to empty strings.\r
82 +set -u\r
83 +\r
84  # Make sure echo builtin does not expand backslash-escape sequences by default.\r
85  shopt -u xpg_echo\r
86  \r
87 @@ -31,7 +34,7 @@ this_test_bare=${this_test#T[0-9][0-9][0-9]-}\r
88  \r
89  # if --tee was passed, write the output not only to the terminal, but\r
90  # additionally to the file test-results/$BASENAME.out, too.\r
91 -case "$GIT_TEST_TEE_STARTED, $* " in\r
92 +case "${GIT_TEST_TEE_STARTED-}, $* " in\r
93  done,*)\r
94         # do not redirect again\r
95         ;;\r
96 @@ -66,8 +69,8 @@ TZ=UTC\r
97  TERM=dumb\r
98  export LANG LC_ALL PAGER TERM TZ\r
99  GIT_TEST_CMP=${GIT_TEST_CMP:-diff -u}\r
100 -if [[ ( -n "$TEST_EMACS" && -z "$TEST_EMACSCLIENT" ) || \\r
101 -      ( -z "$TEST_EMACS" && -n "$TEST_EMACSCLIENT" ) ]]; then\r
102 +if [[ ( -n "${TEST_EMACS-}" && -z "${TEST_EMACSCLIENT-}" ) || \\r
103 +      ( -z "${TEST_EMACS-}" && -n "${TEST_EMACSCLIENT-}" ) ]]; then\r
104      echo "error: must specify both or neither of TEST_EMACS and TEST_EMACSCLIENT" >&2\r
105      exit 1\r
106  fi\r
107 @@ -98,6 +101,9 @@ _x32="$_x04$_x04$_x04$_x04$_x04$_x04$_x04$_x04"\r
108  # '\r
109  # . ./test-lib.sh || exit 1\r
110  \r
111 +debug= immediate= GIT_TEST_LONG= help= verbose= quiet= with_dashes=\r
112 +color= valgrind= verbose= root=\r
113 +\r
114  [ "x$ORIGINAL_TERM" != "xdumb" ] && (\r
115                 TERM=$ORIGINAL_TERM &&\r
116                 export TERM &&\r
117 @@ -208,7 +214,7 @@ print_test_description ()\r
118         echo $this_test: "Testing ${test_description}"\r
119         test_description_printed=1\r
120  }\r
121 -if [ -z "$NOTMUCH_TEST_QUIET" ]\r
122 +if [ -z "${NOTMUCH_TEST_QUIET-}" ]\r
123  then\r
124         print_test_description\r
125  fi\r
126 @@ -331,6 +337,7 @@ remove_cr () {\r
127  gen_msg_cnt=0\r
128  gen_msg_filename=""\r
129  gen_msg_id=""\r
130 +test_subtest_name=\r
131  generate_message ()\r
132  {\r
133      # This is our (bash-specific) magic for doing named parameters\r
134 @@ -338,38 +345,38 @@ generate_message ()\r
135      local additional_headers\r
136  \r
137      gen_msg_cnt=$((gen_msg_cnt + 1))\r
138 -    if [ -z "${template[filename]}" ]; then\r
139 +    if [ -z "${template[filename]-}" ]; then\r
140         gen_msg_name="msg-$(printf "%03d" $gen_msg_cnt)"\r
141      else\r
142         gen_msg_name=${template[filename]}\r
143      fi\r
144  \r
145 -    if [ -z "${template[id]}" ]; then\r
146 +    if [ -z "${template[id]-}" ]; then\r
147         gen_msg_id="${gen_msg_name%:2,*}@notmuch-test-suite"\r
148      else\r
149         gen_msg_id="${template[id]}"\r
150      fi\r
151  \r
152 -    if [ -z "${template[dir]}" ]; then\r
153 +    if [ -z "${template[dir]-}" ]; then\r
154         gen_msg_filename="${MAIL_DIR}/$gen_msg_name"\r
155      else\r
156         gen_msg_filename="${MAIL_DIR}/${template[dir]}/$gen_msg_name"\r
157         mkdir -p "$(dirname "$gen_msg_filename")"\r
158      fi\r
159  \r
160 -    if [ -z "${template[body]}" ]; then\r
161 +    if [ -z "${template[body]-}" ]; then\r
162         template[body]="This is just a test message (#${gen_msg_cnt})"\r
163      fi\r
164  \r
165 -    if [ -z "${template[from]}" ]; then\r
166 +    if [ -z "${template[from]-}" ]; then\r
167         template[from]="Notmuch Test Suite <test_suite@notmuchmail.org>"\r
168      fi\r
169  \r
170 -    if [ -z "${template[to]}" ]; then\r
171 +    if [ -z "${template[to]-}" ]; then\r
172         template[to]="Notmuch Test Suite <test_suite@notmuchmail.org>"\r
173      fi\r
174  \r
175 -    if [ -z "${template[subject]}" ]; then\r
176 +    if [ -z "${template[subject]-}" ]; then\r
177         if [ -n "$test_subtest_name" ]; then\r
178             template[subject]="$test_subtest_name"\r
179         else\r
180 @@ -379,7 +386,7 @@ generate_message ()\r
181         template[subject]=""\r
182      fi\r
183  \r
184 -    if [ -z "${template[date]}" ]; then\r
185 +    if [ -z "${template[date]-}" ]; then\r
186         # we use decreasing timestamps here for historical reasons;\r
187         # the existing test suite when we converted to unique timestamps just\r
188         # happened to have signicantly fewer failures with that choice.\r
189 @@ -392,42 +399,42 @@ generate_message ()\r
190      fi\r
191  \r
192      additional_headers=""\r
193 -    if [ ! -z "${template[header]}" ]; then\r
194 +    if [ ! -z "${template[header]-}" ]; then\r
195         additional_headers="${template[header]}\r
196  ${additional_headers}"\r
197      fi\r
198  \r
199 -    if [ ! -z "${template[reply-to]}" ]; then\r
200 +    if [ ! -z "${template[reply-to]-}" ]; then\r
201         additional_headers="Reply-To: ${template[reply-to]}\r
202  ${additional_headers}"\r
203      fi\r
204  \r
205 -    if [ ! -z "${template[in-reply-to]}" ]; then\r
206 +    if [ ! -z "${template[in-reply-to]-}" ]; then\r
207         additional_headers="In-Reply-To: ${template[in-reply-to]}\r
208  ${additional_headers}"\r
209      fi\r
210  \r
211 -    if [ ! -z "${template[cc]}" ]; then\r
212 +    if [ ! -z "${template[cc]-}" ]; then\r
213         additional_headers="Cc: ${template[cc]}\r
214  ${additional_headers}"\r
215      fi\r
216  \r
217 -    if [ ! -z "${template[bcc]}" ]; then\r
218 +    if [ ! -z "${template[bcc]-}" ]; then\r
219         additional_headers="Bcc: ${template[bcc]}\r
220  ${additional_headers}"\r
221      fi\r
222  \r
223 -    if [ ! -z "${template[references]}" ]; then\r
224 +    if [ ! -z "${template[references]-}" ]; then\r
225         additional_headers="References: ${template[references]}\r
226  ${additional_headers}"\r
227      fi\r
228  \r
229 -    if [ ! -z "${template[content-type]}" ]; then\r
230 +    if [ ! -z "${template[content-type]-}" ]; then\r
231         additional_headers="Content-Type: ${template[content-type]}\r
232  ${additional_headers}"\r
233      fi\r
234  \r
235 -    if [ ! -z "${template[content-transfer-encoding]}" ]; then\r
236 +    if [ ! -z "${template[content-transfer-encoding]-}" ]; then\r
237         additional_headers="Content-Transfer-Encoding: ${template[content-transfer-encoding]}\r
238  ${additional_headers}"\r
239      fi\r
240 @@ -545,6 +552,7 @@ add_email_corpus ()\r
241      fi\r
242  }\r
243  \r
244 +inside_subtest=\r
245  test_begin_subtest ()\r
246  {\r
247      if [ -n "$inside_subtest" ]; then\r
248 @@ -775,7 +783,7 @@ $binary () {\r
249  # Returns success if dependency is available, failure otherwise.\r
250  test_require_external_prereq () {\r
251         binary="$1"\r
252 -       if [[ ${test_missing_external_prereq_["${binary}"]} == t ]]; then\r
253 +       if [[ ${test_missing_external_prereq_["${binary}"]-} == t ]]; then\r
254                 # dependency is missing, call the replacement function to note it\r
255                 eval "$binary"\r
256         else\r
257 @@ -792,7 +800,7 @@ test_ok_ () {\r
258                 return\r
259         fi\r
260         test_success=$(($test_success + 1))\r
261 -       if test -n "$NOTMUCH_TEST_QUIET"; then\r
262 +       if test -n "${NOTMUCH_TEST_QUIET-}"; then\r
263                 return 0\r
264         fi\r
265         say_color pass "%-6s" "PASS"\r
266 @@ -849,7 +857,7 @@ test_run_ () {\r
267  test_skip () {\r
268         test_count=$(($test_count+1))\r
269         to_skip=\r
270 -       for skp in $NOTMUCH_SKIP_TESTS\r
271 +       for skp in ${NOTMUCH_SKIP_TESTS-}\r
272         do\r
273                 case $this_test.$test_count in\r
274                 $skp)\r
275 @@ -1109,7 +1117,7 @@ exec ${TEST_EMACS} --quick \\r
276  EOF\r
277         chmod a+x "$TMP_DIRECTORY/run_emacs"\r
278  }\r
279 -\r
280 +EMACS_SERVER=\r
281  test_emacs () {\r
282         # test dependencies beforehand to avoid the waiting loop below\r
283         missing_dependencies=\r
284 @@ -1213,6 +1221,7 @@ notmuch_counter_value () {\r
285         echo $count\r
286  }\r
287  \r
288 +test_init_done_=\r
289  test_reset_state_ () {\r
290         test -z "$test_init_done_" && test_init_\r
291  \r
292 @@ -1245,7 +1254,7 @@ else\r
293         exec 4>test.output 3>&4\r
294  fi\r
295  \r
296 -for skp in $NOTMUCH_SKIP_TESTS\r
297 +for skp in ${NOTMUCH_SKIP_TESTS-}\r
298  do\r
299         to_skip=\r
300         for skp in $NOTMUCH_SKIP_TESTS\r
301 @@ -1312,8 +1321,8 @@ case $(uname -s) in\r
302         ;;\r
303  esac\r
304  \r
305 -test -z "$NO_PERL" && test_set_prereq PERL\r
306 -test -z "$NO_PYTHON" && test_set_prereq PYTHON\r
307 +test -z "${NO_PERL-}" && test_set_prereq PERL\r
308 +test -z "${NO_PYTHON-}" && test_set_prereq PYTHON\r
309  \r
310  # test whether the filesystem supports symbolic links\r
311  ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS\r
312 -- \r
313 1.9.3\r
314 \r