浏览代码

test/unit: update unit test 12

- sh instead of bash
- mi_fifo is gone, use jsonrpcs
- detect Debian specific netcat option -q
Mikko Lehto 8 年之前
父节点
当前提交
0cea8fe102
共有 2 个文件被更改,包括 16 次插入11 次删除
  1. 3 2
      test/unit/12.cfg
  2. 13 9
      test/unit/12.sh

+ 3 - 2
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");

+ 13 - 9
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