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