1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
#!/bin/sh
# $Id: test2.rc,v 1.7 1999/04/05 14:27:44 src Exp $
#
# simple test script for INN mode
# assumes that test1.rc has been run
#
# BUG: much work needs to be done here
#
# $Log: test2.rc,v $
# Revision 1.7 1999/04/05 14:27:44 src
# Updated tests
#
# Revision 1.6 1998/09/09 07:32:18 src
# Version 1.1
#
# Revision 1.5 1998/07/12 09:39:33 src
# newsx version 1.0
#
. ./test0.rc
#######################################################################
# INN mode:
# do the check without a socket connection
#
echo "INN check.."
(
echo "#"
echo "ME:comp.*::"
echo "${HOST}/${HOST}:!comp.sources.*,\\"
echo "comp.sources.unix,*.humor.*\\"
echo " :Tf,Wfb:"
) > ${CONTROL}/newsfeeds
rm ${INHOSTS}/${HOST}
# fake ctlinnd
(
echo "#!/bin/sh"
echo "echo ctlinnd: \$0 \$1 \$2 \$3 \$4 \$5 \$6 > check.ctldone"
echo "exit 0"
) > check.ctlinnd
chmod +x check.ctlinnd
rm -f check.ctldone check.log
# outgoing batch
# BUG: format is slightly different...
rm ${BATCH}/${HOST}/*
rmdir ${BATCH}/${HOST}
(
echo "${NEWSPATH}/1"
echo "${NEWSPATH}/2"
) > ${BATCH}/${HOST}
(
echo "${NEWSPATH}/3"
) > ${BATCH}/${HOST}.togo
(
echo "${NEWSPATH}/4"
) > ${BATCH}/${HOST}.retry
if ! ${NEWSX} -i --debug 5 -n \
--home ${CONTROL} --spool ${SPOOL} --batch ${BATCH} --incoming ${INCOMING} \
--active ${ACTIVE} --locks ${LOCKS} --inhosts ${INHOSTS} --stat check.stat \
--newsfeeds ${CONTROL}/newsfeeds --ctlinnd ./check.ctlinnd \
-f check.folder -l check.log ${HOST} > check.stdout2a 2> check.stderr2a ; then
echo "newsx failed"
exit 1
fi
if [ `wc <check.stdout2a -l` -ne 0 ] ; then
echo "Output on stdout"
exit 1
fi
sed < check.folder > check.tmp2 "s/^From .*/FromX/g"
cat check.correct check.correct >check.tmp3
if ! diff check.tmp2 check.tmp3 ; then
echo "Bad check.folder [check.tmp2], should be same as check.correct [check.tmp3]"
exit 1
fi
if [ `wc <check.ctldone -l` -ne 1 ] ; then
echo "Did not execute ctlinnd correctly"
exit 1
fi
if [ `wc <check.log -l` -ne 4 ] ; then
echo "Bad log file size"
exit 1
fi
log=`printf "${HOST}\t<${ID}>\t${NEWSPATH}/1\t${FROM}\tTEST"`
if ! grep -q "${log}" check.log ; then
echo "Bad log file entry"
exit 1
fi
if ! grep -q "server: ${HOST}, spool: ${HOST}" check.stderr2a ; then
echo "Line 1 missing"
exit 1
fi
# created lock: /usr/lib/news/LOCK.localhost
if ! grep -q "created lock: ${CONTROL}/LOCK.${HOST}" check.stderr2a ; then
echo "Line 2 missing"
exit 1
fi
if ! diff ${INHOSTS}/${HOST} check.correct2 ; then
echo "Bad article list, should be same as check.correct2"
exit 1
fi
echo "INN mode OK"
exit 0
|