]> diplodocus.org Git - nmh/blobdiff - test/format/test-myhost
annosbr.c: free(3) takes void pointer; don't cast non-const pointer.
[nmh] / test / format / test-myhost
index d303a8f2f47604026df9bd72f587369e19522d62..43cce195ba10ca9d56f936c8c8ce839e0b7f5c19 100755 (executable)
@@ -4,31 +4,32 @@
 # the localname entry out of the mts configuration file.
 #
 
-if [ -z "${MH_TEST_COMMON}" ]; then
-       echo "MH_TEST_COMMON not set; try running via 'make check'"
+if test -z "${MH_OBJ_DIR}"; then
+    srcdir=`dirname "$0"`/../..
+    MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR
 fi
 
-. ${MH_TEST_COMMON}
+. "$MH_OBJ_DIR/test/common.sh"
 
 setup_test
 
-runtest()
-{
-       testoutput=$(${MH_LIB_DIR}/ap -format "%(myhost)" ignore)
-
-       if [ x"$1" != x"${testoutput}" ]; then
-               echo "For $2, expected $1 but got ${testoutput}"
-               exit 1
-       fi
-}
-
-runtest "$(hostname)" "local hostname test"
+start_test 'local hostname test'
+set +e
+host=`${MH_OBJ_DIR}/test/getcanon`
+set -e
+myhost=`${MH_LIBEXEC_DIR}/ap -format '%(myhost)' ignore 2>&1`
+if [ "$myhost" != "$host" ]; then
+   echo "$0: myhost reports $myhost but canonical hostname is $host"
+fi
 
+start_test 'mts.conf localname test'
 cp ${MHMTSCONF} ${MH_TEST_DIR}/Mail/mts.conf || exit 1
-export MHMTSCONF="${MH_TEST_DIR}/Mail/mts.conf"
+MHMTSCONF="${MH_TEST_DIR}/Mail/mts.conf"
 
 echo "localname: some.random.name" >> ${MHMTSCONF}
 
-runtest "some.random.name" "mts.conf localname test"
+run_test "${MH_LIBEXEC_DIR}/ap -format %(myhost) ignore" "some.random.name"
+
 
-exit 0
+finish_test
+exit $failed