diff test.bash @ 1:45c8592d5d13

initial version
author carl
date Fri, 10 Mar 2006 10:35:25 -0800
parents
children 75e1a9bcbc2e
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test.bash	Fri Mar 10 10:35:25 2006 -0800
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+############################
+## compile and run the test program
+##
+#g++ -c test.cpp
+#if [ $? -ne 0 ]; then
+#    echo "compiler errors"
+#    exit
+#fi
+#g++ -o test test.o -pthread
+#if [ $? -ne 0 ]; then
+#    echo "linker errors"
+#    exit
+#fi
+
+
+###########################
+# compile the milter
+#
+
+if [ "$1" == "build" ]; then
+    rm -f dnsbl.o scanner.o context.o tokenizer.o
+    g++ -c -pthread dnsbl.cpp scanner.cpp context.cpp tokenizer.cpp
+    if [ $? -ne 0 ]; then
+        echo "compiler errors"
+        exit
+    fi
+    g++ -o dnsbl dnsbl.o scanner.o context.o tokenizer.o /usr/lib/libresolv.a -lmilter -pthread
+    if [ $? -ne 0 ]; then
+        echo "linker errors"
+        exit
+    fi
+fi
+
+if [ "$1" == "test" ]; then
+    # build the test.cf file
+    make -f Makefile.test test.cf
+
+    # start the milter
+    pid=/var/run/dnsbl.pid
+    echo start the milter
+    mkdir -p /var/run/dnsbl
+    chmod 700 /var/run/dnsbl
+    chown dnsbl:dnsbl /var/run/dnsbl
+    mv -f $pid $pid.save
+    ./dnsbl -d 10 -r /var/run/dnsbl/dnsbl.resolver.sock2 -p local:/var/run/dnsbl/dnsbl.sock2
+    sleep 5
+    P2=`cat $pid`
+    mv -f $pid.save $pid
+    echo started dnsbl milter as process $P2
+
+    /usr/lib/sendmail -bd -Ctest.cf -Ldnsbl
+    sleep 5
+    P3=`head -1 /var/run/sm-test.pid`
+    echo started sendmail as process $P3
+
+    echo eventually "'"kill -KILL $P2 $P3"'"
+
+fi