contrib/ksmtpproxy: Fix typo
[navymail.git] / t / test-lib.sh
blob4c4929a50c9695d7a78716ed1cbdf14f3cb8d356
1 # Test harness for navymail based on Git's t/test-lib.sh
2 # Copyright (C) 2011 Kirill Smelkov <kirr@navytux.spb.ru>
4 # This program is free software: you can Use, Study, Modify and Redistribute it
5 # under the terms of the GNU General Public License version 2, or any later
6 # version. This program is distributed WITHOUT ANY WARRANTY. See COPYING file
7 # for full License terms.
9 git=$(cd ../git && pwd) # Git is located here
10 objtree=$(cd .. && pwd) # navymail's objtree
11 t=$(pwd) # our test directory
13 # so that's git's test-lib.sh don't try to verify git has been built
14 GIT_TEST_INSTALLED=$(dirname $(which git))
16 # temporarily set TEST_DIRECTORY to git place, so that git's test-lib.sh would
17 # correctly set GIT_BUILD_DIR, etc...
18 TEST_DIRECTORY=$git/t
20 # we also need to explicitly tweak root, so that git's test-lib.sh don't set
21 # TRASH_DIRECTORY and descendants to inside $git
22 root=$t # TODO still allow $root to be overwritten by --root
24 # XXX is it possible to omit test_create_repo() running by git's test-lib?
25 . $git/t/test-lib.sh
27 # reset TEST_DIRECTORY back to us
28 TEST_DIRECTORY=$t
31 # --- now navymail part ---
33 export PATH="$objtree:$PATH"
35 unset NAVYMAIL_DIR
37 # Most tests can use the created mailstore, but some may need to create more.
38 # Usage: test_create_mailstore <dir>
39 test_create_mailstore() {
40 test "$#" = 1 ||
41 error "bug in the test script: not 1 parameter to test_create_mailstore"
42 navymail init "$1" >&3 2>&4 ||
43 error "cannot run 'navymail init' -- have you built things yet?"
47 mailstore="$test/test.gbox"
48 test_create_mailstore "$mailstore"
49 export NAVYMAIL_DIR="$mailstore"