[SR-Dev] git:master: test: port all registrar based tests (mysql, postgres, unixodbc ) to sr

Henning Westerholt henning.westerholt at 1und1.de
Wed May 6 18:56:31 CEST 2009


Module: sip-router
Branch: master
Commit: 582d58306bbd4ce00a24f37099fff14aaaef87f0
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=582d58306bbd4ce00a24f37099fff14aaaef87f0

Author: Henning Westerholt <henning.westerholt at 1und1.de>
Committer: Henning Westerholt <henning.westerholt at 1und1.de>
Date:   Wed May  6 18:55:33 2009 +0200

test: port all registrar based tests (mysql, postgres, unixodbc) to sr

---

 test/unit/11.cfg |   24 ++++++++++++------------
 test/unit/11.sh  |   16 ++++++----------
 test/unit/22.sh  |   15 ++++++---------
 test/unit/31.sh  |    4 ++--
 test/unit/39.sh  |    4 ++--
 test/unit/44.sh  |   15 ++++++---------
 6 files changed, 34 insertions(+), 44 deletions(-)

diff --git a/test/unit/11.cfg b/test/unit/11.cfg
index 73f10fb..314bccb 100644
--- a/test/unit/11.cfg
+++ b/test/unit/11.cfg
@@ -1,26 +1,26 @@
 # ----------- global configuration parameters ------------------------
-debug=3
+debug=2
 fork=yes
 log_stderror=no
 children=1
 disable_tcp=yes
 
 # ------------------ module loading ----------------------------------
-mpath="../modules/"
-loadmodule "sl/sl.so"
-loadmodule "tm/tm.so"
-loadmodule "rr/rr.so"
-loadmodule "maxfwd/maxfwd.so"
-loadmodule "textops/textops.so"
-loadmodule "xlog/xlog.so"
-loadmodule "pv/pv.so"
-loadmodule "mi_fifo/mi_fifo.so"
+loadpath "../../modules_k/"
+loadmodule "sl"
+loadmodule "../../modules/tm/tm.so"
+loadmodule "rr"
+loadmodule "maxfwd"
+loadmodule "textops"
+loadmodule "xlog"
+loadmodule "pv"
+loadmodule "mi_fifo"
 modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
 
-loadmodule "usrloc/usrloc.so"
+loadmodule "usrloc"
 modparam("usrloc", "db_mode", 1)
 
-loadmodule "registrar/registrar.so"
+loadmodule "registrar"
 modparam("registrar", "reg_callid_avp", "$avp(s:foobar)")
 modparam("registrar", "min_expires", 5)
 modparam("usrloc", "timer_interval", 2)
diff --git a/test/unit/11.sh b/test/unit/11.sh
index 1e065c8..8902e5c 100755
--- a/test/unit/11.sh
+++ b/test/unit/11.sh
@@ -31,9 +31,9 @@ fi ;
 
 cp $CFG $CFG.bak
 
-echo "loadmodule \"db_mysql/db_mysql.so\"" >> $CFG
+echo "loadmodule \"$SR_DIR/modules/db_mysql/db_mysql.so\"" >> $CFG
 
-../$BIN -w . -f $CFG > /dev/null
+$BIN -w . -f $CFG > /dev/null
 ret=$?
 
 sleep 1
@@ -43,10 +43,8 @@ sipsak -U -C sip:foobar at localhost -s sip:49721123456789 at localhost -H localhost &
 sipsak -U -C sip:foobar1 at localhost -s sip:49721123456789 at localhost -H localhost &> /dev/null
 ret=$?
 
-cd ../scripts
-
 if [ "$ret" -eq 0 ]; then
-	./$CTL ul show | grep "AOR:: 49721123456789" &> /dev/null
+	$CTL ul show | grep "AOR:: 49721123456789" &> /dev/null
 	ret=$?
 fi;
 
@@ -106,7 +104,7 @@ if [ "$ret" -eq 0 ]; then
 fi;
 
 if [ "$ret" -eq 0 ]; then
