Index: ossp-pkg/lmtp2nntp/test/.cvsignore RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/test/Attic/.cvsignore,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/test/Attic/.cvsignore,v' 2>/dev/null --- .cvsignore 2001/09/07 13:53:17 1.2 +++ .cvsignore 2001/09/12 14:23:06 1.3 @@ -1,2 +1,6 @@ dmalloc.log logfile +stdin +stdout +stderr +stdlog Index: ossp-pkg/lmtp2nntp/test/run.sh RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/test/Attic/run.sh,v rcsdiff -q -kk '-r1.15' '-r1.16' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/test/Attic/run.sh,v' 2>/dev/null --- run.sh 2001/09/12 06:52:26 1.15 +++ run.sh 2001/09/12 14:23:06 1.16 @@ -16,7 +16,7 @@ do echo -n $h$z$e newmsg sendmail - cat /tmp/testmessage \ + cat $STDIN \ | sendmail -i posting+$h$z$e@dev12.dev.de.cw.net done done @@ -26,7 +26,7 @@ lmtp() { newmsg lmtp - cat /tmp/testmessage \ + cat $STDIN \ | ../lmtp2nntp -l $1:$FILE -w 1 -d $2 -g $2 -b dev12 -h dev16,141.1.23.116:nntp -h dev16.de.cw.net:119 $3 >/dev/null; echo $? #| ../lmtp2nntp -l $1:$FILE -w 1 -d 255/2.5.5 -g $3 -b 127.0.0.1 $4 >/dev/null; echo $? #| ../lmtp2nntp -l $1:$FILE -w 1 -d $2 -g $3 -b 127.0.0.1 -h 127.0.0.2 $4 >/dev/null; echo $? @@ -35,9 +35,9 @@ sendmaildup() { newmsg sendmail - cat /tmp/testmessage \ + cat $STDIN \ | sendmail -i posting+cw.de.sd.apps.dev.test@dev12.dev.de.cw.net - cat /tmp/testmessage \ + cat $STDIN \ | sendmail -i posting+cw.de.sd.apps.dev.test@dev12.dev.de.cw.net } @@ -55,41 +55,30 @@ /^Message-ID:/ { gotit = 1; print "Message-Id: <" date "-" id "@dev12.dev.de.cw.net>" } /^Subject:/ { gotit = 1; print "Subject: [" pid "] " $2 } { if (gotit == 0) { print }; gotit = 0 } - ' | tee /tmp/testmessage + ' | tee 2>&1 >/dev/null $STDIN else echo "ERROR: file testmessage.via$1 not readable!" exit 1 fi - echo ----------------------------------------------------------- } -before () +prolog () { - set -v -x h="H" z="Z" e="E" - if [ -e $FILE ]; then - rm -f $FILE - fi - touch $FILE - chmod 666 $FILE - - if [ -e /tmp/testmessage ]; then - rm -f /tmp/testmessage - fi - touch /tmp/testmessage - chmod 666 /tmp/testmessage - - if [ -e dmalloc.log ]; then - rm -f dmalloc.log - fi - touch dmalloc.log - chmod 666 dmalloc.log + for i in $FILE $STDIN $STDOUT $STDERR dmalloc.log + do + if [ -e $i ]; then + rm -f $i + fi + touch $i + chmod 666 $i + done } -after () +epilog () { if [ -r $FILE ] then @@ -104,8 +93,6 @@ fi } -# lmtp notice post arg cw.de.sd.apps.dev.test -# newmsg sendmail; ls -l /tmp/testmessage && cat /tmp/testmessage # lmtp feed arg # lmtp post envelope '*.test.* cw.*.dev.*' # lmtp post header '*.test.* cw.*.dev.* *foo*' @@ -114,20 +101,79 @@ # sendmaildup # post1000 - LOG="notice" - FILE="/tmp/tracing" -GROUP="cw.de.sd.apps.dev.test" -LOCAL="0.0.0.0" -HOST="dev16,141.1.23.116:nntp -h dev16.de.cw.net:119" -HOST="0.0.0.0" -before + LOG="trace" + FILE="stdlog" + STDIN="stdin" +STDOUT="stdout" +STDERR="stderr" + LOCAL="0.0.0.0" + HOST="0.0.0.0" + GROUP="my.test" +MFILT=".+@(?:[^.]+\.)*cw\.com" + NODE="gateway" + +# make check with automatic succeed/ fail message. +# more samples and testing below. +newmsg lmtp + +# check -v option prints out version, typical output: lmtp2nntp 0.9.4 +# (30-Aug-2001) +prolog +../lmtp2nntp -v >$STDOUT 2>$STDERR +RC=`cat $STDOUT | egrep 'lmtp2nntp[ ]+[0-9]+\.[0-9]\.[0-9][ ]+\([0-9]+-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-[0-9]{4}\)' | wc -l` +if [ $RC -ne 1 -o -s $STDERR ]; then + echo "CHECK ERROR: version test failed $RC" + exit 1; +fi +echo "CHECK version test succeeded" + +# check -? option prints out usage, typical output: USAGE: ../lmtp2nntp +# lmtp2nntp [-b bindaddr[:port]] [-d deliverymode] [-g groupmode] [-h +# host[:port][,host[:port], ...]] [-m mailfrom] [-n nodename] [-s size] [-l +# level[:logfile]] [-v] [-w waittime] newsgroup [newsgroup ...] +prolog +../lmtp2nntp -? >$STDOUT 2>$STDERR +RC=`cat $STDERR | egrep -- '-b.*-d.*-g.*-h.*-m.*-n.*-s.*-l.*-v.*-w.*newsgroup' | wc -l` +if [ $RC -ne 1 -o -s $STDOUT ]; then + echo "CHECK ERROR: usage test failed" + exit 1; +fi +echo "CHECK usage test succeeded" + +# check dummy posting +#set -v -x +prolog +newmsg lmtp +../lmtp2nntp <$STDIN -b $LOCAL -d 250/2.0.0 -g arg -h $HOST -l $LOG:$FILE -m "$MFILT" -n $NODE -s 1000 -w 1 $GROUP >$STDOUT 2>$STDERR ; RC=$ +set +v +x +RC=""; +if [ 1 -eq `cat $STDOUT | egrep '^220[ ]+LMTP Service ready' | wc -l` ]; then RC="${RC}LHLO "; fi +if [ 1 -eq `cat $STDOUT | egrep '^250 2.1.0 Sender ok' | wc -l` ]; then RC="${RC}MAIL "; fi +if [ 3 -eq `cat $STDOUT | egrep '^250 2.1.5 Recipient accepted' | wc -l` ]; then RC="${RC}RCPT "; fi +if [ 1 -eq `cat $STDOUT | egrep '^354 Enter mail' | wc -l` ]; then RC="${RC}DATA "; fi +if [ 3 -eq `cat $STDOUT | egrep '^250-2.0.0 NNTP noop fake' | wc -l` ]; then RC="${RC}post "; fi +if [ 1 -eq `cat $STDOUT | egrep '^221 2.0.0.+closing.+channel' | wc -l` ]; then RC="${RC}QUIT "; fi +if [ "$RC" != "LHLO MAIL RCPT DATA post QUIT " ]; then + echo "CHECK ERROR: fake post test failed" + exit 1; +fi +echo "CHECK fake post test succeeded" + +echo "CHECK COMPLETE AND PASSED" +exit 0 +# +# BELOW ARE INTERAL TESTS. CONSIDER THEM AS EXAMPLE. +# + HOST="dev16,141.1.23.116:nntp -h dev16.de.cw.net:119" + GROUP="cw.de.sd.apps.dev.test" newmsg lmtp -#./lmtp2nntp /dev/null; echo $? -../lmtp2nntp /dev/null; echo $? +../lmtp2nntp <$STDIN -b $LOCAL -d post -g arg -h $HOST -l $LOG:$FILE -m "$MFILT" -n $NODE -s 1000 -w 1 $GROUP >$STDOUT 2>$STDERR ; RC=$ +#./lmtp2nntp <$STDIN -b $LOCAL -d 250/2.0.0 -g arg -h $HOST -l $LOG:$FILE -m "$MFILT" -n $NODE -s 1000 -w 1 $GROUP >$STDOUT 2>$STDERR ; RC=$ +/dev/null; echo $? #newmsg sendmail -# sendmail -i /dev/null --- testmessage.foldlinesvialmtp 2001/08/28 14:27:35 1.1 +++ testmessage.foldlinesvialmtp 2001/09/12 14:23:06 1.2 @@ -1,12 +1,12 @@ LHLO dev.de.cw.net -MAIL From: +MAIL From: RCPT To: RCPT To: RCPT To: DATA Date: Tue, 26 Aug 2001 14:51:48 +0200 (CEST) Message-Id: <200108141251.f7ECpmn74812@dev.de.cw.net> -From: Thomas Lotterer +From: Thomas Lotterer X-Wraptest1: 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 X-Wraptest2: 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 X-Wraptest3: the quick brown fox jumps over the lazy dog. THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG. the quick brown fox jumps over the lazy dog. THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG. the quick brown fox jumps over the lazy dog. THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG. the quick brown fox jumps over the lazy dog. THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG. the quick brown fox jumps over the lazy dog. THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG. the quick brown fox jumps over the lazy dog. THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG. the quick brown fox jumps over the lazy dog. THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG! Index: ossp-pkg/lmtp2nntp/test/testmessage.vialmtp RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/test/Attic/testmessage.vialmtp,v rcsdiff -q -kk '-r1.6' '-r1.7' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/test/Attic/testmessage.vialmtp,v' 2>/dev/null --- testmessage.vialmtp 2001/09/11 13:41:22 1.6 +++ testmessage.vialmtp 2001/09/12 14:23:06 1.7 @@ -1,20 +1,20 @@ LHLO dev.de.cw.net -MAIL From: +MAIL From: RCPT To: RCPT To: RCPT To: DATA -Date: Tue, 6 Sep 2001 14:51:48 +0200 (CEST) +Date: Tue, 26 Aug 2001 14:51:48 +0200 (CEST) Message-Id: <200108141251.f7ECpmn74812@dev.de.cw.net> -From: Thomas Lotterer -Received: from augias.ecrc.de (augias.ecrc.de [141.1.1.32]) - by ns1.ecrc.de (8.9.2/8.9.2/$Revision$) with SMTP id NAA08840 - for ; Mon, 2 Apr 2001 13:20:25 +0200 (MET DST) -Received: from clhq029 (clhq029.computerlinks.de [195.143.102.41]) - by augias.ecrc.de (8.11.0/8.11.0/$Revision$) with ESMTP id f32BKPb12235 +From: Thomas Lotterer +Received: from cw.example.com (cw.example.com [10.1.1.32]) + by gateway.example.com (8.9.2/8.9.2/$Revision$) with SMTP id NAA08840 + for ; Mon, 2 Apr 2001 13:20:25 +0200 (MET DST) +Received: from history (history.example.org [195.143.102.41]) + by cw.example.com (8.11.0/8.11.0/$Revision$) with ESMTP id f32BKPb12235 for ; Mon, 2 Apr 2001 13:20:25 +0200 -Received: from computerlinks.de (nwrulez.computerlinks.de [195.143.103.160]) - by clhq029 (8.8.8/8.8.8) with ESMTP id LAA12678; +Received: from example.org (littlemua.example.org [195.143.103.160]) + by history (8.8.8/8.8.8) with ESMTP id LAA12678; Mon, 2 Apr 2001 11:23:14 GMT Subject: lmtp2nntp testmessage.viasendmail Index: ossp-pkg/lmtp2nntp/test/testmessage.viasendmail RCS File: /v/ossp/cvs/ossp-pkg/lmtp2nntp/test/Attic/testmessage.viasendmail,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/lmtp2nntp/test/Attic/testmessage.viasendmail,v' 2>/dev/null --- testmessage.viasendmail 2001/08/16 15:00:51 1.2 +++ testmessage.viasendmail 2001/09/12 14:23:06 1.3 @@ -1,4 +1,4 @@ -From: Thomas Lotterer +From: Thomas Lotterer Subject: lmtp2nntp testmessage.viasendmail Message-ID: Newsgroups: cw.de.sd.apps.dev.test