Module: kamailio
Branch: master
Commit: 0cea8fe1029c71644879e599c11aebc590139cca
URL:
https://github.com/kamailio/kamailio/commit/0cea8fe1029c71644879e599c11aebc…
Author: Mikko Lehto <mslehto(a)iki.fi>
Committer: Mikko Lehto <mslehto(a)iki.fi>
Date: 2017-01-11T01:44:31+02:00
test/unit: update unit test 12
- sh instead of bash
- mi_fifo is gone, use jsonrpcs
- detect Debian specific netcat option -q
---
Modified: test/unit/12.cfg
Modified: test/unit/12.sh
---
Diff:
https://github.com/kamailio/kamailio/commit/0cea8fe1029c71644879e599c11aebc…
Patch:
https://github.com/kamailio/kamailio/commit/0cea8fe1029c71644879e599c11aebc…
---
diff --git a/test/unit/12.cfg b/test/unit/12.cfg
index e593d95..7560b6e 100644
--- a/test/unit/12.cfg
+++ b/test/unit/12.cfg
@@ -10,8 +10,9 @@ loadmodule "xlog"
loadmodule "usrloc"
loadmodule "registrar"
loadmodule "pv"
-loadmodule "mi_fifo"
-modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
+loadmodule "jsonrpcs"
+modparam("jsonrpcs", "transport", 2)
+modparam("jsonrpcs", "fifo_name", "kamailio_rpc.fifo")
request_route {
xlog("received by kamailio[$pp] at '$Tf' from $si:$sp, method:
$(rm{s.tolower}), transport: $rP:$Ri:$rp, user agent: $ua\n");
diff --git a/test/unit/12.sh b/test/unit/12.sh
index 78f8084..adde1d7 100755
--- a/test/unit/12.sh
+++ b/test/unit/12.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# configuration with pseudo-variables, transformations and xlog output
# Copyright (C) 2007 1&1 Internet AG
@@ -29,24 +29,28 @@ if ! (check_netcat && check_kamailio); then
exit 0
fi ;
-$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG &> $TMPFILE
+$BIN -L $MOD_DIR -Y $RUN_DIR -P $PIDFILE -w . -f $CFG -a no > $TMPFILE 2>&1
ret=$?
-sleep 1
+if ( have_netcat_quit_timer_patch ); then
+ NCOPTS='-q 1'
+else
+ NCOPTS='-w 1'
+fi
+sleep 1
if [ "$ret" -eq 0 ] ; then
# register a user
- cat register.sip | nc -q 1 -u localhost 5060 > /dev/null
- $CTL ul show | grep "AOR:: 1000" > /dev/null
+ cat register.sip | nc $NCOPTS -u localhost 5060 > /dev/null
+ $CTL ul show | grep '"AoR":"1000"' > /dev/null
ret=$?
# unregister the user
- cat unregister.sip | nc -q 1 -u localhost 5060 > /dev/null
+ cat unregister.sip | nc $NCOPTS -u localhost 5060 > /dev/null
fi ;
-
if [ "$ret" -eq 0 ] ; then
- $CTL ul show | grep "AOR:: 1000" > /dev/null
+ $CTL ul show | grep '"AoR":"1000"' > /dev/null
ret=$?
if [ "$ret" -eq 0 ] ; then
ret=1
@@ -83,7 +87,7 @@ if [ "$ret" -eq 0 ] ; then
fi ;
fi ;
fi ;
-cat $TMPFILE
+
kill_kamailio
rm $TMPFILE