-	./$CTL ul show | grep "AOR:: 49721123456789" > /dev/null
+	$CTL ul show | grep "AOR:: 49721123456789" > /dev/null
 	ret=$?
 	if [ "$ret" -eq 0 ]; then
 		ret=1
@@ -160,7 +158,7 @@ fi;
 $KILL
 
 # restart to test preload_udomain functionality
-../$BIN -w . -f ../test/$CFG > /dev/null
+$BIN -w . -f $CFG > /dev/null
 ret=$?
 
 sleep 1
@@ -173,7 +171,7 @@ fi;
 
 # check if the methods value is correct
 if [ "$ret" -eq 0 ]; then
-	./$CTL ul show | grep "Methods:: 4294967295" &> /dev/null
+	$CTL ul show | grep "Methods:: 4294967295" &> /dev/null
 	ret=$?
 fi;
 
@@ -182,8 +180,6 @@ $MYSQL "delete from location where username like '49721123456789%';"
 
 $KILL
 
-cd ../test
-
 mv $CFG.bak $CFG
 
 exit $ret
\ No newline at end of file
diff --git a/test/unit/22.sh b/test/unit/22.sh
index 46ea775..aa990b2 100755
--- a/test/unit/22.sh
+++ b/test/unit/22.sh
@@ -30,10 +30,10 @@ fi ;
 CFG=11.cfg
 
 cp $CFG $CFG.tmp
-echo "loadmodule \"db_postgres/db_postgres.so\"" >> $CFG
+echo "loadmodule \"$SR_DIR/modules/db_postgres/db_postgres.so\"" >> $CFG
 echo "modparam(\"usrloc\", \"db_url\", \"postgres://openser:openserrw@localhost/openser\")" >> $CFG
 
-../$BIN -w . -f $CFG > /dev/null
+$BIN -w . -f $CFG > /dev/null
 ret=$?
 
 sleep 1
@@ -41,10 +41,8 @@ sleep 1
 sipsak -U -C sip:foobar at localhost -s sip:49721123456789 at localhost -H localhost &> /dev/null
 ret=$?
 
-cd ../scripts
-
 if [ "$ret" -eq 0 ]; then
-	./$CTL ul show | grep "AOR:: 49721123456789" > /dev/null
+	$CTL ul show | grep "AOR:: 49721123456789" > /dev/null
 	ret=$?
 fi;
 
@@ -61,7 +59,7 @@ if [ "$ret" -eq 0 ]; then
 fi;
 
 if [ "$ret" -eq 0 ]; then
-	./$CTL ul show | grep "AOR:: 49721123456789" > /dev/null
+	$CTL ul show | grep "AOR:: 49721123456789" > /dev/null
 	ret=$?
 	if [ "$ret" -eq 0 ]; then
 		ret=1
@@ -85,7 +83,7 @@ fi;
 $KILL
 
 # restart to test preload_udomain functionality
-../$BIN -w . -f ../test/$CFG > /dev/null
+$BIN -w . -f $CFG > /dev/null
 ret=$?
 
 sleep 1
@@ -98,7 +96,7 @@ fi;
 
 # check if the methods value is correct
 if [ "$ret" -eq 0 ]; then
-	./$CTL ul show | grep "Methods:: 4294967295" &> /dev/null
+	$CTL ul show | grep "Methods:: 4294967295" &> /dev/null
 	ret=$?
 fi;
 
@@ -106,7 +104,6 @@ $KILL
 
 $PSQL "delete from location where username like '49721123456789%';"
 
-cd ../test
 mv $CFG.tmp $CFG
 
 exit $ret
diff --git a/test/unit/31.sh b/test/unit/31.sh
index 45cd5e5..5673d14 100755
--- a/test/unit/31.sh
+++ b/test/unit/31.sh
@@ -35,7 +35,7 @@ NR=50
 
 cp $CFG $CFG.bak
 
