r49 - in regression_tests/tests: 2010_Session_inviteab_hangupab 2011_Session_inviteab_hangupba 2011_Session_inviteab_hangupba/expected_output

erik at minisip.org erik at minisip.org
Wed Nov 22 16:51:24 CET 2006


Author: erik
Date: 2006-11-22 16:51:23 +0100 (Wed, 22 Nov 2006)
New Revision: 49

Modified:
   regression_tests/tests/2010_Session_inviteab_hangupab/test.sh
   regression_tests/tests/2011_Session_inviteab_hangupba/expected_output/expected_output
   regression_tests/tests/2011_Session_inviteab_hangupba/test.sh
Log:

 * Made the "ua" tests use random ports to minimize the risk that running
   multiple regression tests in parallell tries to use the same port



Modified: regression_tests/tests/2010_Session_inviteab_hangupab/test.sh
===================================================================
--- regression_tests/tests/2010_Session_inviteab_hangupab/test.sh	2006-11-22 14:23:31 UTC (rev 48)
+++ regression_tests/tests/2010_Session_inviteab_hangupab/test.sh	2006-11-22 15:51:23 UTC (rev 49)
@@ -2,18 +2,29 @@
 
 make > build_output 2>&1  || exit 2
 
+SPORT=$RANDOM
+while test $SPORT -le 1024 ; do SPORT=$RANDOM ; done
+CPORT=$RANDOM
+while test $CPORT -le 1024 ; do CPORT=$RANDOM ; done
+
+
 # set up server on port 40010, send it a sleep command
-echo sleep 100 | ../../common/ua/ua -p 40010 -u serveruser at domain.com > /dev/null 2>&1 &
+echo sleep 100 | ../../common/ua/ua -p $SPORT -u serveruser at domain.com > /dev/null 2>&1 &
 
 # regression test is done on clients output
-echo -e "sleep 1\ncall erik at localhost:40010\nsleep 2\nhangup\nsleep 3" |
-../../common/ua/ua -p 40020 -u clientuser at domain.com > test_output || exit 3
+echo -e "sleep 1\ncall erik at localhost:${SPORT}\nsleep 2\nhangup\nsleep 3" |
+../../common/ua/ua -p $CPORT -u clientuser at domain.com > test_output || exit 3
 
 # make output predictable - i.e. remove callid and branch strings (pseudo-random)
 sed -i "s/Call-ID:.*$/Call-ID: callidstring/" test_output
 sed -i "s/branch=.*$/branch=branchstring/" test_output
 sed -i "s/[0-9][0-9][0-9].[0-9][0-9][0-9].//" test_output    #remove timestamp at start of lines
+sed -i "s/:$SPORT/:SERVERPORT/" test_output
+sed -i "s/=$SPORT/:SERVERPORT/" test_output
+sed -i "s/:$CPORT/:CLIENTPORT/" test_output
+sed -i "s/=$CPORT/:CLIENTPORT/" test_output
 
+
 if [ -e expected_output/expected_output ] ; then
         diff test_output expected_output/expected_output > diff_output ;
 else

Modified: regression_tests/tests/2011_Session_inviteab_hangupba/expected_output/expected_output
===================================================================
--- regression_tests/tests/2011_Session_inviteab_hangupba/expected_output/expected_output	2006-11-22 14:23:31 UTC (rev 48)
+++ regression_tests/tests/2011_Session_inviteab_hangupba/expected_output/expected_output	2006-11-22 15:51:23 UTC (rev 49)
@@ -1,11 +1,11 @@
-OUT (UDP): INVITE sip:erik at localhost:40010 SIP/2.0
+OUT (UDP): INVITE sip:erik at localhost:SERVERPORT SIP/2.0
 OUT (UDP): Call-ID: callidstring
 OUT (UDP): Max-Forwards: 50
 OUT (UDP): From: <sip:clientuser at domain.com>
-OUT (UDP): To: <sip:erik at localhost:40010>
+OUT (UDP): To: <sip:erik at localhost:SERVERPORT>
 OUT (UDP): CSeq: 1 INVITE
-OUT (UDP): Contact: <sip:clientuser at 127.0.0.1:40020;transport=UDP>;expires=1000
-OUT (UDP): Via: SIP/2.0/UDP 127.0.0.1:40020;rport;branch=branchstring
+OUT (UDP): Contact: <sip:clientuser at 127.0.0.1:CLIENTPORT;transport=UDP>;expires=1000
+OUT (UDP): Via: SIP/2.0/UDP 127.0.0.1:CLIENTPORT;rport;branch=branchstring
 OUT (UDP): Content-Length: 0
 OUT (UDP): 
 OUT (UDP): 
@@ -13,39 +13,39 @@
 IN (UDP): Max-Forwards: 70
 IN (UDP): Call-ID: callidstring
 IN (UDP): From: <sip:clientuser at domain.com>
-IN (UDP): To: <sip:erik at localhost:40010>
+IN (UDP): To: <sip:erik at localhost:SERVERPORT>
 IN (UDP): CSeq: 1 INVITE
