comparison test.bash @ 13:75e1a9bcbc2e

gpl3, add removal option for original recipients
author carl
date Sat, 25 Aug 2007 11:14:49 -0700
parents 45c8592d5d13
children
comparison
equal deleted inserted replaced
12:bb3d2cd6007e 13:75e1a9bcbc2e
1 #!/bin/bash 1 #!/bin/bash
2 2
3 ############################ 3 # build the test.cf file
4 ## compile and run the test program 4 make -f Makefile.test test.cf
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 5
6 # start the milter
7 pid=/var/run/sm-archive.pid
8 echo start the milter
9 mkdir -p /var/run/smarchive
10 chmod 700 /var/run/smarchive
11 #chown smarchive:smarchive /var/run/smarchive
12 [ -f "$pid" ] && mv -f $pid $pid.save
13 valgrind --leak-check=full --show-reachable=yes src/smarchive -d 10 -p local:/var/run/smarchive/smarchive.sock
14 sleep 5
15 P2=`cat $pid`
16 [ -f "$pid.save" ] && mv -f $pid.save $pid
17 echo started smarchive milter as process $P2
17 18
18 ########################### 19 /usr/lib/sendmail -bd -Ctest.cf -Lsmarchive
19 # compile the milter 20 sleep 5
20 # 21 P3=`head -1 /var/run/sm-test.pid`
22 echo started sendmail as process $P3
21 23
22 if [ "$1" == "build" ]; then 24 echo "eventually, run the following two kill commands"
23 rm -f dnsbl.o scanner.o context.o tokenizer.o 25 echo kill -SIGINT $P2
24 g++ -c -pthread dnsbl.cpp scanner.cpp context.cpp tokenizer.cpp 26 echo kill -KILL $P3
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