OSSP CVS Repository

ossp - Difference in ossp-pkg/lmtp2nntp/test/run.sh versions 1.15 and 1.16
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/lmtp2nntp/test/run.sh 1.15 -> 1.16

--- 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 </tmp/testmessage -l $LOG:$FILE -w 1 -d post -g arg -b $LOCAL -h $HOST $GROUP >/dev/null; echo $?
-../lmtp2nntp </tmp/testmessage -l $LOG:$FILE -w 1 -d 250/2.0.0 -g arg -b $LOCAL -h $HOST $GROUP >/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 </tmp/testmessage -V nase123baer posting+$GROUP@$LOCAL
+# sendmail -i <$STDIN -V nase123baer posting+$GROUP@$LOCAL
 
 after
 exit 0

CVSTrac 2.0.1