#!/bin/sh
# $Id: t-da-tmo-0.sh,v 1.3 2007/01/10 23:29:20 ca Exp $
#
# ----------------------------------------
# test DA timeout
# run smtp1.sh with different parameters
# ----------------------------------------
#
test -s stop && exit 1
#
if test X"${MTA_NO_SLOW_TEST}" != "X"
then
echo "SKIPPED: $0: MTA_NO_SLOW_TEST is set"
exit 0
fi
SD=`dirname $0`
if test "${SD}" = "."
then
SD=../chkmts
fi
. ${SD}/common.sh
I=""
ERRS=0
OK="t-da-tmo-0.ok"
OUT="t-da-tmo-0.out"
TMP="t-da-tmo-0.tmp"
EDBROK="t-da-tmo-0.edbr"
if test X"`uname`" != "XOSF1"
then
while getopts s:V FLAG
do
case "${FLAG}" in
s) SKIP="${SKIP} ${OPTARG}";;
V) VERBOSE=true;;
esac
done
shift `expr ${OPTIND} - 1`
fi
# cd to working directory for alias file!
cd ../qmgr || exit 1
# create aliases
${CAT} > ${ALI} <<EOF
abuse: local:
postmaster: local:
user: local:
sender: local:
EOF
# create map
rm -f ${ALIMAP}
${MM} < ${ALI}
rm -f ${MTMAP}
# run some test programs
# ----------------------------------------
# cause a DA timeout by accepting the mail very slowly
TEST=1
if echo "${SKIP} X" | ${GREP} -v " ${TEST} " > /dev/null
then
ERR=false
${CAT} > ${EDBROK} <<EOF
got transaction
mail=<sender@local.dom>
rcpts_tot=1
rcpts_left=1
rcpts_temp=1
rcpts_perm=0
state=491
aqt_rcpts_ar=0
got recipient
rcpt=<delay@local.host>
aqr_rcpt_idx=0
aqr_da_idx=0
aqr_status=491
EOF
if ${SHELL} ${SD}/smtp1.sh -O ${EDBROK} -3 lmtpsock -Ssender@local.dom -Rdelay@local.host -Q '-T d=10' -s 50 -X 0 -A 1 -Y '-W 5'
then
if ${GREP} 'sev=WARN, func=qm_fr_sc_react, stat=cannot_update' ${QML} >/dev/null
then
:
else
${VERBOSE} && echo "$0: test ${TEST}: missing qm_fr_sc_react WARNing"
ERR=true
fi
else
ERR=true
fi
if ${ERR}
then
echo "$0: test ${TEST} failed"
ERRS=`expr ${ERRS} + 1 `
test X"${MTA_STOPONERROR}" != X && exit 1
fi
fi
# ----------------------------------------
# end
if test "${ERRS}" = "0"
then
rm -f ${EDBROK}
exit 0
else
echo "${ERRS} error(s)"
exit 1
fi
syntax highlighted by Code2HTML, v. 0.9.1