annotate test.bash @ 4:311e331f1bab

initial version
author carl
date Fri, 10 Mar 2006 11:52:38 -0800
parents 45c8592d5d13
children 75e1a9bcbc2e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
45c8592d5d13 initial version
carl
parents:
diff changeset
1 #!/bin/bash
45c8592d5d13 initial version
carl
parents:
diff changeset
2
45c8592d5d13 initial version
carl
parents:
diff changeset
3 ############################
45c8592d5d13 initial version
carl
parents:
diff changeset
4 ## compile and run the test program
45c8592d5d13 initial version
carl
parents:
diff changeset
5 ##
45c8592d5d13 initial version
carl
parents:
diff changeset
6 #g++ -c test.cpp
45c8592d5d13 initial version
carl
parents:
diff changeset
7 #if [ $? -ne 0 ]; then
45c8592d5d13 initial version
carl
parents:
diff changeset
8 # echo "compiler errors"
45c8592d5d13 initial version
carl
parents:
diff changeset
9 # exit
45c8592d5d13 initial version
carl
parents:
diff changeset
10 #fi
45c8592d5d13 initial version
carl
parents:
diff changeset
11 #g++ -o test test.o -pthread
45c8592d5d13 initial version
carl
parents:
diff changeset
12 #if [ $? -ne 0 ]; then
45c8592d5d13 initial version
carl
parents:
diff changeset
13 # echo "linker errors"
45c8592d5d13 initial version
carl
parents:
diff changeset
14 # exit
45c8592d5d13 initial version
carl
parents:
diff changeset
15 #fi
45c8592d5d13 initial version
carl
parents:
diff changeset
16
45c8592d5d13 initial version
carl
parents:
diff changeset
17
45c8592d5d13 initial version
carl
parents:
diff changeset
18 ###########################
45c8592d5d13 initial version
carl
parents:
diff changeset
19 # compile the milter
45c8592d5d13 initial version
carl
parents:
diff changeset
20 #
45c8592d5d13 initial version
carl
parents:
diff changeset
21
45c8592d5d13 initial version
carl
parents:
diff changeset
22 if [ "$1" == "build" ]; then
45c8592d5d13 initial version
carl
parents:
diff changeset
23 rm -f dnsbl.o scanner.o context.o tokenizer.o
45c8592d5d13 initial version
carl
parents:
diff changeset
24 g++ -c -pthread dnsbl.cpp scanner.cpp context.cpp tokenizer.cpp
45c8592d5d13 initial version
carl
parents:
diff changeset
25 if [ $? -ne 0 ]; then
45c8592d5d13 initial version
carl
parents:
diff changeset
26 echo "compiler errors"
45c8592d5d13 initial version
carl
parents:
diff changeset
27 exit
45c8592d5d13 initial version
carl
parents:
diff changeset
28 fi
45c8592d5d13 initial version
carl
parents:
diff changeset
29 g++ -o dnsbl dnsbl.o scanner.o context.o tokenizer.o /usr/lib/libresolv.a -lmilter -pthread
45c8592d5d13 initial version
carl
parents:
diff changeset
30 if [ $? -ne 0 ]; then
45c8592d5d13 initial version
carl
parents:
diff changeset
31 echo "linker errors"
45c8592d5d13 initial version
carl
parents:
diff changeset
32 exit
45c8592d5d13 initial version
carl
parents:
diff changeset
33 fi
45c8592d5d13 initial version
carl
parents:
diff changeset
34 fi
45c8592d5d13 initial version
carl
parents:
diff changeset
35
45c8592d5d13 initial version
carl
parents:
diff changeset
36 if [ "$1" == "test" ]; then
45c8592d5d13 initial version
carl
parents:
diff changeset
37 # build the test.cf file
45c8592d5d13 initial version
carl
parents:
diff changeset
38 make -f Makefile.test test.cf
45c8592d5d13 initial version
carl
parents:
diff changeset
39
45c8592d5d13 initial version
carl
parents:
diff changeset
40 # start the milter
45c8592d5d13 initial version
carl
parents:
diff changeset
41 pid=/var/run/dnsbl.pid
45c8592d5d13 initial version
carl
parents:
diff changeset
42 echo start the milter
45c8592d5d13 initial version
carl
parents:
diff changeset
43 mkdir -p /var/run/dnsbl
45c8592d5d13 initial version
carl
parents:
diff changeset
44 chmod 700 /var/run/dnsbl
45c8592d5d13 initial version
carl
parents:
diff changeset
45 chown dnsbl:dnsbl /var/run/dnsbl
45c8592d5d13 initial version
carl
parents:
diff changeset
46 mv -f $pid $pid.save
45c8592d5d13 initial version
carl
parents:
diff changeset
47 ./dnsbl -d 10 -r /var/run/dnsbl/dnsbl.resolver.sock2 -p local:/var/run/dnsbl/dnsbl.sock2
45c8592d5d13 initial version
carl
parents:
diff changeset
48 sleep 5
45c8592d5d13 initial version
carl
parents:
diff changeset
49 P2=`cat $pid`
45c8592d5d13 initial version
carl
parents:
diff changeset
50 mv -f $pid.save $pid
45c8592d5d13 initial version
carl
parents:
diff changeset
51 echo started dnsbl milter as process $P2
45c8592d5d13 initial version
carl
parents:
diff changeset
52
45c8592d5d13 initial version
carl
parents:
diff changeset
53 /usr/lib/sendmail -bd -Ctest.cf -Ldnsbl
45c8592d5d13 initial version
carl
parents:
diff changeset
54 sleep 5
45c8592d5d13 initial version
carl
parents:
diff changeset
55 P3=`head -1 /var/run/sm-test.pid`
45c8592d5d13 initial version
carl
parents:
diff changeset
56 echo started sendmail as process $P3
45c8592d5d13 initial version
carl
parents:
diff changeset
57
45c8592d5d13 initial version
carl
parents:
diff changeset
58 echo eventually "'"kill -KILL $P2 $P3"'"
45c8592d5d13 initial version
carl
parents:
diff changeset
59
45c8592d5d13 initial version
carl
parents:
diff changeset
60 fi