-IN (UDP): Via: SIP/2.0/UDP 127.0.0.1:40020;rport=40020;branch=branchstring
+IN (UDP): Via: SIP/2.0/UDP 127.0.0.1:CLIENTPORT;rport:CLIENTPORT;branch=branchstring
 IN (UDP): Content-Length: 0
 IN (UDP): 
 IN (UDP): 
-OUT (UDP): ACK sip:erik at localhost:40010 SIP/2.0
+OUT (UDP): ACK sip:erik at localhost:SERVERPORT SIP/2.0
 OUT (UDP): Max-Forwards: 70
 OUT (UDP): Call-ID: callidstring
 OUT (UDP): From: <sip:clientuser at domain.com>
 OUT (UDP): CSeq: 1 ACK
-OUT (UDP): To: <sip:erik at localhost:40010>
-OUT (UDP): Via: SIP/2.0/UDP 127.0.0.1:40020;rport;branch=branchstring
+OUT (UDP): To: <sip:erik at localhost:SERVERPORT>
+OUT (UDP): Via: SIP/2.0/UDP 127.0.0.1:CLIENTPORT;rport;branch=branchstring
 OUT (UDP): Content-Length: 0
 OUT (UDP): 
 OUT (UDP): 
-IN (UDP): BYE sip:clientuser at 127.0.0.1:40020 SIP/2.0
+IN (UDP): BYE sip:clientuser at 127.0.0.1:CLIENTPORT SIP/2.0
 IN (UDP): Max-Forwards: 70
-IN (UDP): From: <sip:erik at localhost:40010>
+IN (UDP): From: <sip:erik at localhost:SERVERPORT>
 IN (UDP): To: <sip:clientuser at domain.com>
 IN (UDP): CSeq: 800 BYE
 IN (UDP): Call-ID: callidstring
-IN (UDP): Via: SIP/2.0/UDP 127.0.0.1:40010;rport;branch=branchstring
+IN (UDP): Via: SIP/2.0/UDP 127.0.0.1:SERVERPORT;rport;branch=branchstring
 IN (UDP): Content-Length: 0
 IN (UDP): 
 IN (UDP): 
 OUT (UDP): SIP/2.0 200 ok
 OUT (UDP): Max-Forwards: 70
-OUT (UDP): From: <sip:erik at localhost:40010>
+OUT (UDP): From: <sip:erik at localhost:SERVERPORT>
 OUT (UDP): To: <sip:clientuser at domain.com>
 OUT (UDP): CSeq: 800 BYE
 OUT (UDP): Call-ID: callidstring
-OUT (UDP): Via: SIP/2.0/UDP 127.0.0.1:40010;rport=40010;branch=branchstring
+OUT (UDP): Via: SIP/2.0/UDP 127.0.0.1:SERVERPORT;rport:SERVERPORT;branch=branchstring
 OUT (UDP): Content-Length: 0
 OUT (UDP): 
 OUT (UDP): 

Modified: regression_tests/tests/2011_Session_inviteab_hangupba/test.sh
===================================================================
--- regression_tests/tests/2011_Session_inviteab_hangupba/test.sh	2006-11-22 14:23:31 UTC (rev 48)
+++ regression_tests/tests/2011_Session_inviteab_hangupba/test.sh	2006-11-22 15:51:23 UTC (rev 49)
@@ -2,17 +2,26 @@
 
 make > build_output 2>&1  || exit 2
 
+SPORT=$RANDOM
+while test $SPORT -le 1024 ; do SPORT=$RANDOM ; done
+CPORT=$RANDOM
+while test $CPORT -le 1024 ; do CPORT=$RANDOM ; done
+
 # set up server on port 40010, send it a sleep command
-echo -e "sleep 6\nhangup\nsleep 5"  | ../../common/ua/ua -p 40010 -u serveruser at domain.com > /dev/null 2>&1 &
+echo -e "sleep 6\nhangup\nsleep 5"  | ../../common/ua/ua -p $SPORT -u serveruser at domain.com > /dev/null 2>&1 &
 
 # regression test is done on clients output
-echo -e "sleep 1\ncall erik at localhost:40010\nsleep 8" |
-../../common/ua/ua -p 40020 -u clientuser at domain.com > test_output || exit 3
+echo -e "sleep 1\ncall erik at localhost:${SPORT}\nsleep 8" |
+../../common/ua/ua -p $CPORT -u clientuser at domain.com > test_output || exit 3
 
-# make output predictable - i.e. remove callid and branch strings (pseudo-random)
+# make output predictable - i.e. remove callid and branch strings (pseudo-random) and port numbers
 sed -i "s/Call-ID:.*$/Call-ID: callidstring/" test_output
 sed -i "s/branch=.*$/branch=branchstring/" test_output
 sed -i "s/[0-9][0-9][0-9].[0-9][0-9][0-9].//" test_output    #remove timestamp at start of lines
+sed -i "s/:$SPORT/:SERVERPORT/" test_output
+sed -i "s/=$SPORT/:SERVERPORT/" test_output
+sed -i "s/:$CPORT/:CLIENTPORT/" test_output
+sed -i "s/=$CPORT/:CLIENTPORT/" test_output
 
 if [ -e expected_output/expected_output ] ; then
         diff test_output expected_output/expected_output > diff_output ;



More information about the Minisip-devel mailing list