[sr-dev] git:master: test/unit: use SRC_DIR to point to kamailio source and updated tests 4, 5, 6
Daniel-Constantin Mierla
miconda at gmail.com
Wed Oct 1 16:57:45 CEST 2014
Module: sip-router
Branch: master
Commit: 4bfc11009df67de7584cd1634997a86ad023322c
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4bfc11009df67de7584cd1634997a86ad023322c
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: Wed Oct 1 16:52:41 2014 +0200
test/unit: use SRC_DIR to point to kamailio source and updated tests 4, 5, 6
---
test/unit/2.sh | 4 ++--
test/unit/22.sh | 2 +-
test/unit/31.sh | 2 +-
test/unit/39.sh | 2 +-
test/unit/4.sh | 8 ++++----
test/unit/44.sh | 2 +-
test/unit/5.sh | 6 +++---
test/unit/6.sh | 11 +++--------
test/unit/include/common | 14 +++++++-------
test/unit/include/require | 4 ++--
test/unit/route-empty.cfg | 3 +++
11 files changed, 28 insertions(+), 30 deletions(-)
diff --git a/test/unit/2.sh b/test/unit/2.sh
index 4301aa2..71ba85d 100755
--- a/test/unit/2.sh
+++ b/test/unit/2.sh
@@ -35,8 +35,8 @@ cp $CFG $CFG.bak
touch dispatcher.list
-echo "loadmodule \"$SR_DIR/modules/db_mysql/db_mysql.so\"" >> $CFG
-echo "modparam(\"dispatcher\", \"list_file\", \"$SR_DIR/$TEST_DIR/dispatcher.list\")" >> $CFG
+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
# start
diff --git a/test/unit/22.sh b/test/unit/22.sh
index 8775e48..3945feb 100755
--- a/test/unit/22.sh
+++ b/test/unit/22.sh
@@ -30,7 +30,7 @@ fi ;
CFG=11.cfg
cp $CFG $CFG.tmp
-echo "loadmodule \"$SR_DIR/modules/db_postgres/db_postgres.so\"" >> $CFG
+echo "loadmodule \"$SRC_DIR/modules/db_postgres/db_postgres.so\"" >> $CFG
echo "modparam(\"usrloc\", \"db_url\", \"postgres://kamailio:kamailiorw@localhost/kamailio\")" >> $CFG
$BIN -w . -f $CFG > /dev/null
diff --git a/test/unit/31.sh b/test/unit/31.sh
index 5673d14..7b6d9f1 100755
--- a/test/unit/31.sh
+++ b/test/unit/31.sh
@@ -35,7 +35,7 @@ NR=50
cp $CFG $CFG.bak
-echo "loadmodule \"$SR_DIR/modules/db_mysql/db_mysql.so\"" >> $CFG
+echo "loadmodule \"$SRC_DIR/modules/db_mysql/db_mysql.so\"" >> $CFG
echo "modparam(\"usrloc\", \"fetch_rows\", 13)" >> $CFG
COUNTER=0
diff --git a/test/unit/39.sh b/test/unit/39.sh
index 5b4d906..9a3757a 100755
--- a/test/unit/39.sh
+++ b/test/unit/39.sh
@@ -36,7 +36,7 @@ NR=25
cp $CFG $CFG.bak
-echo "loadmodule \"$SR_DIR/modules/db_unixodbc/db_unixodbc.so\"" >> $CFG
+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
diff --git a/test/unit/4.sh b/test/unit/4.sh
index 4901115..452249e 100755
--- a/test/unit/4.sh
+++ b/test/unit/4.sh
@@ -29,10 +29,10 @@ if ! (check_kamailio); then
fi ;
# setup config
-echo -e "loadmodule \"$SR_DIR/modules/mi_fifo/mi_fifo.so\"" > $CFG
-echo -e "loadmodule \"$SR_DIR/modules/kex/kex.so\"" >> $CFG
+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
$BIN -w . -f $CFG > /dev/null
@@ -48,4 +48,4 @@ $KILL
rm -f $CFG
-exit $ret
\ No newline at end of file
+exit $ret
diff --git a/test/unit/44.sh b/test/unit/44.sh
index c8f0215..0bb4083 100755
--- a/test/unit/44.sh
+++ b/test/unit/44.sh
@@ -30,7 +30,7 @@ fi ;
CFG=11.cfg
cp $CFG $CFG.tmp
-echo "loadmodule \"$SR_DIR/modules/db_unixodbc/db_unixodbc.so\"" >> $CFG
+echo "loadmodule \"$SRC_DIR/modules/db_unixodbc/db_unixodbc.so\"" >> $CFG
echo "modparam(\"usrloc\", \"db_url\", \"unixodbc://kamailio:kamailiorw@localhost/kamailio\")" >> $CFG
$BIN -w . -f $CFG > /dev/null
diff --git a/test/unit/5.sh b/test/unit/5.sh
index 47412c1..0554ae2 100755
--- a/test/unit/5.sh
+++ b/test/unit/5.sh
@@ -24,7 +24,7 @@
source include/common
source include/require
-CFG=5.cfg
+CFG=$SRC_DIR/etc/kamailio.cfg
if ! (check_kamailio); then
exit 0
@@ -32,10 +32,10 @@ fi ;
# start
-$BIN -w . -f $CFG &> /dev/null
+$BIN -w . -L $SRC_DIR/modules/ -f $CFG -A WITH_SRCPATH -a no > /dev/null 2>&1
ret=$?
sleep 1
$KILL
-exit $ret
\ No newline at end of file
+exit $ret
diff --git a/test/unit/6.sh b/test/unit/6.sh
index 68afccf..a89284d 100755
--- a/test/unit/6.sh
+++ b/test/unit/6.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# checks a configuration with 'kamailio -c' and 'kamailio -C'
+# checks a specific configuration with 'kamailio -c'
# Copyright (C) 2007 1&1 Internet AG
#
@@ -29,12 +29,7 @@ if ! (check_kamailio); then
fi ;
# start
-../$BIN -w . -c -f $CFG > /dev/null 2>&1
+cat $CFG | cat - route-empty.cfg | $BIN -w . -a no -c -f - > /dev/null 2>&1
ret=$?
-if [ "$ret" -eq 0 ] ; then
- ../$BIN -C -f $CFG > /dev/null 2>&1
- ret=$?
-fi ;
-
-exit $ret
\ No newline at end of file
+exit $ret
diff --git a/test/unit/include/common b/test/unit/include/common
index cab5637..2459843 100644
--- a/test/unit/include/common
+++ b/test/unit/include/common
@@ -1,18 +1,18 @@
# all database modules
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
-SR_DIR="../.."
-CTL_DIR="$SR_DIR/utils/kamctl"
+SRC_DIR="../.."
+CTL_DIR="$SRC_DIR/utils/kamctl"
CTLRC="$CTL_DIR/kamctlrc"
CTL="$CTL_DIR/kamctl"
DBCTL="$CTL_DIR/kamdbctl"
-BIN="$SR_DIR/ser"
-if [ -f $SR_DIR/kamailio ] ; then
- BIN="$SR_DIR/kamailio"
+BIN="$SRC_DIR/kamailio"
+if [ -f $SRC_DIR/kamailio ] ; then
+ BIN="$SRC_DIR/kamailio"
BNAME="kamailio"
else
- if [ -f $SR_DIR/ser ] ; then
- BIN="$SR_DIR/ser"
+ if [ -f $SRC_DIR/ser ] ; then
+ BIN="$SRC_DIR/ser"
BNAME="ser"
else
echo "WARNING Binary not found!"
diff --git a/test/unit/include/require b/test/unit/include/require
index b6163b9..825dfd7 100644
--- a/test/unit/include/require
+++ b/test/unit/include/require
@@ -32,8 +32,8 @@ function check_module() {
return 1
fi
- if ! (test -e $SR_DIR/modules/$1/$1.so) ; then
- echo "$SR_DIR/modules/$1/$1.so not found, not run"
+ if ! (test -e $SRC_DIR/modules/$1/$1.so) ; then
+ echo "$SRC_DIR/modules/$1/$1.so not found, not run"
return 1
fi;
return 0
diff --git a/test/unit/route-empty.cfg b/test/unit/route-empty.cfg
new file mode 100644
index 0000000..2ac3275
--- /dev/null
+++ b/test/unit/route-empty.cfg
@@ -0,0 +1,3 @@
+request_route {
+ ;
+}
More information about the sr-dev
mailing list