Преглед изворни кода

- add common method to kill the server, use signal 15 instead
of signal 9 to get a proper shutdown


git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4959 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt пре 17 година
родитељ
комит
f2748882d7

+ 1 - 1
test/unit/1.sh

@@ -30,7 +30,7 @@ echo -e "debug=3" > $CFG
 ret=$?
 
 sleep 1
-killall -9 $BIN
+$KILL
 
 rm -f $CFG
 

+ 1 - 1
test/unit/11.sh

@@ -73,7 +73,7 @@ ret=`mysql -B -u openserro --password=openserro openser -e "select COUNT(*) from
 
 cd ../test
 
-killall -9 $BIN
+$KILL
 
 mv $CFG.bak $CFG
 

+ 1 - 1
test/unit/12.sh

@@ -88,7 +88,7 @@ fi ;
 
 cd ../test
 
-killall -9 $BIN
+$KILL
 rm $TMPFILE
 
 exit $ret

+ 1 - 1
test/unit/13.sh

@@ -104,7 +104,7 @@ Printing tree for domain 0
 	fi ;
 fi ;
 
-killall -9 $BIN
+$KILL
 
 # cleanup database
 $MYSQL "delete from route_tree where id = 1;"

+ 1 - 1
test/unit/14.sh

@@ -76,7 +76,7 @@ Printing tree for domain other
 	fi ;
 fi ;
 
-killall -9 $BIN
+$KILL
 
 cd ../test
 

+ 1 - 1
test/unit/15.sh

@@ -36,7 +36,7 @@ echo "modparam(\"$DB_ALL_MOD\", \"db_url\", \"text://`pwd`/../scripts/dbtext/kam
 ret=$?
 
 sleep 1
-killall -9 $BIN
+$KILL
 
 rm $CFG
 

+ 1 - 1
test/unit/16.sh

@@ -39,7 +39,7 @@ echo "modparam(\"$DB_ALL_MOD\", \"db_url\", \"postgres://openserro:openserro@loc
 ret=$?
 
 sleep 1
-killall -9 $BIN
+$KILL
 
 mv $CFG.bak $CFG
 rm -f dispatcher.list

+ 1 - 1
test/unit/17.sh

@@ -54,7 +54,7 @@ if [ "$ret" -eq 0 ] ; then
 fi ;
 
 sleep 1
-killall -9 $BIN
+$KILL
 
 # cleanup
 ./$DBCTL drop $tmp_name > /dev/null

+ 1 - 4
test/unit/18.sh

@@ -41,10 +41,7 @@ ret=$?
 sleep 1
 
 # clean up:
-killall -9 $BIN
+$KILL
 
 rm $CFG
-rm pgid.out
-rm pid.out
-
 exit $ret

+ 1 - 1
test/unit/19.sh

@@ -44,7 +44,7 @@ ret=$?
 
 # cleanup
 killall -9 sipp > /dev/null 2>&1
-killall -9 $BIN > /dev/null 2>&1
+$KILL > /dev/null 2>&1
 
 $MYSQL "DELETE FROM location WHERE ((contact = \"sip:foo@localhost:$UAS\") and (user_agent = \"ser_test\"));"
 exit $ret;

+ 1 - 1
test/unit/2.sh

@@ -43,7 +43,7 @@ echo "modparam(\"dispatcher\", \"list_file\", \"`pwd`/../test/dispatcher.list\")
 ret=$?
 
 sleep 1
-killall -9 $BIN
+$KILL
 
 mv $CFG.bak $CFG
 rm -f dispatcher.list

+ 1 - 1
test/unit/20.sh

@@ -44,7 +44,7 @@ ret=$?
 
 # cleanup
 killall -9 sipp &> /dev/null
-killall -9 $BIN &> /dev/null
+$KILL &> /dev/null
 rm $TMPFILE
 
 $MYSQL "DELETE FROM location WHERE ((contact = \"sip:foo@localhost\") and (user_agent = \"ser_test\"));"

+ 1 - 1
test/unit/21.sh

@@ -48,7 +48,7 @@ if [ "$ret" -eq 0 ] ; then
 fi;
 
 #cleanup
-killall -9 $BIN &> /dev/null;
+$KILL &> /dev/null;
 killall -9 sipp &> /dev/null;
 $MYSQL "DELETE FROM subscriber WHERE((username = \"alice\") and (domain = \"localhost\"));"
 

+ 1 - 1
test/unit/22.sh

@@ -67,7 +67,7 @@ fi ;
 
 ret=`$PSQL "select COUNT(*) from location where username='1000';" | tail -n 1`
 
-killall -9 $BIN
+$KILL
 
 cd ../test
 mv $CFG.tmp $CFG

+ 1 - 1
test/unit/23.sh

@@ -88,7 +88,7 @@ Printing tree for domain 0
 	fi ;
 fi ;
 
-killall -9 $BIN
+$KILL
 
 # cleanup database
 $PSQL "delete from route_tree where id = 1;

+ 1 - 1
test/unit/25.sh

@@ -111,7 +111,7 @@ fi;
 
 # cleanup:
 killall -9 sipp > /dev/null 2>&1
-killall -9 $BIN > /dev/null 2>&1
+$KILL > /dev/null 2>&1
 
 $MYSQL "delete from location where (user_agent = \"ser_test\");"
 $MYSQL "delete from userblacklist where username='49721123456786';"

+ 1 - 1
test/unit/26.sh

@@ -117,7 +117,7 @@ if [ ! "$ret" -eq 0 ] ; then
 fi;
 
 
-killall -9 $BIN
+$KILL
 killall -9 sipp
 
 # cleanup database

+ 1 - 1
test/unit/27.sh

@@ -48,7 +48,7 @@ fi;
 
 
 #cleanup:
-killall -9 $BIN &> /dev/null;
+$KILL &> /dev/null;
 killall -9 sipp &> /dev/null;
 
 exit $ret;

+ 1 - 1
test/unit/28.sh

@@ -62,7 +62,7 @@ if [ ! "$ret" -eq 0 ] ; then
 fi;
 
 #cleanup:
-killall -9 $BIN &> /dev/null;
+$KILL &> /dev/null;
 killall -9 sipp &> /dev/null;
 rm $TMPFILE
 

+ 1 - 1
test/unit/29.sh

@@ -65,7 +65,7 @@ if [ ! "$ret" -eq 0 ] ; then
 fi;
 
 #cleanup:
-killall -9 $BIN &> /dev/null;
+$KILL &> /dev/null;
 killall -9 sipp &> /dev/null;
 rm $TMPFILE
 mv $CFG.tmp $CFG

+ 1 - 1
test/unit/30.sh

@@ -62,7 +62,7 @@ if [ "$ret" -eq 0 ] ; then
 	ret=$?
 fi;
 
-killall -9 $BIN
+$KILL
 killall -9 sipp
 
 cd ../test

+ 1 - 1
test/unit/31.sh

@@ -46,7 +46,7 @@ done
 ret=$?
 
 sleep 1
-killall -9 $BIN
+$KILL
 
 $MYSQL "delete from location where user_agent = '___test___'"
 

+ 1 - 1
test/unit/32.sh

@@ -47,7 +47,7 @@ done
 ret=$?
 
 sleep 1
-killall -9 $BIN
+$KILL
 
 $PSQL "delete from location where user_agent = '___test___'"
 

+ 1 - 1
test/unit/33.sh

@@ -57,7 +57,7 @@ if [ ! $ret -eq 0 ] ; then
 fi;
 
 sleep 1
-killall -9 $BIN &> /dev/null
+$KILL &> /dev/null
 ret=$?
 
 if [ $ret -eq 0 ] ; then

+ 1 - 1
test/unit/34.sh

@@ -47,7 +47,7 @@ echo "loadmodule \"db_mysql/db_mysql.so\"" >> $CFG
 ret=$?
 
 sleep 1
-killall -9 $BIN
+$KILL
 
 mv $CFG.bak $CFG
 

+ 1 - 1
test/unit/35.sh

@@ -64,7 +64,7 @@ fi;
 
 # cleanup
 killall -9 sipp > /dev/null 2>&1
-killall -9 $BIN > /dev/null 2>&1
+$KILL > /dev/null 2>&1
 
 $MYSQL "DELETE FROM location WHERE ((contact = \"sip:foo@localhost:$UAS\") and (user_agent = \"ser_test\"));"
 $MYSQL "DELETE FROM trusted WHERE (src_ip=\"127.0.0.1\");"

+ 1 - 1
test/unit/36.sh

@@ -62,7 +62,7 @@ if [ $ret -eq 0 ]; then
 fi;
 
 sleep 1
-killall -9 $BIN
+$KILL
 
 $MYSQL "delete from location where user_agent = '___test___'"
 

+ 1 - 1
test/unit/37.sh

@@ -77,7 +77,7 @@ if [ $ret -eq 0 ] ; then
 	fi;
 fi ;
 
-killall -9 $BIN
+$KILL
 
 # cleanup database
 $MYSQL "delete from route_tree where id = 1;"

+ 1 - 1
test/unit/38.sh

@@ -40,7 +40,7 @@ echo "modparam(\"$DB_ALL_MOD\", \"db_url\", \"unixodbc://openserro:openserro@loc
 ret=$?
 
 sleep 1
-killall -9 $BIN
+$KILL
 
 mv $CFG.bak $CFG
 rm -f dispatcher.list

+ 1 - 1
test/unit/4.sh

@@ -40,7 +40,7 @@ fi ;
 
 cd ../test
 
-killall -9 $BIN
+$KILL
 
 rm -f $CFG
 

+ 1 - 1
test/unit/5.sh

@@ -30,6 +30,6 @@ CFG=5.cfg
 ret=$?
 
 sleep 1
-killall -9 $BIN
+$KILL
 
 exit $ret

+ 1 - 1
test/unit/7.sh

@@ -32,6 +32,6 @@ CFG=7.cfg
 ret=$?
 
 sleep 1
-killall -9 $BIN
+$KILL
 
 exit $ret

+ 2 - 1
test/unit/include/common

@@ -2,4 +2,5 @@ DB_ALL_MOD="acc|alias_db|auth_db|avpops|dialog|dialplan|dispatcher|domain|domain
 CTLRC="kamctlrc"
 CTL="kamctl"
 DBCTL="kamdbctl"
-BIN="kamailio"
+BIN="kamailio"
+KILL="killall -15 kamailio"