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 3CDC6429E27
\r
6 for <notmuch@notmuchmail.org>; Mon, 25 Nov 2013 09:08:46 -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 YByIVZYlm4gf for <notmuch@notmuchmail.org>;
\r
16 Mon, 25 Nov 2013 09:08:40 -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 8670E431FDD
\r
19 for <notmuch@notmuchmail.org>; Mon, 25 Nov 2013 09:08:37 -0800 (PST)
\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)
\r
21 id 95939100063; Mon, 25 Nov 2013 19:08:27 +0200 (EET)
\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
23 To: notmuch@notmuchmail.org
\r
24 Subject: [PATCH 1/3] test: resolve `basename "$0" .sh` once for all in
\r
26 Date: Mon, 25 Nov 2013 19:08:17 +0200
\r
27 Message-Id: <1385399299-12936-1-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: Mon, 25 Nov 2013 17:08:46 -0000
\r
46 test-lib.sh sometimes did equivalent of `basename "$0" .sh`, sometimes
\r
47 skipping the basename part and sometimes .sh part. This worked as
\r
48 we never had path components in $0 (more than ./) nor .sh ending.
\r
50 Now the equivalent of `basename "$0" .sh` is done once and used
\r
51 everywhere. In the future we may have .sh suffix in test names
\r
52 -- removing those is a good idea.
\r
54 test/test-lib.sh | 12 +++++++-----
\r
55 1 file changed, 7 insertions(+), 5 deletions(-)
\r
57 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
58 index 8611ba5..6e47545 100644
\r
59 --- a/test/test-lib.sh
\r
60 +++ b/test/test-lib.sh
\r
61 @@ -23,19 +23,22 @@ if [ ${BASH_VERSINFO[0]} -lt 4 ]; then
\r
64 # Make sure echo builtin does not expand backslash-escape sequences by default.
\r
68 +this_test=${this_test%.sh}
\r
70 # if --tee was passed, write the output not only to the terminal, but
\r
71 # additionally to the file test-results/$BASENAME.out, too.
\r
72 case "$GIT_TEST_TEE_STARTED, $* " in
\r
74 # do not redirect again
\r
76 *' --tee '*|*' --va'*)
\r
77 mkdir -p test-results
\r
78 - BASE=test-results/$(basename "$0" .sh)
\r
79 + BASE=test-results/$this_test
\r
80 (GIT_TEST_TEE_STARTED=done ${SHELL-sh} "$0" "$@" 2>&1;
\r
81 echo $? > $BASE.exit) | tee $BASE.out
\r
82 test "$(cat $BASE.exit)" = 0
\r
85 @@ -185,11 +188,11 @@ if test "$help" = "t"
\r
87 echo "Tests ${test_description}"
\r
91 -echo $(basename "$0"): "Testing ${test_description}"
\r
92 +echo $this_test: "Testing ${test_description}"
\r
98 @@ -965,11 +968,11 @@ test_when_finished () {
\r
102 test_results_dir="$TEST_DIRECTORY/test-results"
\r
103 mkdir -p "$test_results_dir"
\r
104 - test_results_path="$test_results_dir/${0%.sh}"
\r
105 + test_results_path="$test_results_dir/$this_test"
\r
107 echo "total $test_count" >> $test_results_path
\r
108 echo "success $test_success" >> $test_results_path
\r
109 echo "fixed $test_fixed" >> $test_results_path
\r
110 echo "broken $test_broken" >> $test_results_path
\r
111 @@ -1024,11 +1027,11 @@ test_emacs () {
\r
112 test_require_external_prereq emacs || missing_dependencies=1
\r
113 test_require_external_prereq ${TEST_EMACSCLIENT} || missing_dependencies=1
\r
114 test -z "$missing_dependencies" || return
\r
116 if [ -z "$EMACS_SERVER" ]; then
\r
117 - emacs_tests="$(basename $0).el"
\r
118 + emacs_tests="${this_test}.el"
\r
119 if [ -f "$TEST_DIRECTORY/$emacs_tests" ]; then
\r
120 load_emacs_tests="--eval '(load \"$emacs_tests\")'"
\r
124 @@ -1138,11 +1141,10 @@ then
\r
127 exec 4>test.output 3>&4
\r
130 -this_test=${0##*/}
\r
131 for skp in $NOTMUCH_SKIP_TESTS
\r
134 for skp in $NOTMUCH_SKIP_TESTS
\r