-echo "loadmodule \"db_mysql/db_mysql.so\"" >> $CFG
+echo "loadmodule \"$SR_DIR/modules/db_mysql/db_mysql.so\"" >> $CFG
 echo "modparam(\"usrloc\", \"fetch_rows\", 13)" >> $CFG
 
 COUNTER=0
@@ -44,7 +44,7 @@ while [  $COUNTER -lt $NR ]; do
 	$MYSQL "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 -w . -f $CFG > /dev/null
 ret=$?
 
 sleep 1
diff --git a/test/unit/39.sh b/test/unit/39.sh
index 385edf5..d14cfff 100755
--- a/test/unit/39.sh
+++ b/test/unit/39.sh
@@ -36,7 +36,7 @@ NR=25
 
 cp $CFG $CFG.bak
 
-echo "loadmodule \"db_unixodbc/db_unixodbc.so\"" >> $CFG
+echo "loadmodule \"$SR_DIR/modules_k/db_unixodbc/db_unixodbc.so\"" >> $CFG
 echo "modparam(\"usrloc\", \"db_url\", \"unixodbc://openser:openserrw@localhost/openser\")" >> $CFG
 echo "modparam(\"usrloc\", \"fetch_rows\", 13)" >> $CFG
 
@@ -49,7 +49,7 @@ while [  $COUNTER -lt $NR ]; do
 	CNT=$(($CNT+10))
 done
 
-../$BIN -w . -f $CFG > /dev/null
+$BIN -w . -f $CFG > /dev/null
 ret=$?
 
 sleep 2
diff --git a/test/unit/44.sh b/test/unit/44.sh
index e9f31f5..e148212 100755
--- a/test/unit/44.sh
+++ b/test/unit/44.sh
@@ -30,10 +30,10 @@ fi ;
 CFG=11.cfg
 
 cp $CFG $CFG.tmp
-echo "loadmodule \"db_unixodbc/db_unixodbc.so\"" >> $CFG
+echo "loadmodule \"$SR_DIR/modules_k/db_unixodbc/db_unixodbc.so\"" >> $CFG
 echo "modparam(\"usrloc\", \"db_url\", \"unixodbc://openser:openserrw@localhost/openser\")" >> $CFG
 
-../$BIN -w . -f $CFG > /dev/null
+$BIN -w . -f $CFG > /dev/null
 ret=$?
 
 sleep 1
@@ -41,10 +41,8 @@ sleep 1
 sipsak -U -C sip:foobar at localhost -s sip:49721123456789 at localhost -H localhost &> /dev/null
 ret=$?
 
-cd ../scripts
-
 if [ "$ret" -eq 0 ]; then
-	./$CTL ul show | grep "AOR:: 49721123456789" > /dev/null
+	$CTL ul show | grep "AOR:: 49721123456789" > /dev/null
 	ret=$?
 fi;
 
@@ -61,7 +59,7 @@ if [ "$ret" -eq 0 ]; then
 fi;
 
 if [ "$ret" -eq 0 ]; then
-	./$CTL ul show | grep "AOR:: 49721123456789" > /dev/null
+	$CTL ul show | grep "AOR:: 49721123456789" > /dev/null
 	ret=$?
 	if [ "$ret" -eq 0 ]; then
 		ret=1
@@ -85,7 +83,7 @@ fi;
 $KILL
 
 # restart to test preload_udomain functionality
-../$BIN -w . -f ../test/$CFG > /dev/null
+$BIN -w . -f $CFG > /dev/null
 ret=$?
 
 sleep 1
@@ -98,7 +96,7 @@ fi;
 
 # check if the methods value is correct
 if [ "$ret" -eq 0 ]; then
-	./$CTL ul show | grep "Methods:: 4294967295" &> /dev/null
+	$CTL ul show | grep "Methods:: 4294967295" &> /dev/null
 	ret=$?
 fi;
 
@@ -106,7 +104,6 @@ $KILL
 
 echo "delete from location where username like '49721123456789%';" | $ISQL
 
-cd ../test
 mv $CFG.tmp $CFG
 
 exit $ret




More information about the sr-dev mailing list