1 Return-Path: <bremner@tethera.net>
\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 1B3BE431FC4
\r
6 for <notmuch@notmuchmail.org>; Mon, 19 Nov 2012 18:23:42 -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 l82lhS++ovoF for <notmuch@notmuchmail.org>;
\r
16 Mon, 19 Nov 2012 18:23:40 -0800 (PST)
\r
17 Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])
\r
18 (using TLSv1 with cipher AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 70087431FC2
\r
21 for <notmuch@notmuchmail.org>; Mon, 19 Nov 2012 18:23:40 -0800 (PST)
\r
22 Received: from fctnnbsc30w-156034089108.dhcp-dynamic.fibreop.nb.bellaliant.net
\r
23 ([156.34.89.108] helo=zancas.localnet)
\r
24 by tesseract.cs.unb.ca with esmtpsa
\r
25 (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72)
\r
26 (envelope-from <bremner@tethera.net>)
\r
27 id 1TadUu-0004EN-HH; Mon, 19 Nov 2012 22:23:39 -0400
\r
28 Received: from bremner by zancas.localnet with local (Exim 4.80)
\r
29 (envelope-from <bremner@tethera.net>)
\r
30 id 1TadUo-0007SH-8l; Mon, 19 Nov 2012 22:23:30 -0400
\r
31 From: david@tethera.net
\r
32 To: notmuch@notmuchmail.org
\r
33 Subject: [PATCH 1/2] test: factor out part of test-lib.sh into
\r
35 Date: Mon, 19 Nov 2012 22:23:19 -0400
\r
36 Message-Id: <1353378200-28625-1-git-send-email-david@tethera.net>
\r
37 X-Mailer: git-send-email 1.7.10.4
\r
38 In-Reply-To: <1353188234-29666-1-git-send-email-david@tethera.net>
\r
39 References: <1353188234-29666-1-git-send-email-david@tethera.net>
\r
41 Cc: David Bremner <bremner@debian.org>
\r
42 X-BeenThere: notmuch@notmuchmail.org
\r
43 X-Mailman-Version: 2.1.13
\r
45 List-Id: "Use and development of the notmuch mail system."
\r
46 <notmuch.notmuchmail.org>
\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
50 List-Post: <mailto:notmuch@notmuchmail.org>
\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
54 X-List-Received-Date: Tue, 20 Nov 2012 02:23:42 -0000
\r
56 From: David Bremner <bremner@debian.org>
\r
58 The idea is to use some of the simpler parts of the test suite
\r
59 infrastructure to help run performance tests.
\r
61 test/test-lib-common.sh | 147 +++++++++++++++++++++++++++++++++++++++++++++++
\r
62 test/test-lib.sh | 129 +----------------------------------------
\r
63 2 files changed, 148 insertions(+), 128 deletions(-)
\r
64 create mode 100644 test/test-lib-common.sh
\r
66 diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
\r
67 new file mode 100644
\r
68 index 0000000..e1eaa5a
\r
70 +++ b/test/test-lib-common.sh
\r
73 +# Copyright (c) 2005 Junio C Hamano
\r
75 +# This program is free software: you can redistribute it and/or modify
\r
76 +# it under the terms of the GNU General Public License as published by
\r
77 +# the Free Software Foundation, either version 2 of the License, or
\r
78 +# (at your option) any later version.
\r
80 +# This program is distributed in the hope that it will be useful,
\r
81 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
82 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
83 +# GNU General Public License for more details.
\r
85 +# You should have received a copy of the GNU General Public License
\r
86 +# along with this program. If not, see http://www.gnu.org/licenses/ .
\r
88 +# This file contains common code to be used by both the regular
\r
89 +# (correctness) tests and the performance tests.
\r
91 +find_notmuch_path ()
\r
95 + while [ -n "$dir" ]; do
\r
96 + bin="$dir/notmuch"
\r
97 + if [ -x "$bin" ]; then
\r
101 + dir="$(dirname "$dir")"
\r
102 + if [ "$dir" = "/" ]; then
\r
108 +# Test the binaries we have just built. The tests are kept in
\r
109 +# test/ subdirectory and are run in 'trash directory' subdirectory.
\r
110 +TEST_DIRECTORY=$(pwd)
\r
111 +notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`
\r
112 +if test -n "$valgrind"
\r
114 + make_symlink () {
\r
116 + test "$1" = "$(readlink "$2")" || {
\r
117 + # be super paranoid
\r
118 + if mkdir "$2".lock
\r
121 + ln -s "$1" "$2" &&
\r
124 + while test -d "$2".lock
\r
126 + say "Waiting for lock on $2."
\r
133 + make_valgrind_symlink () {
\r
134 + # handle only executables
\r
135 + test -x "$1" || return
\r
137 + base=$(basename "$1")
\r
138 + symlink_target=$TEST_DIRECTORY/../$base
\r
139 + # do not override scripts
\r
140 + if test -x "$symlink_target" &&
\r
141 + test ! -d "$symlink_target" &&
\r
142 + test "#!" != "$(head -c 2 < "$symlink_target")"
\r
144 + symlink_target=$TEST_DIRECTORY/valgrind.sh
\r
148 + symlink_target=$TEST_DIRECTORY/unprocessed-script
\r
150 + # create the link, or replace it if it is out of date
\r
151 + make_symlink "$symlink_target" "$GIT_VALGRIND/bin/$base" || exit
\r
154 + # override notmuch executable in TEST_DIRECTORY/..
\r
155 + GIT_VALGRIND=$TEST_DIRECTORY/valgrind
\r
156 + mkdir -p "$GIT_VALGRIND"/bin
\r
157 + make_valgrind_symlink $TEST_DIRECTORY/../notmuch
\r
160 + for path in $PATH
\r
162 + ls "$path"/notmuch 2> /dev/null |
\r
165 + make_valgrind_symlink "$file"
\r
169 + PATH=$GIT_VALGRIND/bin:$PATH
\r
170 + GIT_EXEC_PATH=$GIT_VALGRIND/bin
\r
171 + export GIT_VALGRIND
\r
172 + test -n "$notmuch_path" && MANPATH="$notmuch_path/man:$MANPATH"
\r
173 +else # normal case
\r
174 + if test -n "$notmuch_path"
\r
176 + PATH="$notmuch_path:$PATH"
\r
177 + MANPATH="$notmuch_path/man:$MANPATH"
\r
180 +export PATH MANPATH
\r
183 +test="tmp.$(basename "$0" .sh)"
\r
184 +test -n "$root" && test="$root/$test"
\r
186 +/*) TMP_DIRECTORY="$test" ;;
\r
187 + *) TMP_DIRECTORY="$TEST_DIRECTORY/$test" ;;
\r
189 +test ! -z "$debug" || remove_tmp=$TMP_DIRECTORY
\r
190 +rm -fr "$test" || {
\r
192 + echo >&5 "FATAL: Cannot prepare test area"
\r
196 +# A temporary home directory is needed by at least:
\r
197 +# - emacs/"Sending a message via (fake) SMTP"
\r
198 +# - emacs/"Reply within emacs"
\r
199 +# - crypto/emacs_deliver_message
\r
200 +export HOME="${TMP_DIRECTORY}/home"
\r
201 +mkdir -p "${HOME}"
\r
203 +MAIL_DIR="${TMP_DIRECTORY}/mail"
\r
204 +export GNUPGHOME="${TMP_DIRECTORY}/gnupg"
\r
205 +export NOTMUCH_CONFIG="${TMP_DIRECTORY}/notmuch-config"
\r
207 +mkdir -p "${test}"
\r
208 +mkdir -p "${MAIL_DIR}"
\r
210 +cat <<EOF >"${NOTMUCH_CONFIG}"
\r
215 +name=Notmuch Test Suite
\r
216 +primary_email=test_suite@notmuchmail.org
\r
217 +other_email=test_suite_other@notmuchmail.org;test_suite@otherdomain.org
\r
219 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
220 index e7638be..6548b29 100644
\r
221 --- a/test/test-lib.sh
\r
222 +++ b/test/test-lib.sh
\r
223 @@ -1070,134 +1070,7 @@ test_init_ () {
\r
227 -find_notmuch_path ()
\r
231 - while [ -n "$dir" ]; do
\r
232 - bin="$dir/notmuch"
\r
233 - if [ -x "$bin" ]; then
\r
237 - dir="$(dirname "$dir")"
\r
238 - if [ "$dir" = "/" ]; then
\r
244 -# Test the binaries we have just built. The tests are kept in
\r
245 -# test/ subdirectory and are run in 'trash directory' subdirectory.
\r
246 -TEST_DIRECTORY=$(pwd)
\r
247 -notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`
\r
248 -if test -n "$valgrind"
\r
250 - make_symlink () {
\r
252 - test "$1" = "$(readlink "$2")" || {
\r
253 - # be super paranoid
\r
254 - if mkdir "$2".lock
\r
257 - ln -s "$1" "$2" &&
\r
260 - while test -d "$2".lock
\r
262 - say "Waiting for lock on $2."
\r
269 - make_valgrind_symlink () {
\r
270 - # handle only executables
\r
271 - test -x "$1" || return
\r
273 - base=$(basename "$1")
\r
274 - symlink_target=$TEST_DIRECTORY/../$base
\r
275 - # do not override scripts
\r
276 - if test -x "$symlink_target" &&
\r
277 - test ! -d "$symlink_target" &&
\r
278 - test "#!" != "$(head -c 2 < "$symlink_target")"
\r
280 - symlink_target=$TEST_DIRECTORY/valgrind.sh
\r
284 - symlink_target=$TEST_DIRECTORY/unprocessed-script
\r
286 - # create the link, or replace it if it is out of date
\r
287 - make_symlink "$symlink_target" "$GIT_VALGRIND/bin/$base" || exit
\r
290 - # override notmuch executable in TEST_DIRECTORY/..
\r
291 - GIT_VALGRIND=$TEST_DIRECTORY/valgrind
\r
292 - mkdir -p "$GIT_VALGRIND"/bin
\r
293 - make_valgrind_symlink $TEST_DIRECTORY/../notmuch
\r
296 - for path in $PATH
\r
298 - ls "$path"/notmuch 2> /dev/null |
\r
301 - make_valgrind_symlink "$file"
\r
305 - PATH=$GIT_VALGRIND/bin:$PATH
\r
306 - GIT_EXEC_PATH=$GIT_VALGRIND/bin
\r
307 - export GIT_VALGRIND
\r
308 - test -n "$notmuch_path" && MANPATH="$notmuch_path/man:$MANPATH"
\r
309 -else # normal case
\r
310 - if test -n "$notmuch_path"
\r
312 - PATH="$notmuch_path:$PATH"
\r
313 - MANPATH="$notmuch_path/man:$MANPATH"
\r
316 -export PATH MANPATH
\r
319 -test="tmp.$(basename "$0" .sh)"
\r
320 -test -n "$root" && test="$root/$test"
\r
322 -/*) TMP_DIRECTORY="$test" ;;
\r
323 - *) TMP_DIRECTORY="$TEST_DIRECTORY/$test" ;;
\r
325 -test ! -z "$debug" || remove_tmp=$TMP_DIRECTORY
\r
326 -rm -fr "$test" || {
\r
328 - echo >&5 "FATAL: Cannot prepare test area"
\r
332 -# A temporary home directory is needed by at least:
\r
333 -# - emacs/"Sending a message via (fake) SMTP"
\r
334 -# - emacs/"Reply within emacs"
\r
335 -# - crypto/emacs_deliver_message
\r
336 -export HOME="${TMP_DIRECTORY}/home"
\r
337 -mkdir -p "${HOME}"
\r
339 -MAIL_DIR="${TMP_DIRECTORY}/mail"
\r
340 -export GNUPGHOME="${TMP_DIRECTORY}/gnupg"
\r
341 -export NOTMUCH_CONFIG="${TMP_DIRECTORY}/notmuch-config"
\r
343 -mkdir -p "${test}"
\r
344 -mkdir -p "${MAIL_DIR}"
\r
346 -cat <<EOF >"${NOTMUCH_CONFIG}"
\r
351 -name=Notmuch Test Suite
\r
352 -primary_email=test_suite@notmuchmail.org
\r
353 -other_email=test_suite_other@notmuchmail.org;test_suite@otherdomain.org
\r
355 +. test-lib-common.sh
\r
357 emacs_generate_script
\r