From: David Levine Date: Wed, 26 Dec 2012 17:04:23 +0000 (-0600) Subject: Fixed test-slocal to work with mmdfldir set to /dev/null, and on X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/b3ddd4955956689eebef0015f5a615c3942e2ec3?hp=-c Fixed test-slocal to work with mmdfldir set to /dev/null, and on Cygwin, which needs the full path to tee(1). --- b3ddd4955956689eebef0015f5a615c3942e2ec3 diff --git a/test/common.sh.in b/test/common.sh.in index dd68f774..d0a4586c 100644 --- a/test/common.sh.in +++ b/test/common.sh.in @@ -171,6 +171,8 @@ setup_test () -e "s%mmdfldir: *.*%mmdfldir: ${MH_TEST_DIR}/Mail%" \ -e 's%mmdflfil: *.*%mmdflfil: maildrop%' \ "${MHMTSCONF}" >"${MHMTSCONF}.new" + #### test-slocal needs to look at the original mts.conf, so save it. + mv -f "${MHMTSCONF}" "${MHMTSCONF}.old" mv -f "${MHMTSCONF}.new" "${MHMTSCONF}" fi diff --git a/test/slocal/test-slocal b/test/slocal/test-slocal index eafe3139..40e3ee32 100755 --- a/test/slocal/test-slocal +++ b/test/slocal/test-slocal @@ -58,67 +58,79 @@ run_test "$slocal -nonexistent" 'slocal: -nonexistent unknown' # check non-switch argument run_test "$slocal nonexistent" 'slocal: only switch arguments are supported' +# If no mail spool, explicitly specify the mailbox. +if grep 'mmdfldir:.*/dev/null' ${MHMTSCONF}.old >/dev/null; then + mbox="-mailbox ${MH_TEST_DIR}/Mail/mbox" +else + mbox= +fi + +#### Need to specify full path to tee on Cygwin. +[ -x /usr/bin/tee ] && tee=/usr/bin/tee || tee=tee + # check basic operation # Can't use rcvstore because slocal wipes out the environment. # So, it would put the message in the user's inbox, not the # test inbox. slocal also freopens stdout and stderr to # /dev/null, so we can't view them to verify simulated delivery. cat >$md <"$actual2" 2>&1 +$slocal -debug -maildelivery $md $mbox <"$MH_TEST_DIR"/Mail/inbox/1 \ + >"$actual2" 2>&1 run_test "grep ^retrieving $actual2" 'retrieving message from stdin' # check -verbose -$slocal -verbose -maildelivery $md <"$MH_TEST_DIR"/Mail/inbox/1 >"$actual2" 2>&1 -run_test "grep ^delivering $actual2" 'delivering to pipe "tee", success.' +$slocal -verbose -maildelivery $md $mbox <"$MH_TEST_DIR"/Mail/inbox/1 \ + >"$actual2" 2>&1 +run_test "grep ^delivering $actual2" "delivering to pipe \"$tee\", success." # check -noverbose -$slocal -verbose -noverbose -maildelivery $md <"$MH_TEST_DIR"/Mail/inbox/1 \ - >"$actual2" 2>&1 +$slocal -verbose -noverbose -maildelivery $md $mbox \ + <"$MH_TEST_DIR"/Mail/inbox/1 >"$actual2" 2>&1 run_test "grep ^delivering $actual2" '' rm -f "$actual2" # check match of From cat >$md <$md <$md <$md <$md <$md <$md <$md <$md <