]> diplodocus.org Git - nmh/blob - test/format/test-myhost
strindex.c: Move interface to own file.
[nmh] / test / format / test-myhost
1 #!/bin/sh
2 #
3 # Test that the %(myhost) function returns the local hostname and
4 # the localname entry out of the mts configuration file.
5 #
6
7 if test -z "${MH_OBJ_DIR}"; then
8 srcdir=`dirname "$0"`/../..
9 MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
10 fi
11
12 . "$MH_OBJ_DIR/test/common.sh"
13
14 setup_test
15
16 start_test 'local hostname test'
17 set +e
18 host=`${MH_OBJ_DIR}/test/getcanon`
19 set -e
20 myhost=`${MH_LIBEXEC_DIR}/ap -format '%(myhost)' ignore 2>&1`
21 if [ "$myhost" != "$host" ]; then
22 echo "$0: myhost reports $myhost but canonical hostname is $host"
23 fi
24
25 start_test 'mts.conf localname test'
26 cp ${MHMTSCONF} ${MH_TEST_DIR}/Mail/mts.conf || exit 1
27 MHMTSCONF="${MH_TEST_DIR}/Mail/mts.conf"
28
29 echo "localname: some.random.name" >> ${MHMTSCONF}
30
31 run_test "${MH_LIBEXEC_DIR}/ap -format %(myhost) ignore" "some.random.name"
32
33
34 finish_test
35 exit $failed