I re-enabled the tests that I had to disable before. And (hopefully)
removed an unveiled bug.
Some of the socket tests are still not usable as these tests depend on
existent servers somewhere in the world wide net.
Wilhelm
From 589a5b2253489ac7f29f08858f6537eb659b84ff Mon Sep 17 00:00:00 2001
Message-Id: <589a5b2253489ac7f29f08858f6537eb659b84ff.1300575426.git.Wilhelm.Pflueger@web.de>
From: Wilhelm Pflueger <Wilhelm.Pflueger@web.de>
Date: Sat, 19 Mar 2011 23:52:56 +0100
Subject: [PATCH] Tests in ure/sal/osl/socket unveiled SocketAddr comparison bug.
Reenabled test unveiled a bug in socket.c when comparing socket
addresses.
---
sal/osl/unx/socket.c | 10 ++++-
sal/osl/w32/socket.cxx | 4 +-
sal/qa/osl/socket/makefile.mk | 72 +++++++++++++++++-----------------
sal/qa/osl/socket/osl_Socket2.cxx | 3 +-
sal/qa/osl/socket/osl_SocketAddr.cxx | 3 +-
5 files changed, 51 insertions(+), 41 deletions(-)
diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c
index 7409592..74abe94 100644
--- a/sal/osl/unx/socket.c
+++ b/sal/osl/unx/socket.c
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -594,11 +594,17 @@ sal_Bool SAL_CALL osl_isEqualSocketAddr (
oslSocketAddr Addr1,
oslSocketAddr Addr2)
{
+ OSL_ASSERT(Addr1);
+ OSL_ASSERT(Addr2);
struct sockaddr* pAddr1= &(Addr1->m_sockaddr);
struct sockaddr* pAddr2= &(Addr2->m_sockaddr);
OSL_ASSERT(pAddr1);
OSL_ASSERT(pAddr2);
+ if (pAddr1 == pAddr2)
+ {
+ return (sal_True);
+ }
if (pAddr1->sa_family == pAddr2->sa_family)
{
@@ -617,7 +623,7 @@ sal_Bool SAL_CALL osl_isEqualSocketAddr (
default:
{
- return (memcmp(pAddr1, Addr2, sizeof(struct sockaddr)) == 0);
+ return (memcmp(pAddr1, pAddr2, sizeof(struct sockaddr)) == 0);
}
}
}
diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx
index 7acf7a5..fe26f5e 100644
--- a/sal/osl/w32/socket.cxx
+++ b/sal/osl/w32/socket.cxx
@@ -564,6 +564,8 @@ oslSocketAddr SAL_CALL osl_copySocketAddr(oslSocketAddr Addr)
/*****************************************************************************/
sal_Bool SAL_CALL osl_isEqualSocketAddr(oslSocketAddr Addr1, oslSocketAddr Addr2)
{
+ OSL_ASSERT(Addr1);
+ OSL_ASSERT(Addr2);
struct sockaddr* pAddr1= &(Addr1->m_sockaddr);
struct sockaddr* pAddr2= &(Addr2->m_sockaddr);
@@ -587,7 +589,7 @@ sal_Bool SAL_CALL osl_isEqualSocketAddr(oslSocketAddr Addr1, oslSocketAddr Addr2
default:
{
- return (memcmp(pAddr1, Addr2, sizeof(struct sockaddr)) == 0);
+ return (memcmp(pAddr1, pAddr2, sizeof(struct sockaddr)) == 0);
}
}
}
diff --git a/sal/qa/osl/socket/makefile.mk b/sal/qa/osl/socket/makefile.mk
index ae67d19..cdc268a 100755
--- a/sal/qa/osl/socket/makefile.mk
+++ b/sal/qa/osl/socket/makefile.mk
@@ -123,47 +123,47 @@ SHL4VERSIONMAP = $(PRJ)$/qa$/export.map
# BEGIN ----------------------------------------------------------------
# auto generated Target:Socket by codegen.pl
-#SHL5OBJS= \
-# $(SLO)$/sockethelper.obj \
-# $(SLO)$/osl_SocketAddr.obj
-#
-#SHL5TARGET= osl_SocketAddr
-#SHL5STDLIBS= $(SALLIB) $(CPPUNITLIB)
-#
-#.IF "$(GUI)" == "WNT"
-#SHL5STDLIBS += $(WS2_32LIB)
-#.ENDIF
-#
-#.IF "$(GUI)" == "UNX"
-#SHL5STDLIBS += -ldl -lnsl
-#.ENDIF
-#
-#SHL5IMPLIB= i$(SHL5TARGET)
-#DEF5NAME= $(SHL5TARGET)
-#SHL5VERSIONMAP = $(PRJ)$/qa$/export.map
+SHL5OBJS= \
+ $(SLO)$/sockethelper.obj \
+ $(SLO)$/osl_SocketAddr.obj
+
+SHL5TARGET= osl_SocketAddr
+SHL5STDLIBS= $(SALLIB) $(CPPUNITLIB)
+
+.IF "$(GUI)" == "WNT"
+SHL5STDLIBS += $(WS2_32LIB)
+.ENDIF
+
+.IF "$(GUI)" == "UNX"
+SHL5STDLIBS += -ldl -lnsl
+.ENDIF
+
+SHL5IMPLIB= i$(SHL5TARGET)
+DEF5NAME= $(SHL5TARGET)
+SHL5VERSIONMAP = $(PRJ)$/qa$/export.map
# auto generated Target:Socket
# END ------------------------------------------------------------------
# BEGIN ----------------------------------------------------------------
# auto generated Target:Socket by codegen.pl
-#SHL6OBJS= \
-# $(SLO)$/sockethelper.obj \
-# $(SLO)$/osl_Socket2.obj
-#
-#SHL6TARGET= osl_Socket2
-#SHL6STDLIBS= $(SALLIB) $(CPPUNITLIB)
-#
-#.IF "$(GUI)" == "WNT"
-#SHL6STDLIBS += $(WS2_32LIB)
-#.ENDIF
-#
-#.IF "$(GUI)" == "UNX"
-#SHL6STDLIBS += -ldl -lnsl
-#.ENDIF
-#
-#SHL6IMPLIB= i$(SHL6TARGET)
-#DEF6NAME= $(SHL6TARGET)
-#SHL6VERSIONMAP = $(PRJ)$/qa$/export.map
+SHL6OBJS= \
+ $(SLO)$/sockethelper.obj \
+ $(SLO)$/osl_Socket2.obj
+
+SHL6TARGET= osl_Socket2
+SHL6STDLIBS= $(SALLIB) $(CPPUNITLIB)
+
+.IF "$(GUI)" == "WNT"
+SHL6STDLIBS += $(WS2_32LIB)
+.ENDIF
+
+.IF "$(GUI)" == "UNX"
+SHL6STDLIBS += -ldl -lnsl
+.ENDIF
+
+SHL6IMPLIB= i$(SHL6TARGET)
+DEF6NAME= $(SHL6TARGET)
+SHL6VERSIONMAP = $(PRJ)$/qa$/export.map
# auto generated Target:Socket
# END ------------------------------------------------------------------
diff --git a/sal/qa/osl/socket/osl_Socket2.cxx b/sal/qa/osl/socket/osl_Socket2.cxx
index 3d5566b..ed02581 100644
--- a/sal/qa/osl/socket/osl_Socket2.cxx
+++ b/sal/qa/osl/socket/osl_Socket2.cxx
@@ -241,7 +241,8 @@ namespace osl_Socket
CPPUNIT_TEST( ctors_no_acquire );
CPPUNIT_TEST( ctors_copy_ctor );
CPPUNIT_TEST( ctors_TypeRaw );
- CPPUNIT_TEST( ctors_family_Ipx );
+ //TODO: Check if family_Ipx is still in use?
+ // CPPUNIT_TEST( ctors_family_Ipx );
CPPUNIT_TEST_SUITE_END();
}; // class ctors
diff --git a/sal/qa/osl/socket/osl_SocketAddr.cxx b/sal/qa/osl/socket/osl_SocketAddr.cxx
index ab52775..71e8e68 100644
--- a/sal/qa/osl/socket/osl_SocketAddr.cxx
+++ b/sal/qa/osl/socket/osl_SocketAddr.cxx
@@ -866,7 +866,8 @@ namespace osl_SocketAddr
CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::ctors);
CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::is);
-CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::getHostname);
+//TODO: enable Test with valid host names
+//CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::getHostname);
CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::getPort);
CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::setPort);
CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::setAddr);
--
1.7.0.4
Context
- [Libreoffice] Tests in ure/sal/osl/socket unveiled SocketAddr comparison bug. · Wilhelm Pflüger
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.