diff --git a/test/unit/1.sh b/test/unit/1.sh index 35563923b0c..b8519032754 100755 --- a/test/unit/1.sh +++ b/test/unit/1.sh @@ -19,18 +19,18 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common +. include/common CFG=1.cfg # setup config -echo -e "debug=2\nrequest_route {\n ; \n}" > $CFG +printf "debug=2\nrequest_route {\n ; \n}" > $CFG -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? sleep 1 -$KILL +kill_kamailio rm -f $CFG diff --git a/test/unit/10.sh b/test/unit/10.sh index 47bbc9d4a22..fe50552aa63 100755 --- a/test/unit/10.sh +++ b/test/unit/10.sh @@ -19,7 +19,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common +. include/common cd $CTL_DIR diff --git a/test/unit/11.cfg b/test/unit/11.cfg index fc3bc39fba5..9f476f61c22 100644 --- a/test/unit/11.cfg +++ b/test/unit/11.cfg @@ -7,9 +7,6 @@ disable_tcp=yes alias=localhost -# ------------------ module loading ---------------------------------- -loadpath "../../modules/" - #!trydef DBMOD "db_mysql" loadmodule DBMOD diff --git a/test/unit/11.sh b/test/unit/11.sh index a220bc5c144..c029235f753 100755 --- a/test/unit/11.sh +++ b/test/unit/11.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh CFG=11.cfg @@ -31,7 +31,7 @@ fi ; SIPDOMAIN=127.0.0.1 -$BIN -w . -f $CFG -a no > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG -a no > /dev/null ret=$? sleep 1 @@ -155,10 +155,10 @@ if [ "$ret" -eq 0 ]; then ret=$? fi; -$KILL +kill_kamailio # restart to test preload_udomain functionality -$BIN -w . -f $CFG -a no> /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG -a no> /dev/null ret=$? sleep 1 @@ -178,6 +178,6 @@ fi; # cleanup $MYSQL "delete from location where username like '49721123456789%';" -$KILL +kill_kamailio exit $ret diff --git a/test/unit/12.cfg b/test/unit/12.cfg index 5a4b6d8222b..e593d95504b 100644 --- a/test/unit/12.cfg +++ b/test/unit/12.cfg @@ -1,8 +1,7 @@ log_stderror=yes listen=127.0.0.1 -loadpath "../../modules/" -loadmodule "../../modules/db_mysql/db_mysql.so" -loadmodule "../../modules/tm/tm.so" +loadmodule "db_mysql/db_mysql.so" +loadmodule "tm/tm.so" loadmodule "sl" loadmodule "rr" loadmodule "maxfwd" diff --git a/test/unit/12.sh b/test/unit/12.sh index b3438b844bd..78f808496cc 100755 --- a/test/unit/12.sh +++ b/test/unit/12.sh @@ -19,8 +19,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require +. include/common +. include/require.sh CFG=12.cfg TMPFILE=`mktemp -t kamailio-test.XXXXXXXXXX` @@ -29,7 +29,7 @@ if ! (check_netcat && check_kamailio); then exit 0 fi ; -$BIN -w . -f $CFG &> $TMPFILE +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG &> $TMPFILE ret=$? sleep 1 @@ -84,7 +84,7 @@ if [ "$ret" -eq 0 ] ; then fi ; fi ; cat $TMPFILE -$KILL +kill_kamailio rm $TMPFILE -exit $ret \ No newline at end of file +exit $ret diff --git a/test/unit/13.cfg b/test/unit/13.cfg index ae2a69c987b..e61d1252f1f 100644 --- a/test/unit/13.cfg +++ b/test/unit/13.cfg @@ -1,5 +1,4 @@ debug=2 -loadpath "../../modules/" loadmodule "db_mysql" loadmodule "corex" loadmodule "tm" diff --git a/test/unit/13.sh b/test/unit/13.sh index 25797a7ee1c..0d793b6e8c9 100755 --- a/test/unit/13.sh +++ b/test/unit/13.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh CFG=13.cfg @@ -61,7 +61,7 @@ mask, next_domain) values ('3', '2', '1', '49', 'host1.local', '503', '0', '0', $MYSQL "insert into carrierfailureroute(id, carrier, domain, scan_prefix, host_name, reply_code, flags, mask, next_domain) values ('4', '2', '2', '49', 'host1.local', '5..', '0', '0', '3');" -$BIN -w . -f $CFG -a no > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG -a no > /dev/null ret=$? @@ -105,7 +105,7 @@ Printing tree for domain 'domain1' (10) fi ; fi ; -$KILL +kill_kamailio # cleanup database $MYSQL "delete from carrier_name where id = 1;" diff --git a/test/unit/14.cfg b/test/unit/14.cfg index 98ed15a0afc..5f3dd1fbbcc 100644 --- a/test/unit/14.cfg +++ b/test/unit/14.cfg @@ -1,4 +1,3 @@ -loadpath "../../modules/" loadmodule "sl" loadmodule "xlog" loadmodule "maxfwd" diff --git a/test/unit/14.sh b/test/unit/14.sh index 91b90d7ab35..889215c63df 100755 --- a/test/unit/14.sh +++ b/test/unit/14.sh @@ -19,8 +19,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require +. include/common +. include/require.sh CFG=14.cfg @@ -30,7 +30,7 @@ fi ; cp $CFG $CFG.bak -$BIN -w . -f $CFG -a no > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG -a no > /dev/null ret=$? sleep 1 @@ -71,7 +71,7 @@ Printing tree for domain 'other' (3) fi ; fi ; -$KILL +kill_kamailio mv $CFG.bak $CFG rm -f $TMPFILE diff --git a/test/unit/15.sh b/test/unit/15.sh index 04a7a92114d..e52f15ddd5c 100755 --- a/test/unit/15.sh +++ b/test/unit/15.sh @@ -19,8 +19,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require +. include/common +. include/require.sh CFG=15.cfg @@ -28,16 +28,16 @@ if ! (check_kamailio); then exit 0 fi ; -echo "loadmodule \"../../modules/db_text/db_text.so\"" > $CFG +printf "loadmodule \"db_text/db_text.so\"" > $CFG cat 2.cfg >> $CFG -echo "modparam(\"$DB_ALL_MOD\", \"db_url\", \"text://`pwd`/../../utils/kamctl/dbtext/kamailio\")" >> $CFG -echo -e "\nrequest_route {\n ;\n}" >> $CFG +printf "modparam(\"$DB_ALL_MOD\", \"db_url\", \"text://`pwd`/../../utils/kamctl/dbtext/kamailio\")" >> $CFG +printf "\nrequest_route {\n ;\n}" >> $CFG -$BIN -w . -f $CFG -a no > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG -a no > /dev/null ret=$? sleep 1 -$KILL +kill_kamailio rm $CFG diff --git a/test/unit/16.sh b/test/unit/16.sh index b239adf4dc4..e1e2491dc2a 100755 --- a/test/unit/16.sh +++ b/test/unit/16.sh @@ -19,8 +19,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require +. include/common +. include/require.sh # Needs a default kamailio database setup for postgres @@ -31,16 +31,16 @@ fi ; CFG=16.cfg cp 2.cfg $CFG -echo "loadmodule \"../../modules/db_postgres/db_postgres.so\"" >> $CFG -echo "modparam(\"$DB_ALL_MOD\", \"db_url\", \"postgres://kamailioro:kamailioro@localhost/kamailio\")" >> $CFG -echo -e "\nrequest_route {\n ;\n}" >> $CFG +printf "loadmodule \"db_postgres/db_postgres.so\"" >> $CFG +printf "modparam(\"$DB_ALL_MOD\", \"db_url\", \"postgres://kamailioro:kamailioro@localhost/kamailio\")" >> $CFG +printf "\nrequest_route {\n ;\n}" >> $CFG # start -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? sleep 1 -$KILL +kill_kamailio rm $CFG diff --git a/test/unit/17.sh b/test/unit/17.sh index c8e1661f3ab..26799d4187a 100755 --- a/test/unit/17.sh +++ b/test/unit/17.sh @@ -19,8 +19,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require +. include/common +. include/require.sh if ! (check_kamailio && check_module "db_berkeley" ); then exit 0 @@ -30,10 +30,10 @@ CFG=17.cfg tmp_name=""$RANDOM"_kamailiodb_tmp" -echo "loadmodule \"../../modules/db_berkeley/db_berkeley.so\"" > $CFG +printf "loadmodule \"db_berkeley/db_berkeley.so\"" > $CFG cat 2.cfg >> $CFG -echo "modparam(\"$DB_ALL_MOD\", \"db_url\", \"berkeley://`pwd`/$CTL_DIR/$tmp_name\")" >> $CFG -echo -e "\nrequest_route {\n ;\n}" >> $CFG +printf "modparam(\"$DB_ALL_MOD\", \"db_url\", \"berkeley://`pwd`/$CTL_DIR/$tmp_name\")" >> $CFG +printf "\nrequest_route {\n ;\n}" >> $CFG # setup config file cp $CTLRC $CTLRC.bak @@ -53,12 +53,12 @@ ret=$? cd $CRT_DIR if [ "$ret" -eq 0 ] ; then - $BIN -w . -f $CFG -a no > /dev/null + $BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG -a no > /dev/null ret=$? fi ; sleep 1 -$KILL +kill_kamailio # cleanup cd $CTL_DIR diff --git a/test/unit/18.sh b/test/unit/18.sh index 0489e14b397..e29610676ff 100755 --- a/test/unit/18.sh +++ b/test/unit/18.sh @@ -20,8 +20,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require +. include/common +. include/require.sh if ! (check_kamailio); then exit 0 @@ -31,17 +31,17 @@ fi ; CFG=18.cfg # setup config -echo -e "debug=3\nrequest_route {\n ;\n}" > $CFG +printf "debug=3\nrequest_route {\n ;\n}" > $CFG # start: -$BIN -f ./$CFG -l 127.0.0.1 -n 0 -r -R -E -d -e -K -T -N 0 -b 23 -m 42 -w . -u $(id -u) -g $(id -g) -P ./pid.out -G ./pgid.out -a no -A TESTDEF > /dev/null 2>&1 +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -f ./$CFG -l 127.0.0.1 -n 0 -r -R -E -d -e -K -T -N 0 -b 23 -m 42 -w . -u $(id -u) -g $(id -g) -P ./pid.out -G ./pgid.out -a no -A TESTDEF > /dev/null 2>&1 ret=$? sleep 1 # clean up: -$KILL +kill_kamailio rm $CFG rm -f ./pid.out diff --git a/test/unit/19.cfg b/test/unit/19.cfg index 3ee5a859811..0aefe734294 100644 --- a/test/unit/19.cfg +++ b/test/unit/19.cfg @@ -10,7 +10,6 @@ dns=no rev_dns=no #-----------------------Loading Modules------------------------------------- -loadpath "../../modules/:../../modules_k/" loadmodule "tm" loadmodule "db_mysql" loadmodule "usrloc" diff --git a/test/unit/19.sh b/test/unit/19.sh index 80c2ebd1976..2cbf18f18e5 100755 --- a/test/unit/19.sh +++ b/test/unit/19.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh if ! (check_sipp && check_kamailio && check_module "db_mysql" && check_mysql); then exit 0 @@ -36,7 +36,7 @@ UAC=5080 # add an registrar entry to the db; $MYSQL "INSERT INTO location (ruid,username,contact,socket,user_agent,cseq,q) VALUES (\"kamailio-unit-uid\", \"foo\",\"sip:foo@localhost:$UAS\",\"udp:127.0.0.1:$UAS\",\"kamailio_test\",1,-1);" -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null sipp -sn uas -bg -i localhost -m 10 -f 2 -p $UAS &> /dev/null sipp -sn uac -s foo 127.0.0.1:$SRV -i localhost -m 10 -f 2 -p $UAC &> /dev/null @@ -44,7 +44,7 @@ ret=$? # cleanup killall -9 sipp > /dev/null 2>&1 -$KILL > /dev/null 2>&1 +kill_kamailio $MYSQL "DELETE FROM location WHERE ((contact = \"sip:foo@localhost:$UAS\") and (user_agent = \"kamailio_test\"));" exit $ret; diff --git a/test/unit/2.cfg b/test/unit/2.cfg index d2d7d8abc51..c44c8941b46 100644 --- a/test/unit/2.cfg +++ b/test/unit/2.cfg @@ -1,12 +1,11 @@ debug=2 -mpath="../../modules/" -loadmodule "../../modules/tm/tm.so" +loadmodule "tm/tm.so" loadmodule "tmx" loadmodule "acc" loadmodule "alias_db" loadmodule "auth" loadmodule "auth_db" -loadmodule "../../modules/avpops/avpops.so" +loadmodule "avpops/avpops.so" loadmodule "benchmark" loadmodule "cfgutils" loadmodule "dialog" @@ -14,9 +13,9 @@ loadmodule "dispatcher" loadmodule "diversion" loadmodule "domain" loadmodule "domainpolicy" -loadmodule "../../modules/enum/enum.so" +loadmodule "enum/enum.so" loadmodule "exec" -loadmodule "../../modules/db_flatstore/db_flatstore.so" +loadmodule "db_flatstore/db_flatstore.so" loadmodule "group" loadmodule "htable" loadmodule "imc" @@ -48,9 +47,9 @@ loadmodule "registrar" loadmodule "permissions" loadmodule "pdt" loadmodule "pv" -loadmodule "../../modules/rtpproxy/rtpproxy.so" +loadmodule "rtpproxy/rtpproxy.so" loadmodule "xlog" -loadmodule "../../modules/pdb/pdb.so" +loadmodule "pdb/pdb.so" modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo") modparam("mi_datagram", "socket_name", "/tmp/kamailio.sock") diff --git a/test/unit/2.sh b/test/unit/2.sh index 71ba85d4f06..aaa249da5e2 100755 --- a/test/unit/2.sh +++ b/test/unit/2.sh @@ -21,9 +21,9 @@ # Needs a default kamailio database setup for mysql -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh CFG=2.cfg @@ -35,16 +35,16 @@ cp $CFG $CFG.bak touch dispatcher.list -echo "loadmodule \"$SRC_DIR/modules/db_mysql/db_mysql.so\"" >> $CFG -echo "modparam(\"dispatcher\", \"list_file\", \"$SRC_DIR/$TEST_DIR/dispatcher.list\")" >> $CFG -echo -e "\nrequest_route {\n ;\n}" >> $CFG +printf "loadmodule \"db_mysql/db_mysql.so\"" >> $CFG +printf "modparam(\"dispatcher\", \"list_file\", \"dispatcher.list\")" >> $CFG +printf "\nrequest_route {\n ;\n}" >> $CFG # start -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? sleep 1 -$KILL +kill_kamailio mv $CFG.bak $CFG rm -f dispatcher.list diff --git a/test/unit/20.cfg b/test/unit/20.cfg index 8ef225f92aa..8bcd936ab82 100644 --- a/test/unit/20.cfg +++ b/test/unit/20.cfg @@ -10,7 +10,6 @@ dns=yes rev_dns=no #-----------------------Loading Modiules------------------------------------- -loadpath "../../modules/" loadmodule "tm" loadmodule "db_mysql" loadmodule "usrloc/usrloc.so" diff --git a/test/unit/20.sh b/test/unit/20.sh index ad48b9d57b8..2e2fec1e69b 100755 --- a/test/unit/20.sh +++ b/test/unit/20.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh if ! (check_sipp && check_kamailio && check_module "db_mysql" && check_mysql); then exit 0 @@ -35,7 +35,7 @@ $MYSQL "INSERT INTO location (ruid, username,contact,socket,user_agent,cseq,q) V sipp -sn uas -bg -i 127.0.0.1 -m 1 -f 10 -p 5060 &> /dev/null -$BIN -w . -f $CFG > $TMPFILE 2>&1 +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > $TMPFILE 2>&1 sipp -sn uac -s foo 127.0.0.1:5059 -i 127.0.0.1 -m 1 -f 10 -p 5061 &> /dev/null @@ -46,7 +46,7 @@ sleep 1 # cleanup killall -9 sipp &> /dev/null -$KILL &> /dev/null +kill_kamailio rm $TMPFILE $MYSQL "DELETE FROM location WHERE ((contact = \"sip:foo@127.0.0.1\") and (user_agent = \"kamailio_test\"));" diff --git a/test/unit/21.cfg b/test/unit/21.cfg index 74b237b1241..c7e3d9280bb 100644 --- a/test/unit/21.cfg +++ b/test/unit/21.cfg @@ -19,9 +19,6 @@ rev_dns=no # ------------------ module loading ---------------------------------- -#set module path -loadpath "../../modules/" - # Uncomment this if you want to use SQL database loadmodule "db_mysql/db_mysql.so" diff --git a/test/unit/21.sh b/test/unit/21.sh index bd445b2722e..8b6ed16d277 100755 --- a/test/unit/21.sh +++ b/test/unit/21.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh if ! (check_sipp && check_kamailio && check_module "db_mysql" && check_mysql); then exit 0 @@ -33,7 +33,7 @@ CFG=21.cfg # add an registrar entry to the db; $MYSQL "INSERT INTO subscriber (username, domain, password) VALUES (\"alice\",\"localhost\",\"alice\");" -$BIN -w . -f $CFG -E -e -dd > /dev/null 2>&1 +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG -E -e -dd > /dev/null 2>&1 ret=$? sleep 1 @@ -51,7 +51,7 @@ fi sleep 1 #cleanup -$KILL > /dev/null +kill_kamailio killall -9 sipp > /dev/null 2>&1 $MYSQL "DELETE FROM subscriber WHERE((username = \"alice\") and (domain = \"localhost\"));" diff --git a/test/unit/22.cfg b/test/unit/22.cfg index 692ca157834..a54a709b413 100644 --- a/test/unit/22.cfg +++ b/test/unit/22.cfg @@ -8,7 +8,6 @@ disable_tcp=yes alias=localhost # ------------------ module loading ---------------------------------- -loadpath "../../modules/" loadmodule "db_postgres" loadmodule "tm" loadmodule "sl" diff --git a/test/unit/22.sh b/test/unit/22.sh index 78014cd91c4..5bd20e68c93 100755 --- a/test/unit/22.sh +++ b/test/unit/22.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh if ! (check_sipsak && check_kamailio && check_module "db_postgres" && check_postgres); then exit 0 @@ -30,7 +30,7 @@ fi ; SIPDOMAIN=127.0.0.1 CFG=22.cfg -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? sleep 1 @@ -77,7 +77,7 @@ if [ "$ret" -eq 0 ]; then ret=$? fi; -$KILL +kill_kamailio # restart to test preload_udomain functionality $BIN -w . -f $CFG > /dev/null @@ -97,7 +97,7 @@ if [ "$ret" -eq 0 ]; then ret=$? fi; -$KILL +kill_kamailio $PSQL "delete from location where username like '49721123456789%';" diff --git a/test/unit/23.sh b/test/unit/23.sh index f1bee632c82..62e50aaa9a2 100755 --- a/test/unit/23.sh +++ b/test/unit/23.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh if ! (check_kamailio && check_module "carrierroute" && check_module "db_postgres" && check_postgres); then exit 0 @@ -32,7 +32,7 @@ CFG=13.cfg cp $CFG $CFG.bak # setup config -echo "loadmodule \"../../modules/db_postgres/db_postgres.so\"" >> $CFG +echo "loadmodule \"db_postgres/db_postgres.so\"" >> $CFG echo "modparam(\"carrierroute\", \"config_source\", \"db\")" >> $CFG echo "modparam(\"carrierroute\", \"db_url\", \"postgres://kamailioro:kamailioro@localhost/kamailio\")" >> $CFG @@ -51,7 +51,7 @@ insert into carrierroute (id, carrier, scan_prefix, domain, prob, strip, rewrite insert into carrierroute (id, carrier, scan_prefix, domain, prob, strip, rewrite_host) values ('20','2','','10','1','0','host6'); insert into carrierroute (id, carrier, scan_prefix, domain, prob, strip, rewrite_host) values ('21','3','','10','1','0','premium.host.local');" -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? sleep 1 @@ -87,7 +87,7 @@ Printing tree for domain 'domain1' (10) fi ; fi ; -$KILL +kill_kamailio # cleanup database $PSQL "delete from carrier_name where id = 1; @@ -101,4 +101,4 @@ delete from carrierroute where carrier=3;" mv $CFG.bak $CFG rm $TMPFILE -exit $ret \ No newline at end of file +exit $ret diff --git a/test/unit/24.sh b/test/unit/24.sh index 325c3dfad1f..196bb9df2ae 100755 --- a/test/unit/24.sh +++ b/test/unit/24.sh @@ -22,7 +22,7 @@ # Needs a mysql database, the root user password must be given # in the file 'dbrootpw' in the test directory -source include/common +. include/common if [ ! -f ~/.pgpass ] ; then echo "no .pgpass file, not run" @@ -55,4 +55,4 @@ mv $CTLRC.bak $CTLRC mv $DBCTL.bak $DBCTL cd - -exit $ret \ No newline at end of file +exit $ret diff --git a/test/unit/25.cfg b/test/unit/25.cfg index a7ceac06084..672ccfbf5d1 100644 --- a/test/unit/25.cfg +++ b/test/unit/25.cfg @@ -2,7 +2,6 @@ debug=0 listen=127.0.0.1 port=5059 -loadpath "../../modules_k/:../../modules/" loadmodule "tm/tm.so" loadmodule "sl/sl.so" loadmodule "usrloc/usrloc.so" diff --git a/test/unit/25.sh b/test/unit/25.sh index f25a4620fb9..48ca931c983 100755 --- a/test/unit/25.sh +++ b/test/unit/25.sh @@ -19,13 +19,13 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh -function cleanup() { +cleanup() { killall -9 sipp > /dev/null 2>&1 - $KILL > /dev/null 2>&1 + kill_kamailio $MYSQL "delete from location where (user_agent = \"kamailio_test\");" $MYSQL "delete from userblacklist where username='49721123456786';" @@ -77,7 +77,7 @@ $MYSQL "insert into globalblacklist (prefix, whitelist, description) values ('1' $MYSQL "insert into globalblacklist (prefix, whitelist, description) values ('','0','_test_');" -$BIN -w . -f $CFG > /dev/null 2>&1 +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null 2>&1 sleep 1 sipp -sn uas -bg -i 127.0.0.1 -p 5060 #&> /dev/null diff --git a/test/unit/26.cfg b/test/unit/26.cfg index 52d8da9265e..ff5f269d06e 100644 --- a/test/unit/26.cfg +++ b/test/unit/26.cfg @@ -1,7 +1,6 @@ debug=3 memdbg=6 memlog=6 -loadpath "../../modules/:../../modules_k/" loadmodule "sl" loadmodule "tm" loadmodule "tmx" diff --git a/test/unit/26.sh b/test/unit/26.sh index 5f253ada18b..da70f415659 100755 --- a/test/unit/26.sh +++ b/test/unit/26.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh if ! (check_kamailio && check_module "carrierroute" && check_module "db_mysql" && check_mysql); then exit 0 @@ -32,7 +32,7 @@ CFG=26.cfg cp $CFG $CFG.bak # setup config -echo "loadmodule \"../../modules/db_mysql/db_mysql.so\"" >> $CFG +echo "loadmodule \"db_mysql/db_mysql.so\"" >> $CFG echo "modparam(\"carrierroute\", \"config_source\", \"db\")" >> $CFG # setup database @@ -74,7 +74,7 @@ $MYSQL "insert into subscriber (username, cr_preferred_carrier) values ('4972112 $MYSQL "insert into subscriber (username, cr_preferred_carrier) values ('49721123456785', 3);" -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? @@ -124,7 +124,7 @@ if [ ! "$ret" -eq 0 ] ; then fi; -$KILL +kill_kamailio killall -9 sipp # cleanup database @@ -147,4 +147,4 @@ $MYSQL "alter table subscriber drop cr_preferred_carrier;" mv $CFG.bak $CFG -exit $ret \ No newline at end of file +exit $ret diff --git a/test/unit/27.sh b/test/unit/27.sh index 772321df348..8d837b6c5e0 100755 --- a/test/unit/27.sh +++ b/test/unit/27.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh if ! (check_sipp && check_kamailio && check_module "db_mysql" \ && check_module "presence" && check_module "presence_xml" \ @@ -31,7 +31,7 @@ fi ; CFG=presence.cfg -$BIN -w . -f $CFG -a no >/dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG -a no >/dev/null ret=$? sleep 1 @@ -48,7 +48,7 @@ fi sleep 1 #cleanup: -$KILL >/dev/null +kill_kamailio killall -9 sipp >/dev/null 2>&1 exit $ret diff --git a/test/unit/28.cfg b/test/unit/28.cfg index ef034a86bfe..a86b61ce554 100644 --- a/test/unit/28.cfg +++ b/test/unit/28.cfg @@ -1,6 +1,5 @@ debug=3 -loadpath "../../modules/" loadmodule "sl.so" loadmodule "tm/tm.so" loadmodule "db_mysql/db_mysql.so" diff --git a/test/unit/28.sh b/test/unit/28.sh index 05478944c0f..de8f21ee25a 100755 --- a/test/unit/28.sh +++ b/test/unit/28.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh if ! (check_sipp && check_kamailio && check_module "db_mysql" && check_module "cpl-c" && check_mysql); then exit 0 @@ -32,7 +32,7 @@ CPL=cpl_ignore.xml TMPFILE=`mktemp -t kamailio-test.XXXXXXXXXX` -$BIN -w . -f $CFG -a no >/dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG -a no >/dev/null ret=$? sleep 1 @@ -64,7 +64,7 @@ fi; sleep 1 #cleanup: -$KILL >/dev/null +kill_kamailio killall -9 sipp >/dev/null 2>&1 rm $TMPFILE diff --git a/test/unit/29.sh b/test/unit/29.sh index 7925c94f3a9..b63d6ae5921 100755 --- a/test/unit/29.sh +++ b/test/unit/29.sh @@ -19,8 +19,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require +. include/common +. include/require.sh if ! (check_sipp && check_kamailio && check_module "db_postgres" && check_module "cpl-c"); then exit 0 @@ -31,11 +31,11 @@ CPL=cpl_ignore.xml TMPFILE=`mktemp -t kamailio-test.XXXXXXXXXX` cp $CFG $CFG.tmp -echo "loadmodule \"../../modules/db_postgres/db_postgres.so\"" >> $CFG +echo "loadmodule \"db_postgres/db_postgres.so\"" >> $CFG echo "modparam(\"cpl-c\", \"db_url\", \"postgres://kamailio:kamailiorw@localhost/kamailio\")" >> $CFG -$BIN -w . -f $CFG >/dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG >/dev/null ret=$? sleep 1 @@ -65,7 +65,7 @@ if [ ! "$ret" -eq 0 ] ; then fi; #cleanup: -$KILL >/dev/null +kill_kamailio killall -9 sipp >/dev/null 2>&1 rm $TMPFILE mv $CFG.tmp $CFG diff --git a/test/unit/3.sh b/test/unit/3.sh index 9578c01a210..03c98b04fb8 100755 --- a/test/unit/3.sh +++ b/test/unit/3.sh @@ -25,14 +25,14 @@ # If MySQL root password is empty, add in the file the line: # PWSKIP=yes -source include/common +. include/common if [ ! -f dbrootpw ] ; then echo "no root password, not run" exit 0 fi ; -source dbrootpw +. dbrootpw tmp_name=""$RANDOM"_kamailiodb_tmp" diff --git a/test/unit/30.cfg b/test/unit/30.cfg index c2f006bbfef..655f21bc1b0 100644 --- a/test/unit/30.cfg +++ b/test/unit/30.cfg @@ -1,11 +1,10 @@ debug=2 -loadpath "../../modules/:../../modules_k/" loadmodule "sl" -loadmodule "../../modules/tm/tm.so" +loadmodule "tm/tm.so" loadmodule "xlog" loadmodule "maxfwd" loadmodule "pv" -loadmodule "../../modules/carrierroute/carrierroute.so" +loadmodule "carrierroute/carrierroute.so" route{ # initial sanity checks diff --git a/test/unit/30.sh b/test/unit/30.sh index 83797779483..dfb0dfeefaf 100755 --- a/test/unit/30.sh +++ b/test/unit/30.sh @@ -19,8 +19,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require +. include/common +. include/require.sh if ! (check_sipp && check_kamailio && check_module "carrierroute"); then exit 0 @@ -35,7 +35,7 @@ cp $CFG $CFG.bak echo "modparam(\"carrierroute\", \"config_file\", \"carrierroute-2.cfg\")" >> $CFG -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? @@ -62,9 +62,9 @@ if [ "$ret" -eq 0 ] ; then ret=$? fi; -$KILL +kill_kamailio killall -9 sipp mv $CFG.bak $CFG -exit $ret \ No newline at end of file +exit $ret diff --git a/test/unit/31.sh b/test/unit/31.sh index 4e40f9f8cce..cccf074f362 100755 --- a/test/unit/31.sh +++ b/test/unit/31.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh if ! (check_kamailio && check_module "db_mysql" && check_mysql); then exit 0 @@ -39,11 +39,11 @@ while [ $COUNTER -lt $NR ]; do $MYSQL "insert into location (ruid, username, domain, contact, user_agent) values ('ul-ruid-$COUNTER', 'foobar-$RANDOM', '$DOMAIN', 'sip:foobar-$RANDOM@$DOMAIN', '___test___');" done -$BIN -w . -f $CFG -A FETCHROWS=17 -a no >/dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG -A FETCHROWS=17 -a no >/dev/null ret=$? sleep 1 -$KILL >/dev/null +kill_kamailio $MYSQL "delete from location where user_agent = '___test___'" diff --git a/test/unit/32.sh b/test/unit/32.sh index e6d653325ff..6d30899ef38 100755 --- a/test/unit/32.sh +++ b/test/unit/32.sh @@ -35,7 +35,7 @@ NR=25 cp $CFG $CFG.bak -echo "loadmodule \"../../modules/db_postgres/db_postgres.so\"" >> $CFG +echo "loadmodule \"db_postgres/db_postgres.so\"" >> $CFG echo "modparam(\"usrloc\", \"db_url\", \"postgres://kamailio:kamailiorw@localhost/kamailio\")" >> $CFG echo "modparam(\"usrloc\", \"fetch_rows\", 13)" >> $CFG @@ -46,11 +46,11 @@ while [ $COUNTER -lt $NR ]; do $PSQL "insert into location (username, domain, contact, user_agent) values ('foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); insert into location (username, domain, contact, user_agent) values ('foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); insert into location (username, domain, contact, user_agent) values ('foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); insert into location (username, domain, contact, user_agent) values ('foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); insert into location (username, domain, contact, user_agent) values ('foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); insert into location (username, domain, contact, user_agent) values ('foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); insert into location (username, domain, contact, user_agent) values ('foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); insert into location (username, domain, contact, user_agent) values ('foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); insert into location (username, domain, contact, user_agent) values ('foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); insert into location (username, domain, contact, user_agent) values ('foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___');" done -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? sleep 1 -$KILL +kill_kamailio $PSQL "delete from location where user_agent = '___test___'" diff --git a/test/unit/33.cfg b/test/unit/33.cfg index 95dee8904cc..3f0dfabc07c 100644 --- a/test/unit/33.cfg +++ b/test/unit/33.cfg @@ -1,6 +1,5 @@ debug=3 memlog=2 -loadpath "../../modules/" loadmodule "cfgutils.so" loadmodule "pv.so" loadmodule "xlog.so" diff --git a/test/unit/33.sh b/test/unit/33.sh index fcfcdc425fa..58cc5c3631e 100755 --- a/test/unit/33.sh +++ b/test/unit/33.sh @@ -37,7 +37,7 @@ cp $CFG $CFG.bak ulimit -c unlimited -$BIN -w . -f $CFG -a no > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG -a no > /dev/null ret=$? sleep 1 @@ -59,7 +59,7 @@ if [ ! $ret -eq 0 ] ; then fi sleep 1 -$KILL >/dev/null 2>&1 +kill_kamailio ret=$? if [ $ret -eq 0 ] ; then diff --git a/test/unit/34.cfg b/test/unit/34.cfg index 6f158a529fb..c9f7c0ce8cf 100644 --- a/test/unit/34.cfg +++ b/test/unit/34.cfg @@ -1,4 +1,3 @@ -loadpath "../../modules_k:../../modules" loadmodule "tm/tm.so" loadmodule "sl.so" loadmodule "usrloc.so" diff --git a/test/unit/34.sh b/test/unit/34.sh index 1fd42d4a875..8cce1daac75 100755 --- a/test/unit/34.sh +++ b/test/unit/34.sh @@ -40,15 +40,15 @@ fi ; cp $CFG $CFG.bak -echo "loadmodule \"../../modules/db_mysql/db_mysql.so\"" >> $CFG +echo "loadmodule \"db_mysql/db_mysql.so\"" >> $CFG # start -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? sleep 1 -$KILL +kill_kamailio mv $CFG.bak $CFG -exit $ret \ No newline at end of file +exit $ret diff --git a/test/unit/35.cfg b/test/unit/35.cfg index 1c436da5d6d..85395016fa8 100644 --- a/test/unit/35.cfg +++ b/test/unit/35.cfg @@ -10,7 +10,6 @@ dns=no rev_dns=no #-----------------------Loading Modules------------------------------------- -mpath="../modules/" loadmodule "db_mysql/db_mysql.so" loadmodule "usrloc/usrloc.so" loadmodule "registrar/registrar.so" diff --git a/test/unit/35.sh b/test/unit/35.sh index c16ad0bcd52..d8d47ba64be 100755 --- a/test/unit/35.sh +++ b/test/unit/35.sh @@ -40,7 +40,7 @@ $MYSQL "INSERT INTO trusted (src_ip, proto) VALUES (\"127.0.0.1\",\"any\");" $MYSQL "INSERT INTO address (ip_addr, mask) VALUES ('$IP', '$MASK');" -../$BIN -w . -f $CFG &> /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG &> /dev/null sipp -sn uas -bg -i localhost -m 10 -f 2 -p $UAS &> /dev/null sipp -sn uac -s foo 127.0.0.1:$SRV -i localhost -m 10 -f 2 -p $UAC &> /dev/null ret=$? @@ -64,7 +64,7 @@ fi; # cleanup killall -9 sipp > /dev/null 2>&1 -$KILL > /dev/null 2>&1 +kill_kamailio $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\");" diff --git a/test/unit/36.sh b/test/unit/36.sh index da63623605d..c4da4ed5efd 100755 --- a/test/unit/36.sh +++ b/test/unit/36.sh @@ -31,10 +31,10 @@ CFG=11.cfg cp $CFG $CFG.bak -echo "loadmodule \"../../modules/db_mysql/db_mysql.so\"" >> $CFG +echo "loadmodule \"db_mysql/db_mysql.so\"" >> $CFG # 1768 contacts should fit into 1 MB of PKG memory -$BIN -V | grep "PKG_MALLOC" > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -V | grep "PKG_MALLOC" > /dev/null if [ $? -eq 0 ]; then NR=176 else @@ -56,7 +56,7 @@ while [ $COUNTER -lt $NR ]; do insert into location (username, domain, contact, user_agent) values ('foobar-$COUNTER-$RANDOM', 'local', 'foobar-$COUNTER-$RANDOM@$DOMAIN', '___test___');" done -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? if [ $ret -eq 0 ]; then @@ -72,7 +72,7 @@ if [ $ret -eq 0 ]; then fi; sleep 1 -$KILL +kill_kamailio $MYSQL "delete from location where user_agent = '___test___'" diff --git a/test/unit/37.sh b/test/unit/37.sh index 9f7007ee249..86cb60cfd10 100755 --- a/test/unit/37.sh +++ b/test/unit/37.sh @@ -36,7 +36,7 @@ fi ; cp $CFG $CFG.bak # setup config -echo "loadmodule \"../../modules/db_mysql/db_mysql.so\"" >> $CFG +echo "loadmodule \"db_mysql/db_mysql.so\"" >> $CFG echo "modparam(\"carrierroute\", \"config_source\", \"db\")" >> $CFG # setup database @@ -62,7 +62,7 @@ while [ $COUNTER -lt $NR ]; do done -$BIN -m 128 -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -m 128 -w . -f $CFG > /dev/null ret=$? # adjust if you have bigger rule sets @@ -76,7 +76,7 @@ if [ $ret -eq 0 ] ; then fi; fi ; -$KILL +kill_kamailio # cleanup database $MYSQL "delete from carrier_name where id = 1;" diff --git a/test/unit/38.sh b/test/unit/38.sh index 65e8d3c905d..aa99a38fdc5 100755 --- a/test/unit/38.sh +++ b/test/unit/38.sh @@ -36,11 +36,11 @@ echo "loadmodule \"db_unixodbc/db_unixodbc.so\"" >> $CFG echo "modparam(\"$DB_ALL_MOD\", \"db_url\", \"unixodbc://kamailioro:kamailioro@localhost/kamailio\")" >> $CFG # start -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? sleep 1 -$KILL +kill_kamailio mv $CFG.bak $CFG rm -f dispatcher.list diff --git a/test/unit/39.sh b/test/unit/39.sh index 9a3757a08f2..5cb46385275 100755 --- a/test/unit/39.sh +++ b/test/unit/39.sh @@ -36,26 +36,26 @@ NR=25 cp $CFG $CFG.bak -echo "loadmodule \"$SRC_DIR/modules/db_unixodbc/db_unixodbc.so\"" >> $CFG -echo "modparam(\"usrloc\", \"db_url\", \"unixodbc://kamailio:kamailiorw@localhost/kamailio\")" >> $CFG -echo "modparam(\"usrloc\", \"fetch_rows\", 13)" >> $CFG +printf "loadmodule \"db_unixodbc/db_unixodbc.so\"" >> $CFG +printf "modparam(\"usrloc\", \"db_url\", \"unixodbc://kamailio:kamailiorw@localhost/kamailio\")" >> $CFG +printf "modparam(\"usrloc\", \"fetch_rows\", 13)" >> $CFG # isql unfortunally only allow one statement per line COUNTER=0 CNT=0 while [ $COUNTER -lt $NR ]; do COUNTER=$(($COUNTER+1)) - echo -e "insert into location (id, username, domain, contact, user_agent) values ('$CNT', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+1))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+2))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+3))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+4))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+5))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+6))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+7))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+8))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+9))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___');" | $ISQL + printf "insert into location (id, username, domain, contact, user_agent) values ('$CNT', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+1))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+2))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+3))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+4))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+5))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+6))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+7))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+8))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___'); \n insert into location (id, username, domain, contact, user_agent) values ('$(($CNT+9))', 'foobar-$RANDOM', '$DOMAIN', 'foobar-$RANDOM@$DOMAIN', '___test___');" | $ISQL CNT=$(($CNT+10)) done -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? sleep 2 -$KILL +kill_kamailio -echo "delete from location where user_agent = '___test___'" | $ISQL > /dev/null +printf "delete from location where user_agent = '___test___'" | $ISQL > /dev/null mv $CFG.bak $CFG diff --git a/test/unit/4.sh b/test/unit/4.sh index 452249ea67e..41e599dc4bd 100755 --- a/test/unit/4.sh +++ b/test/unit/4.sh @@ -19,8 +19,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require +. include/common +. include/require.sh CFG=4.cfg @@ -29,13 +29,13 @@ if ! (check_kamailio); then fi ; # setup config -echo -e "loadmodule \"$SRC_DIR/modules/mi_fifo/mi_fifo.so\"" > $CFG -echo -e "loadmodule \"$SRC_DIR/modules/kex/kex.so\"" >> $CFG -echo -e "modparam(\"mi_fifo\", \"fifo_name\", \"/tmp/kamailio_fifo\")" >> $CFG -echo -e "\nrequest_route {\n ;\n}" >> $CFG +printf "loadmodule \"mi_fifo/mi_fifo.so\"" > $CFG +printf "loadmodule \"kex/kex.so\"" >> $CFG +printf "modparam(\"mi_fifo\", \"fifo_name\", \"/tmp/kamailio_fifo\")" >> $CFG +printf "\nrequest_route {\n ;\n}" >> $CFG -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? if [ "$ret" -eq 0 ] ; then @@ -44,7 +44,7 @@ if [ "$ret" -eq 0 ] ; then ret=$? fi ; -$KILL +kill_kamailio rm -f $CFG diff --git a/test/unit/40.cfg b/test/unit/40.cfg index 9b4ed86035d..306baf06903 100644 --- a/test/unit/40.cfg +++ b/test/unit/40.cfg @@ -1,6 +1,3 @@ - -loadpath "../../modules_k:../../modules/" - loadmodule "tm/tm.so" loadmodule "sl/sl.so" loadmodule "db_mysql/db_mysql.so" diff --git a/test/unit/40.sh b/test/unit/40.sh index 6e2b2986ea6..c0f86a081bf 100755 --- a/test/unit/40.sh +++ b/test/unit/40.sh @@ -38,7 +38,7 @@ fi ; $MYSQL "INSERT INTO location (username,contact,socket,user_agent,cseq,q) VALUES (\"foo\",\"sip:foo@127.0.0.1:$UAS\",\"udp:127.0.0.1:$UAS\",\"ser_test\",1,-1);" # start -$BIN -w . -f $CFG &> /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG &> /dev/null ret=$? # this should work @@ -66,8 +66,8 @@ if [ "$ret" -eq 1 ]; then fi; sleep 1 -$KILL +kill_kamailio killall -9 sipp > /dev/null 2>&1 $MYSQL "DELETE FROM location WHERE ((contact = \"sip:foo@127.0.0.1:$UAS\") and (user_agent = \"ser_test\"));" -exit $ret \ No newline at end of file +exit $ret diff --git a/test/unit/41.cfg b/test/unit/41.cfg index 000036410d6..b12d330a688 100644 --- a/test/unit/41.cfg +++ b/test/unit/41.cfg @@ -1,7 +1,6 @@ #memlog=1 debug=1 children=1 -loadpath "../../modules_k:../../modules/" loadmodule "tm/tm.so" loadmodule "sl/sl.so" diff --git a/test/unit/41.sh b/test/unit/41.sh index 7e2be14f58d..573e999d847 100755 --- a/test/unit/41.sh +++ b/test/unit/41.sh @@ -44,7 +44,7 @@ $MYSQL "INSERT INTO usr_preferences (uuid, attribute, type, value) VALUES (\"foo # start -$BIN -w . -f $CFG &> /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG &> /dev/null ret=$? if [ "$ret" -eq 0 ]; then @@ -54,7 +54,7 @@ if [ "$ret" -eq 0 ]; then fi; sleep 1 -$KILL +kill_kamailio killall -9 sipp > /dev/null 2>&1 $MYSQL "DELETE FROM location WHERE ((contact = \"sip:foo@127.0.0.1:$UAS\") and (user_agent = \"ser_test\"));" diff --git a/test/unit/42.sh b/test/unit/42.sh index 8a30d2fe468..e0b5b7bdafc 100755 --- a/test/unit/42.sh +++ b/test/unit/42.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh if ! (check_kamailio && check_module "carrierroute" && check_module "db_mysql" && check_mysql); then exit 0 @@ -32,7 +32,7 @@ CFG=26.cfg cp $CFG $CFG.bak # setup config -echo "loadmodule \"../../modules/db_mysql/db_mysql.so\"" >> $CFG +echo "loadmodule \"db_mysql/db_mysql.so\"" >> $CFG echo "modparam(\"carrierroute\", \"config_source\", \"db\")" >> $CFG echo "modparam(\"carrierroute\", \"match_mode\", 128)" >> $CFG @@ -75,7 +75,7 @@ $MYSQL "insert into subscriber (username, cr_preferred_carrier) values ('ab4-123 $MYSQL "insert into subscriber (username, cr_preferred_carrier) values ('ab4-123456785', 3);" -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? @@ -122,7 +122,7 @@ if [ ! "$ret" -eq 0 ] ; then fi; -$KILL +kill_kamailio killall -9 sipp # cleanup database @@ -145,4 +145,4 @@ $MYSQL "alter table subscriber drop cr_preferred_carrier;" mv $CFG.bak $CFG -exit $ret \ No newline at end of file +exit $ret diff --git a/test/unit/43.sh b/test/unit/43.sh index db5efbecbbc..cc2f3584c9d 100755 --- a/test/unit/43.sh +++ b/test/unit/43.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh if ! (check_kamailio && check_module "utils" && check_module "db_mysql" && check_mysql); then exit 0 @@ -30,16 +30,15 @@ fi ; CFG=43.cfg TMPFILE=`mktemp -t kamailio-test.XXXXXXXXX` # setup config -echo "mpath=\"../../modules\"" > $CFG -echo "loadmodule \"../../modules/tm/tm.so\"" >> $CFG +echo "loadmodule \"tm/tm.so\"" > $CFG echo "loadmodule \"sl/sl.so\"" >> $CFG echo "loadmodule \"mi_fifo/mi_fifo.so\"" >> $CFG -echo "loadmodule \"../../modules/utils/utils.so\"" >> $CFG +echo "loadmodule \"utils/utils.so\"" >> $CFG echo "modparam(\"mi_fifo\", \"fifo_name\", \"/tmp/kamailio_fifo\")" >> $CFG echo "modparam(\"utils\", \"forward_active\", 1)" >> $CFG echo "route {sl_send_reply(\"404\", \"forbidden\");}" >> $CFG -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? @@ -97,6 +96,6 @@ fi; rm $CFG rm $TMPFILE -$KILL +kill_kamailio exit $ret diff --git a/test/unit/44.sh b/test/unit/44.sh index 0bb408397ed..53deed293bd 100755 --- a/test/unit/44.sh +++ b/test/unit/44.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh if ! (check_sipsak && check_kamailio && check_module "db_unixodbc" && check_unixodbc); then exit 0 @@ -30,10 +30,10 @@ fi ; CFG=11.cfg cp $CFG $CFG.tmp -echo "loadmodule \"$SRC_DIR/modules/db_unixodbc/db_unixodbc.so\"" >> $CFG +echo "loadmodule \"db_unixodbc/db_unixodbc.so\"" >> $CFG echo "modparam(\"usrloc\", \"db_url\", \"unixodbc://kamailio:kamailiorw@localhost/kamailio\")" >> $CFG -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? sleep 1 @@ -80,10 +80,10 @@ if [ "$ret" -eq 0 ]; then ret=$? fi; -$KILL +kill_kamailio # restart to test preload_udomain functionality -$BIN -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG > /dev/null ret=$? sleep 1 @@ -100,7 +100,7 @@ if [ "$ret" -eq 0 ]; then ret=$? fi; -$KILL +kill_kamailio echo "delete from location where username like '49721123456789%';" | $ISQL diff --git a/test/unit/45.cfg b/test/unit/45.cfg index a170672d7cb..488e0b56de1 100644 --- a/test/unit/45.cfg +++ b/test/unit/45.cfg @@ -10,12 +10,11 @@ dns=no rev_dns=no #-----------------------Loading Modules------------------------------------- -mpath="../../modules/" -loadmodule "../../modules/db_mysql/db_mysql.so" +loadmodule "db_mysql/db_mysql.so" loadmodule "usrloc/usrloc.so" loadmodule "registrar/registrar.so" loadmodule "sl/sl.so" -loadmodule "../../modules/tm/tm.so" +loadmodule "tm/tm.so" loadmodule "maxfwd/maxfwd.so" loadmodule "pv/pv.so" loadmodule "cfgutils.so" diff --git a/test/unit/45.sh b/test/unit/45.sh index 5f11519d78f..5a3ec18589f 100755 --- a/test/unit/45.sh +++ b/test/unit/45.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh if ! (check_sipp && check_kamailio && check_module "db_mysql" && check_mysql && check_module "memcached"); then exit 0 @@ -36,7 +36,7 @@ UAC=5080 # add an registrar entry to the db; $MYSQL "INSERT INTO location (username,contact,socket,user_agent,cseq,q) VALUES (\"foo\",\"sip:foo@127.0.0.1:$UAS\",\"udp:127.0.0.1:$UAS\",\"ser_test\",1,-1);" -$BIN -w . -f $CFG &> /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG &> /dev/null sipp -sn uas -bg -i 127.0.0.1 -m 10 -f 2 -p $UAS &> /dev/null sipp -sn uac -s foo 127.0.0.1:$SRV -i 127.0.0.1 -m 10 -f 2 -p $UAC &> /dev/null @@ -45,7 +45,7 @@ ret=$? # cleanup killall -9 sipp > /dev/null 2>&1 -$KILL > /dev/null 2>&1 +kill_kamailio $MYSQL "DELETE FROM location WHERE ((contact = \"sip:foo@127.0.0.1:$UAS\") and (user_agent = \"ser_test\"));" exit $ret; diff --git a/test/unit/46.sh b/test/unit/46.sh index 2511f414dae..d9548d8141f 100755 --- a/test/unit/46.sh +++ b/test/unit/46.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh if ! (check_sipp && check_kamailio && check_module "db_mysql" && check_mysql ); then exit 0 @@ -32,7 +32,7 @@ SRV=5060 UAS=5070 UAC=5080 -function test_module_int() +test_module_int() { if [ x$# != x3 ] ; then echo "wrong number of params : usage test_module module cfg_param value" @@ -67,10 +67,10 @@ function test_module_int() # add an registrar entry to the db cp $CFG ${CFG}.bak -echo "loadmodule \"../../modules/db_mysql/db_mysql.so\"" >>$CFG -echo "loadmodule \"../../modules/ctl/ctl.so\"" >> $CFG -echo "loadmodule \"../../modules/cfg_rpc/cfg_rpc.so\"" >> $CFG -$BIN -w . -f $CFG &> /dev/null +echo "loadmodule \"db_mysql/db_mysql.so\"" >>$CFG +echo "loadmodule \"ctl/ctl.so\"" >> $CFG +echo "loadmodule \"cfg_rpc/cfg_rpc.so\"" >> $CFG +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG &> /dev/null ret=$? sleep 1 @@ -87,7 +87,7 @@ ret=$? # cleanup killall -9 sipp > /dev/null 2>&1 -$KILL > /dev/null 2>&1 +kill_kamailio mv ${CFG}.bak $CFG diff --git a/test/unit/5.cfg b/test/unit/5.cfg index 9703e7c553a..b59a3635540 100644 --- a/test/unit/5.cfg +++ b/test/unit/5.cfg @@ -59,12 +59,9 @@ port=5060 ####### Modules Section ######## -#set module path -mpath="../../modules_k" - /* uncomment next line for MySQL DB support */ #loadmodule "db_mysql.so" -loadmodule "../../modules/tm/tm.so" +loadmodule "tm/tm.so" loadmodule "sl/sl.so" loadmodule "rr/rr.so" loadmodule "pv/pv.so" diff --git a/test/unit/5.sh b/test/unit/5.sh index 0554ae2a80d..cb447387ff8 100755 --- a/test/unit/5.sh +++ b/test/unit/5.sh @@ -21,10 +21,10 @@ # Needs a default kamailio database setup for mysql -source include/common -source include/require +. include/common +. include/require.sh -CFG=$SRC_DIR/etc/kamailio.cfg +CFG=$TOP_DIR/etc/kamailio.cfg if ! (check_kamailio); then exit 0 @@ -32,10 +32,10 @@ fi ; # start -$BIN -w . -L $SRC_DIR/modules/ -f $CFG -A WITH_SRCPATH -a no > /dev/null 2>&1 +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG -A WITH_SRCPATH -a no > /dev/null 2>&1 ret=$? sleep 1 -$KILL +kill_kamailio exit $ret diff --git a/test/unit/50.cfg b/test/unit/50.cfg index 5aac5f52aef..2960beef386 100644 --- a/test/unit/50.cfg +++ b/test/unit/50.cfg @@ -6,7 +6,6 @@ children=1 disable_tcp=yes # ------------------ module loading ---------------------------------- -loadpath "../../modules/:../../modules_k/" loadmodule "tm" loadmodule "sl" loadmodule "rr" @@ -14,7 +13,7 @@ loadmodule "maxfwd" loadmodule "textops" loadmodule "xlog" loadmodule "pv" -loadmodule "../../modules/db_mysql/db_mysql.so" +loadmodule "db_mysql/db_mysql.so" loadmodule "mi_fifo" modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo") diff --git a/test/unit/50.sh b/test/unit/50.sh index 5c0979a9f52..5a1ba6c52c1 100755 --- a/test/unit/50.sh +++ b/test/unit/50.sh @@ -19,9 +19,9 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require -source include/database +. include/common +. include/require.sh +. include/database.sh CFG=50.cfg @@ -33,7 +33,7 @@ MYSQL_LOC_A="mysql loc_a --show-warnings --batch --user=ser --password=ser -e" MYSQL_LOC_B="mysql loc_b --show-warnings --batch --user=ser --password=ser -e" cp $CFG $CFG.bak -$BIN -w . -f $CFG #> /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG #> /dev/null ret=$? sleep 1 @@ -155,8 +155,8 @@ $MYSQL_LOC_A "delete from location where username like '497211234567%';" $MYSQL_LOC_B "delete from location where username like '497211234567%';" -$KILL +kill_kamailio mv $CFG.bak $CFG -exit $ret \ No newline at end of file +exit $ret diff --git a/test/unit/6.sh b/test/unit/6.sh index a89284db847..b6ed5a3b2ba 100755 --- a/test/unit/6.sh +++ b/test/unit/6.sh @@ -19,8 +19,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common -source include/require +. include/common +. include/require.sh CFG=2.cfg @@ -29,7 +29,7 @@ if ! (check_kamailio); then fi ; # start -cat $CFG | cat - route-empty.cfg | $BIN -w . -a no -c -f - > /dev/null 2>&1 +cat $CFG | cat - route-empty.cfg | $BIN -L $MOD_DIR -w . -a no -c -f - > /dev/null 2>&1 ret=$? exit $ret diff --git a/test/unit/60.cfg b/test/unit/60.cfg index cd7aa1cb788..35b2bf31ec8 100644 --- a/test/unit/60.cfg +++ b/test/unit/60.cfg @@ -8,8 +8,6 @@ listen=udp:127.0.0.1:5060 auto_aliases=no alias=example.invalid # ------------------ module loading ---------------------------------- -loadpath "../../modules/" - loadmodule "tm.so" loadmodule "sl.so" loadmodule "pv.so" diff --git a/test/unit/60.sh b/test/unit/60.sh index 54d514c2eeb..0df54ef5600 100755 --- a/test/unit/60.sh +++ b/test/unit/60.sh @@ -28,7 +28,7 @@ if ! (check_sipsak && check_kamailio && check_module "sdpops"); then exit 0 fi -${BIN} -w ${RUN_DIR} -Y ${RUN_DIR} -P ${PIDFILE} -f ${CFGFILE} > /dev/null +${BIN} -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f ${CFGFILE} > /dev/null ret=$? sleep 1 diff --git a/test/unit/61.cfg b/test/unit/61.cfg index 6a7da0a91c6..7fcfae2e1f3 100644 --- a/test/unit/61.cfg +++ b/test/unit/61.cfg @@ -8,8 +8,6 @@ listen=udp:127.0.0.1:5060 auto_aliases=no alias=example.invalid # ------------------ module loading ---------------------------------- -loadpath "../../modules/" - loadmodule "sl.so" loadmodule "pv.so" loadmodule "textops.so" diff --git a/test/unit/61.sh b/test/unit/61.sh index 16288d190af..5b7b4b35a36 100755 --- a/test/unit/61.sh +++ b/test/unit/61.sh @@ -34,7 +34,7 @@ if ! (check_sipsak && check_kamailio && check_module "sdpops" && check_module "a exit 0 fi -${BIN} -w ${RUN_DIR} -Y ${RUN_DIR} -P ${PIDFILE} -f ${CFGFILE} > /dev/null +${BIN} -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f ${CFGFILE} > /dev/null ret=$? sleep 1 diff --git a/test/unit/7.cfg b/test/unit/7.cfg index ab8ddfe2749..bd5119ef947 100644 --- a/test/unit/7.cfg +++ b/test/unit/7.cfg @@ -100,7 +100,6 @@ ######################################################################## listen = udp:127.0.0.1:5060 -mpath = "../../modules" children = 8 debug = 2 fork = yes diff --git a/test/unit/7.sh b/test/unit/7.sh index 5aaf636564d..09db6e50703 100755 --- a/test/unit/7.sh +++ b/test/unit/7.sh @@ -23,8 +23,8 @@ # Needs a default kamailio database setup for mysql -source include/common -source include/require +. include/common +. include/require.sh CFG=7.cfg @@ -33,10 +33,10 @@ if ! (check_kamailio); then fi ; # start -$BIN -a no -w . -f $CFG > /dev/null +$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -a no -w . -f $CFG > /dev/null ret=$? sleep 1 -$KILL +kill_kamailio exit $ret diff --git a/test/unit/8.sh b/test/unit/8.sh index 3165e2fe389..7d41c537cbd 100755 --- a/test/unit/8.sh +++ b/test/unit/8.sh @@ -19,7 +19,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common +. include/common tmp_name=""$RANDOM"_kamailiodb_tmp" diff --git a/test/unit/9.sh b/test/unit/9.sh index 8e21626f444..c34c9b29d95 100755 --- a/test/unit/9.sh +++ b/test/unit/9.sh @@ -19,7 +19,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -source include/common +. include/common cd $CTL_DIR diff --git a/test/unit/include/common b/test/unit/include/common index ba8aa71632f..2e2141ee1b6 100644 --- a/test/unit/include/common +++ b/test/unit/include/common @@ -2,8 +2,10 @@ DB_ALL_MOD="acc|alias_db|auth_db|avpops|dialog|dialplan|dispatcher|domain|domainpolicy|group|imc|lcr|msilo|siptrace|speeddial|uri_db|usrloc|permissions|pdt|userblacklist" # root directory relative to tests RUN_DIR="." -SRC_DIR="../.." -CTL_DIR="$SRC_DIR/utils/kamctl" +TOP_DIR="../.." +SRC_DIR="${TOP_DIR}/src" +MOD_DIR="${SRC_DIR}/modules" +CTL_DIR="${TOP_DIR}/utils/kamctl" CTLRC="$CTL_DIR/kamctlrc" CTL="$CTL_DIR/kamctl" DBCTL="$CTL_DIR/kamdbctl" @@ -19,7 +21,10 @@ else echo "WARNING Binary not found!" fi fi -KILL="killall -15 $BNAME" PIDFILE="${RUN_DIR}/kamailio.pid" # test directory relative to root TEST_DIR="test/unit" + +kill_kamailio() { + kill $(cat ${PIDFILE}) +} diff --git a/test/unit/include/database.sh b/test/unit/include/database.sh new file mode 100644 index 00000000000..c78c62bd7f6 --- /dev/null +++ b/test/unit/include/database.sh @@ -0,0 +1,72 @@ +# Copyright (C) 2017 mslehto@iki.fi +# Copyright (C) 2008 1&1 Internet AG +# +# This file is part of kamailio, a free SIP server. +# +# kamailio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version +# +# kamailio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +. include/common +KAMUSER="kamailio" +MYSQL="mysql kamailio --show-warnings --batch --user="${KAMUSER}" --password=kamailiorw -e" + +export PGPASSWORD="kamailiorw" +PSQL="psql -A -t -n -q -h localhost -U kamailio kamailio -c" + +ISQL="isql -b -v -d0x0 kamailio kamailio kamailiorw" + +check_mysql() { + $MYSQL "select * from location;" > /dev/null + if ! [ "$?" -eq 0 ] ; then + echo "can't read from database" + return 1 + fi; + $MYSQL "insert into location (user_agent) values ('___test___');" > /dev/null + if ! [ "$?" -eq 0 ] ; then + echo "can't write to database" + return 1 + fi; + $MYSQL "delete from location where user_agent ='___test___';" > /dev/null + return 0 +} + +check_postgres() { + $PSQL "select * from location;" > /dev/null + if ! [ "$?" -eq 0 ] ; then + echo "can't read from database" + return 1 + fi; + $PSQL "insert into location (user_agent) values ('___test___');" > /dev/null + if ! [ "$?" -eq 0 ] ; then + echo "can't write to database" + return 1 + fi; + $PSQL "delete from location where user_agent ='___test___';" > /dev/null + return 0 +} + +check_unixodbc() { + echo "select * from location;" | $ISQL > /dev/null + if ! [ "$?" -eq 0 ] ; then + echo "can't read from database" + return 1 + fi; + echo "insert into location (id, user_agent) values ('$RANDOM', '___test___');" | $ISQL > /dev/null + if ! [ "$?" -eq 0 ] ; then + echo "can't write to database" + return 1 + fi; + echo "delete from location where user_agent ='___test___';" | $ISQL > /dev/null + return 0 +} diff --git a/test/unit/include/require.sh b/test/unit/include/require.sh index c7642bbbbb0..07d800c75fe 100644 --- a/test/unit/include/require.sh +++ b/test/unit/include/require.sh @@ -1,5 +1,5 @@ +# Copyright (C) 2017 Mikko Lehto # Copyright (C) 2008 1&1 Internet AG -# Copyright (C) 2016 Mikko Lehto # # This file is part of kamailio, a free SIP server. # @@ -64,6 +64,3 @@ check_sipsak() { return 0 } -kill_kamailio() { - kill $(cat ${PIDFILE}) -} diff --git a/test/unit/presence.cfg b/test/unit/presence.cfg index 91cc344f665..299a4bfd297 100644 --- a/test/unit/presence.cfg +++ b/test/unit/presence.cfg @@ -19,9 +19,6 @@ rev_dns=no # ------------------ module loading ---------------------------------- -#set module path -mpath="../../modules/" - loadmodule "db_mysql/db_mysql.so" loadmodule "sl/sl.so" loadmodule "maxfwd/maxfwd.so"