r80 - in regression_tests/tests: . 2021_simplestack_leak
2021_simplestack_leak/expected_output
erik at minisip.org
erik at minisip.org
Mon Jan 22 14:40:25 CET 2007
Author: erik
Date: 2007-01-22 14:40:24 +0100 (Mon, 22 Jan 2007)
New Revision: 80
Added:
regression_tests/tests/2021_simplestack_leak/
regression_tests/tests/2021_simplestack_leak/Makefile
regression_tests/tests/2021_simplestack_leak/expected_output/
regression_tests/tests/2021_simplestack_leak/expected_output/expected_output
regression_tests/tests/2021_simplestack_leak/test.sh
regression_tests/tests/2021_simplestack_leak/tst.cxx
Log:
* Added MObject leak test.
This one should be a good tool to detect memory leaks in
the SIP stack (such as if a reference loop is created).
The test creates and starts a SipStack ten times, and then
checks what memory objects are still on the heap. We expect
that there will be none.
(A round in the loop in the test app takes about 5 seconds
since that is the time it takes to stop a SipSocketServer.
The test therefore takes about a minute to complete.)
Added: regression_tests/tests/2021_simplestack_leak/Makefile
===================================================================
--- regression_tests/tests/2021_simplestack_leak/Makefile 2007-01-09 10:57:12 UTC (rev 79)
+++ regression_tests/tests/2021_simplestack_leak/Makefile 2007-01-22 13:40:24 UTC (rev 80)
@@ -0,0 +1,4 @@
+tst: tst.cxx /home/erik/include/libmsip/SipHeader.h /home/erik/include/libmutil/TimeoutProvider.h
+ g++-3.4 -Wall -g -o tst $(CPP_FLAGS) $(LD_FLAGS) tst.cxx -lmsip -lpthread -lssl
+clean:
+ rm -f build_output diff_output test_output tst ua
Added: regression_tests/tests/2021_simplestack_leak/expected_output/expected_output
===================================================================
--- regression_tests/tests/2021_simplestack_leak/expected_output/expected_output 2007-01-09 10:57:12 UTC (rev 79)
+++ regression_tests/tests/2021_simplestack_leak/expected_output/expected_output 2007-01-22 13:40:24 UTC (rev 80)
@@ -0,0 +1 @@
+nr objects: 0
Added: regression_tests/tests/2021_simplestack_leak/test.sh
===================================================================
--- regression_tests/tests/2021_simplestack_leak/test.sh 2007-01-09 10:57:12 UTC (rev 79)
+++ regression_tests/tests/2021_simplestack_leak/test.sh 2007-01-22 13:40:24 UTC (rev 80)
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+make > build_output 2>&1 || exit 2
+./tst > test_output 2>&1 || exit 3
+echo "EXPECTED VALUE OR TEST OUTPUT NOT FOUND!" > diff_output
+if [ -e expected_output/expected_output ] ; then
+ diff test_output expected_output/expected_output > diff_output ;
+else
+ echo "EXPECTED VALUE OR TEST OUTPUT NOT FOUND!" > diff_output ;
+fi
+exit 0
+
Property changes on: regression_tests/tests/2021_simplestack_leak/test.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: regression_tests/tests/2021_simplestack_leak/tst.cxx
===================================================================
--- regression_tests/tests/2021_simplestack_leak/tst.cxx 2007-01-09 10:57:12 UTC (rev 79)
+++ regression_tests/tests/2021_simplestack_leak/tst.cxx 2007-01-22 13:40:24 UTC (rev 80)
@@ -0,0 +1,29 @@
+
+/*
+Mobject leak test for the libmsip SIP stack
+(C) Erik Eliasson 2007
+*/
+
+#include<libmsip/SipStack.h>
+#include<iostream>
+
+using namespace std;
+
+int main(){
+ for (int i=0; i<10; i++){
+ MRef<SipStackConfig*> config = new SipStackConfig;
+ config->localUdpPort=5000;
+ MRef<SipStack*> s = new SipStack( config );
+ s->startUdpServer();
+ s->stopRunning();
+ }
+ sleep (6);
+ cout << "nr objects: "<< getMemObjectCount()<<endl;
+ minilist<std::string> o = getMemObjectNames();
+ for (int i=0; i< o.size(); i++){
+ cout << "object: "<< o[i]<<endl;
+ }
+
+ return 0;
+}
+
More information about the Minisip-devel
mailing list