Truncated -help test in test-whom because its output depends on whether
[mmh] / test / common.sh.in
index 58297f0..aa34927 100644 (file)
@@ -14,11 +14,15 @@ test -z "$bindir"  &&  bindir="@bindir@"
 test -z "$mandir"  &&  mandir="@mandir@"
 test -z "$sysconfdir"  &&  sysconfdir="@sysconfdir@"
 test -z "$pagerpath"  &&  pagerpath="@pagerpath@"
+test -z "$MULTIBYTE_ENABLED"  &&  MULTIBYTE_ENABLED="@MULTIBYTE_ENABLED@"
 export MH_TEST_DIR auxexecdir bindir mandir sysconfdir pagerpath
+export MULTIBYTE_ENABLED
 
 test -z "$MH_INST_DIR"  &&  MH_INST_DIR=${MH_TEST_DIR}/inst
 export MH_INST_DIR
 
+unset MHBUILD MHCONTEXT MHMTSUSERCONF MHN MHSHOW MHSTORE MHTMPDIR
+unset MHLDEBUG MHPDEBUG MHWDEBUG MM_CHARSET
 
 output_md5()
 {
@@ -68,7 +72,7 @@ findprog()
 
 require_prog ()
 {
-  if [ -z `findprog $1` ]; then
+  if [ -z "`findprog $1`" ]; then
     test_skip "missing $1"
   fi
 }
@@ -133,7 +137,7 @@ setup_test ()
   MHMTSCONF=${MH_INST_DIR}${sysconfdir}/mts.conf
   PATH=${MH_INST_DIR}${bindir}:${PATH}
   MH_LIB_DIR=${MH_INST_DIR}${auxexecdir}
-  export MH MHMTSCONF MH_LIB_DIR
+  export MH MHMTSCONF MH_LIB_DIR PATH
 
   #
   # Only install once
@@ -141,16 +145,26 @@ setup_test ()
   if [ -d ${MH_INST_DIR}${bindir} ]; then
     :
   else
-    (cd ${MH_OBJ_DIR} && make DESTDIR=${MH_INST_DIR} install) || exit 1
+    (cd ${MH_OBJ_DIR} && make DESTDIR=${MH_INST_DIR} SETGID_MAIL= install) ||
+      exit 1
+
+    #### Don't test with sendmail because it would really send the
+    #### mail.  If configured to use sendmail, change to smtp instead
+    #### so that we use fakesmtp.
+    sed -e 's/mts: *sendmail/mts: smtp/' ${MHMTSCONF} >${MHMTSCONF}.new
+    mv -f ${MHMTSCONF}.new ${MHMTSCONF}
   fi
 
   # clean old test data
-  trap "rm -rf $MH_TEST_DIR/Mail; exit \$status" 0
+  trap "rm -rf $MH_TEST_DIR/Mail" 0
   # setup test data
   mkdir $MH_TEST_DIR/Mail || exit 1
   cat > $MH <<EOF || exit 1
 Path: ${MH_TEST_DIR}/Mail
+buildmimeproc: ${MH_INST_DIR}${bindir}/mhbuild
+libdir: ${MH_LIB_DIR}
 mhlproc: ${MH_LIB_DIR}/mhl
+moreproc: cat
 showproc: ${MH_LIB_DIR}/mhl
 postproc: ${MH_LIB_DIR}/post
 fileproc: ${MH_INST_DIR}${bindir}/refile