I've fixed a test into sipXportLib, a dynamic port selection.

>From 8ac7236e057c8871b1c3548ce7e0b362c04b6784 Mon Sep 17 00:00:00 2001
From: Domenico Chierico <[email protected]>
Date: Tue, 15 Mar 2011 16:15:46 +0100
Subject: [PATCH 2/2] XX-5060: OsSocketTest make use of dynamic port

---
 sipXportLib/src/test/os/OsSocketTest.cpp |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/sipXportLib/src/test/os/OsSocketTest.cpp b/sipXportLib/src/test/os/OsSocketTest.cpp
index be6de4e..d1cdf87 100644
--- a/sipXportLib/src/test/os/OsSocketTest.cpp
+++ b/sipXportLib/src/test/os/OsSocketTest.cpp
@@ -88,12 +88,16 @@ public:
     void testWriteAndAcceptMsg()
     {
     	// Create/Verify Sockets
-        OsServerSocket* server = new OsServerSocket(50, 8021);
+        int port = PORT_NONE;
+        OsServerSocket s(50);
+	port = s.getLocalHostPort();
+	s.close();
+        OsServerSocket* server = new OsServerSocket(50, port);
         KNOWN_BUG("This can fail if there is a port conflict on the test system", "XECS-1924");
         CPPUNIT_ASSERT_MESSAGE("server socket failure",
                                server->isOk());
 
-        OsSocket* client = new OsConnectionSocket(8021, "localhost");
+        OsSocket* client = new OsConnectionSocket(port, "localhost");
         CPPUNIT_ASSERT_MESSAGE("client socket failure",
                                client->isOk());
 
-- 
1.7.4

_______________________________________________
sipx-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-dev/

Reply via email to