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 308CF431FDC
\r
6 for <notmuch@notmuchmail.org>; Tue, 12 Nov 2013 12:41:22 -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 hF8o721EUuIK for <notmuch@notmuchmail.org>;
\r
16 Tue, 12 Nov 2013 12:41:16 -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 8722D431FCF
\r
19 for <notmuch@notmuchmail.org>; Tue, 12 Nov 2013 12:41:16 -0800 (PST)
\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)
\r
21 id 30DE810009D; Tue, 12 Nov 2013 22:41:10 +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: Tue, 12 Nov 2013 22:41:06 +0200
\r
27 Message-Id: <1384288868-23903-1-git-send-email-tomi.ollila@iki.fi>
\r
28 X-Mailer: git-send-email 1.8.0
\r
29 Cc: tomi.ollila@iki.fi
\r
30 X-BeenThere: notmuch@notmuchmail.org
\r
31 X-Mailman-Version: 2.1.13
\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: Tue, 12 Nov 2013 20:41:22 -0000
\r
44 test-lib.sh sometimes did equivalent of `basename "$0" .sh`, sometimes
\r
45 skipping the basename part and sometimes .sh part. This worked as
\r
46 we never had path components in $0 (more than ./) nor .sh ending.
\r
48 Now the equivalent of `basename "$0" .sh` is done once and used
\r
49 everywhere. In the future we may have .sh suffix in test names
\r
50 -- removing those is a good idea.
\r
52 test/test-lib.sh | 12 +++++++-----
\r
53 1 file changed, 7 insertions(+), 5 deletions(-)
\r
55 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
56 index 2aa4dfc..808bb7f 100644
\r
57 --- a/test/test-lib.sh
\r
58 +++ b/test/test-lib.sh
\r
59 @@ -25,6 +25,9 @@ fi
\r
60 # Make sure echo builtin does not expand backslash-escape sequences by default.
\r
64 +this_test=${this_test%.sh}
\r
66 # if --tee was passed, write the output not only to the terminal, but
\r
67 # additionally to the file test-results/$BASENAME.out, too.
\r
68 case "$GIT_TEST_TEE_STARTED, $* " in
\r
69 @@ -33,7 +36,7 @@ done,*)
\r
71 *' --tee '*|*' --va'*)
\r
72 mkdir -p test-results
\r
73 - BASE=test-results/$(basename "$0" .sh)
\r
74 + BASE=test-results/$this_test
\r
75 (GIT_TEST_TEE_STARTED=done ${SHELL-sh} "$0" "$@" 2>&1;
\r
76 echo $? > $BASE.exit) | tee $BASE.out
\r
77 test "$(cat $BASE.exit)" = 0
\r
78 @@ -187,7 +190,7 @@ then
\r
82 -echo $(basename "$0"): "Testing ${test_description}"
\r
83 +echo $this_test: "Testing ${test_description}"
\r
87 @@ -956,7 +959,7 @@ test_done () {
\r
89 test_results_dir="$TEST_DIRECTORY/test-results"
\r
90 mkdir -p "$test_results_dir"
\r
91 - test_results_path="$test_results_dir/${0%.sh}"
\r
92 + test_results_path="$test_results_dir/$this_test"
\r
94 echo "total $test_count" >> $test_results_path
\r
95 echo "success $test_success" >> $test_results_path
\r
96 @@ -1015,7 +1018,7 @@ test_emacs () {
\r
97 test -z "$missing_dependencies" || return
\r
99 if [ -z "$EMACS_SERVER" ]; then
\r
100 - emacs_tests="$(basename $0).el"
\r
101 + emacs_tests="${this_test}.el"
\r
102 if [ -f "$TEST_DIRECTORY/$emacs_tests" ]; then
\r
103 load_emacs_tests="--eval '(load \"$emacs_tests\")'"
\r
105 @@ -1129,7 +1132,6 @@ else
\r
106 exec 4>test.output 3>&4
\r
109 -this_test=${0##*/}
\r
110 for skp in $NOTMUCH_SKIP_TESTS
\r