Răsfoiți Sursa

- add a test that checks for a certain out of memory condition in avpops in
PKG_MEM, related to bug #2229966 (test fails, as this is not fixed yet)


git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5186 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt 17 ani în urmă
părinte
comite
7bd6577bb2
2 a modificat fișierele cu 99 adăugiri și 0 ștergeri
  1. 43 0
      test/unit/41.cfg
  2. 56 0
      test/unit/41.sh

+ 43 - 0
test/unit/41.cfg

@@ -0,0 +1,43 @@
+memlog=2
+debug=1
+children=1
+mpath="../modules"
+
+loadmodule "sl/sl.so"
+loadmodule "tm/tm.so"
+loadmodule "db_mysql/db_mysql.so"
+loadmodule "usrloc/usrloc.so"
+loadmodule "registrar/registrar.so"
+loadmodule "avpops/avpops.so"
+loadmodule "mi_fifo/mi_fifo.so"
+loadmodule "xlog/xlog.so"
+
+modparam("usrloc", "db_mode", 3)
+modparam("usrloc|avpops", "db_url", "mysql://openser:openserrw@localhost/openser")
+
+modparam("avpops","avp_table","usr_preferences")
+modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
+
+route{
+	$avp(s:10) = "foobar";
+	if (!avp_db_load("$avp(s:10)", "$avp(s:679)")) {
+		xlog("avp_db_load failed");
+		sl_reply_error();
+		exit;
+	}
+	
+	$avp(s:679) = "blafasel";
+	if (!avp_db_store("$avp(s:10)", "$avp(s:679)")) {
+		xlog("avp_db_store failed");
+		sl_reply_error();
+		exit;
+	}
+
+	if(!lookup ("location")){
+		sl_send_reply("404", "Not Found");
+	}
+
+	if (!t_relay()) {
+		sl_reply_error();
+	}
+}

+ 56 - 0
test/unit/41.sh

@@ -0,0 +1,56 @@
+#!/bin/bash
+# test one out of PKG_MEM condition with avpops module
+
+# Copyright (C) 2008 1&1 Internet AG
+#
+# This file is part of Kamailio, a free SIP server.
+#
+# Kamailio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version
+#
+# Kamailio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+
+# Needs a default kamailio database setup for mysql
+
+source include/common
+source include/database
+
+CFG=41.cfg
+SRV=5060
+UAS=5070
+UAC=5080
+
+NR=200
+RT=50
+
+# add an registrar entry to the db;
+$MYSQL "INSERT INTO location (username,contact,socket,user_agent,cseq,q) VALUES (\"foo\",\"sip:foo@localhost:$UAS\",\"udp:127.0.0.1:$UAS\",\"ser_test\",1,-1);"
+
+$MYSQL "INSERT INTO usr_preferences (uuid, attribute, type, value) VALUES (\"foobar\", \"679\", 0, \"foobar!!!!!\");"
+
+# start
+../$BIN -w . -f $CFG &> /dev/null
+ret=$?
+
+if [ "$ret" -eq 0 ]; then
+	sipp -sn uas -bg -i localhost -m $NR -r $RT -p $UAS &> /dev/null
+	sipp -sn uac -s foo 127.0.0.1:$SRV -r $RT -i localhost -m $NR -p $UAC &> /dev/null
+	ret=$?
+fi;
+
+sleep 1
+$KILL
+killall -9 sipp > /dev/null 2>&1
+
+$MYSQL "DELETE FROM location WHERE ((contact = \"sip:foo@localhost:$UAS\") and (user_agent = \"ser_test\"));"
+$MYSQL "DELETE FROM usr_preferences;"
+exit $ret