Module: kamailio Branch: master Commit: 3dff189e33dd74010a4112274868696d1e73f9d6 URL: https://github.com/kamailio/kamailio/commit/3dff189e33dd74010a4112274868696d...
Author: Mikko Lehto mslehto@iki.fi Committer: Mikko Lehto mslehto@iki.fi Date: 2017-01-11T01:44:12+02:00
test/unit: fix unit test 33
- mi_fifo is gone, use jsonrpcs - FreeBSD has different file name for core dump, try to detect - netcat option -q is Debian specific patch - sh instead of bash
---
Modified: test/unit/33.cfg Modified: test/unit/33.sh Modified: test/unit/include/common
---
Diff: https://github.com/kamailio/kamailio/commit/3dff189e33dd74010a4112274868696d... Patch: https://github.com/kamailio/kamailio/commit/3dff189e33dd74010a4112274868696d...
---
diff --git a/test/unit/33.cfg b/test/unit/33.cfg index 3f0dfab..b34b07d 100644 --- a/test/unit/33.cfg +++ b/test/unit/33.cfg @@ -1,11 +1,12 @@ debug=3 -memlog=2 +#memlog=2 loadmodule "cfgutils.so" loadmodule "pv.so" loadmodule "xlog.so" -loadmodule "mi_fifo/mi_fifo.so" +loadmodule "jsonrpcs.so"
-modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo") +modparam("jsonrpcs", "transport", 2) +modparam("jsonrpcs", "fifo_name", "kamailio_rpc.fifo")
modparam("cfgutils", "initial_probability", 15) modparam("cfgutils", "hash_file", "33.cfg") diff --git a/test/unit/33.sh b/test/unit/33.sh index 58cc5c3..ea6de3d 100755 --- a/test/unit/33.sh +++ b/test/unit/33.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # test cfgutils and pv module
# Copyright (C) 2008 1&1 Internet AG @@ -19,20 +19,35 @@ # 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_netcat && check_kamailio); then exit 0 fi;
-if [ -e core ] ; then - echo "core file found, not run" - exit 0 +if ( have_netcat_quit_timer_patch ); then + NCOPTS='-q 1' +else + NCOPTS='-w 2' fi;
CFG=33.cfg
+CORE=$(sysctl kern.corefile 2> /dev/null) +echo $CORE | grep '^kern.corefile: %N.core' > /dev/null +ret=$? +if [ $ret -eq 0 ] ; then + CORE='kamailio.core' +else + CORE='core' +fi + +if [ -e $CORE ] ; then + echo "core file found, not run" + exit 0 +fi; + cp $CFG $CFG.bak
ulimit -c unlimited @@ -43,23 +58,24 @@ ret=$? sleep 1
if [ $ret -eq 0 ] ; then - $CTL mi check_config_hash | grep "The actual config file hash is identical to the stored one." >/dev/null + $CTL rpc cfgutils.check_config_hash | grep '"result":"Identical hash"' > /dev/null ret=$? fi;
echo " " >> $CFG + if [ $ret -eq 0 ] ; then - $CTL mi check_config_hash | grep "The actual config file hash is identical to the stored one." >/dev/null + $CTL rpc cfgutils.check_config_hash | grep '"result":"Identical hash"' > /dev/null ret=$? fi
if [ ! $ret -eq 0 ] ; then # send a message - cat register.sip | nc -q 1 -u 127.0.0.1 5060 > /dev/null + cat register.sip | nc $NCOPTS -u 127.0.0.1 5060 > /dev/null fi
sleep 1 -kill_kamailio +kill_kamailio 2> /dev/null ret=$?
if [ $ret -eq 0 ] ; then @@ -68,10 +84,10 @@ else ret=0 fi
-if [ ! -e core ] ; then +if [ ! -e $CORE ] ; then ret=1 fi -rm -f core +rm -f $CORE mv $CFG.bak $CFG
exit $ret diff --git a/test/unit/include/common b/test/unit/include/common index 2e2141e..b52457f 100644 --- a/test/unit/include/common +++ b/test/unit/include/common @@ -28,3 +28,10 @@ TEST_DIR="test/unit" kill_kamailio() { kill $(cat ${PIDFILE}) } + +export RPCFIFOPATH="${RUN_DIR}/kamailio_rpc.fifo" + +have_netcat_quit_timer_patch() { + nc -q 2>&1 | grep 'option requires an argument' > /dev/null + return $? +}