[Libreoffice-commits] .: 6 commits - sal/osl sal/qa
Caolán McNamara
caolan at kemper.freedesktop.org
Mon Mar 21 08:40:22 PDT 2011
sal/osl/unx/socket.c | 10 ++
sal/osl/w32/socket.cxx | 4 -
sal/qa/osl/socket/osl_AcceptorSocket.cxx | 10 +-
sal/qa/osl/socket/osl_ConnectorSocket.cxx | 10 +-
sal/qa/osl/socket/osl_DatagramSocket.cxx | 17 +++-
sal/qa/osl/socket/osl_Socket.cxx | 105 +++++++++++++++++++++---------
sal/qa/osl/socket/osl_Socket2.cxx | 72 ++++++++++----------
sal/qa/osl/socket/osl_SocketAddr.cxx | 46 +++++++------
sal/qa/osl/socket/osl_Socket_tests.cxx | 8 +-
sal/qa/osl/socket/osl_StreamSocket.cxx | 65 +++++++++---------
sal/qa/osl/socket/sockethelper.cxx | 38 +++++++++-
sal/qa/osl/socket/sockethelper.hxx | 18 +++++
12 files changed, 260 insertions(+), 143 deletions(-)
New commits:
commit 252e481647af004cd26f443b2edadfdbabe8353d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Mar 21 15:39:29 2011 +0000
Some of these still don't fly, e.g. parallel build
And hard-coded ports, e.g. two builds at the same time and so forth :-(
diff --git a/sal/prj/build.lst b/sal/prj/build.lst
index 74ddc7d..1813ffe 100644
--- a/sal/prj/build.lst
+++ b/sal/prj/build.lst
@@ -23,7 +23,6 @@ sa sal\qa\osl\file nmake - u sa_qa_osl_file sa_cppunittester sa_util NULL
sa sal\qa\osl\module nmake - u sa_qa_osl_module sa_cppunittester sa_util NULL
sa sal\qa\osl\condition nmake - all sa_qa_osl_condition sa_cppunittester sa_util NULL
sa sal\qa\osl\security nmake - all sa_qa_osl_security sa_cppunittester sa_util NULL
-sa sal\qa\osl\socket nmake - all sa_qa_osl_socket sa_cppunittester sa_util NULL
sa sal\qa\osl\process nmake - all sa_qa_osl_process sa_cppunittester sa_util NULL
sa sal\qa\osl\setthreadname nmake - all sa_qa_osl_setthreadname sa_cppunittester sa_util NULL
sa sal\qa\rtl\math nmake - all sa_qa_rtl_math sa_cppunittester sa_util NULL
commit c63803864e36b0b88c36ae021fe021e15eac406e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Mar 21 15:38:53 2011 +0000
silence tests
diff --git a/sal/qa/osl/socket/osl_Socket.cxx b/sal/qa/osl/socket/osl_Socket.cxx
index 566ef67..d1c055c 100644
--- a/sal/qa/osl/socket/osl_Socket.cxx
+++ b/sal/qa/osl/socket/osl_Socket.cxx
@@ -68,7 +68,11 @@
/** test output if SILENT_TEST is 0
*/
-#define SILENT_TEST 0
+#if OSL_DEBUG_LEVEL > 0
+# define SILENT_TEST 0
+#else
+# define SILENT_TEST 1
+#endif
#if SILENT_TEST
# define t_print(...) { }
@@ -127,8 +131,13 @@ inline char * oustring2char( const ::rtl::OUString & str )
*/
inline void printUString( const ::rtl::OUString & str, const sal_Char * msg = "" )
{
+#if SILENT_TEST
+ (void)str;
+ (void)msg;
+#else
t_print("#%s #printUString_u# ", msg );
t_print("%s\n", oustring2char( str ) );
+#endif
}
/** get the local host name.
@@ -203,7 +212,7 @@ inline ::rtl::OUString getLocalIP( )
char hostname[255];
gethostname(hostname, 255);
- return getIPbyName( hostname );
+ return getIPbyName( hostname );
}
/** construct error message
@@ -243,24 +252,31 @@ void thread_sleep( sal_Int32 _nSec )
*/
inline void printBool( sal_Bool bOk )
{
+#if SILENT_TEST
+ (void)bOk;
+#else
t_print("#printBool# " );
t_print ("%s", (sal_True == bOk) ? "YES!\n" : "NO!\n");
+#endif
}
/** print content of a ByteSequence.
*/
inline void printByteSequence_IP( const ::rtl::ByteSequence & bsByteSeq, sal_Int32 nLen )
{
- t_print("#ByteSequence is: " );
+#if SILENT_TEST
+ (void)bsByteSeq;
+ (void)nLen;
+#else
+ t_print("#ByteSequence is: " );
for ( int i = 0; i < nLen; i++ ){
-#if ! SILENT_TEST
if ( bsByteSeq[i] < 0 )
t_print("%d ", 256 + bsByteSeq[i] );
else
t_print("%d ", bsByteSeq[i] );
-#endif
}
t_print(" .\n" );
+#endif
}
/** convert an IP which is stored as a UString format to a ByteSequence array for later use.
@@ -3567,7 +3583,7 @@ protected:
#if !SILENT_TEST
sal_Int32 nRecv =
#endif
- dsSocket.recvFrom( pRecvBuffer, 30, &saTargetSocketAddr); //strlen( pTestString2 ) + 1
+ dsSocket.recvFrom( pRecvBuffer, 30, &saTargetSocketAddr);
t_print("After recvFrom, nRecv is %d\n", (int) nRecv);
}
diff --git a/sal/qa/osl/socket/osl_SocketAddr.cxx b/sal/qa/osl/socket/osl_SocketAddr.cxx
index 71e8e68..4e6e89c 100644
--- a/sal/qa/osl/socket/osl_SocketAddr.cxx
+++ b/sal/qa/osl/socket/osl_SocketAddr.cxx
@@ -200,8 +200,8 @@ namespace osl_SocketAddr
CPPUNIT_ASSERT_MESSAGE("test for SocketAddr tcpip specif constructor function: do a constructor using tcpip spec, check the result.",
saSocketAddr.is( ) == sal_True &&
- ( saSocketAddr.getPort( ) == IP_PORT_FTP )/*&&
- ( sal_True == compareUString( saSocketAddr.getHostname( ), aHostName1 ) ) */);
+ ( saSocketAddr.getPort( ) == IP_PORT_FTP )
+ );
}
//same as is_002
diff --git a/sal/qa/osl/socket/sockethelper.cxx b/sal/qa/osl/socket/sockethelper.cxx
index df29d3b..9244a17 100644
--- a/sal/qa/osl/socket/sockethelper.cxx
+++ b/sal/qa/osl/socket/sockethelper.cxx
@@ -34,7 +34,17 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/plugin/TestPlugIn.h>
-#define t_print printf
+#if OSL_DEBUG_LEVEL > 0
+# define SILENT_TEST 0
+#else
+# define SILENT_TEST 1
+#endif
+
+#if SILENT_TEST
+# define t_print(...) { }
+#else
+# define t_print printf
+#endif
//------------------------------------------------------------------------
// Ip version definition
@@ -75,11 +85,15 @@ sal_Bool compareSocketAddr( const ::osl::SocketAddr & addr1 , const ::osl::Socke
*/
void printUString( const ::rtl::OUString & str, const char* msg)
{
+#if SILENT_TEST
+ (void)str;
+ (void)msg;
+#else
t_print("#%s #printUString_u# ", msg );
rtl::OString aString;
aString = ::rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US );
- //char * sStr = aString.getStr( );
t_print("%s\n", aString.getStr( ) );
+#endif
}
/** get the local host name.
@@ -199,16 +213,23 @@ void thread_sleep( sal_Int32 _nSec )
*/
void printBool( sal_Bool bOk )
{
- t_print("printBool " );
- ( sal_True == bOk ) ? t_print("YES!" ): t_print("NO!");
- t_print("\n");
+#if SILENT_TEST
+ (void)bOk;
+#else
+ t_print("#printBool# " );
+ t_print ("%s", (sal_True == bOk) ? "YES!\n" : "NO!\n");
+#endif
}
/** print content of a ByteSequence.
*/
void printByteSequence_IP( const ::rtl::ByteSequence & bsByteSeq, sal_Int32 nLen )
{
- t_print("ByteSequence is: " );
+#if SILENT_TEST
+ (void)bsByteSeq;
+ (void)nLen;
+#else
+ t_print("#ByteSequence is: " );
for ( int i = 0; i < nLen; i++ ){
if ( bsByteSeq[i] < 0 )
t_print("%d ", 256 + bsByteSeq[i] );
@@ -216,6 +237,7 @@ void printByteSequence_IP( const ::rtl::ByteSequence & bsByteSeq, sal_Int32 nLen
t_print("%d ", bsByteSeq[i] );
}
t_print(" .\n" );
+#endif
}
/** convert an IP which is stored as a UString format to a ByteSequence array for later use.
diff --git a/sal/qa/osl/socket/sockethelper.hxx b/sal/qa/osl/socket/sockethelper.hxx
index 5f683ce..9242443 100644
--- a/sal/qa/osl/socket/sockethelper.hxx
+++ b/sal/qa/osl/socket/sockethelper.hxx
@@ -88,7 +88,11 @@ extern "C"
/** test output if SILENT_TEST is 0
*/
-#define SILENT_TEST 0
+#if OSL_DEBUG_LEVEL > 0
+# define SILENT_TEST 0
+#else
+# define SILENT_TEST 1
+#endif
#if SILENT_TEST
# define t_print(...) { }
commit 0e1a5d64fcb53df645ee58bdc8e93ae0bc14e615
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Mar 21 15:02:33 2011 +0000
some of these don't work for me still
diff --git a/sal/qa/osl/socket/osl_StreamSocket.cxx b/sal/qa/osl/socket/osl_StreamSocket.cxx
index ac4e28d..7b0c8a2 100644
--- a/sal/qa/osl/socket/osl_StreamSocket.cxx
+++ b/sal/qa/osl/socket/osl_StreamSocket.cxx
@@ -1415,10 +1415,10 @@ namespace osl_StreamSocket
CPPUNIT_TEST_SUITE_REGISTRATION(osl_StreamSocket::ctors);
CPPUNIT_TEST_SUITE_REGISTRATION(osl_StreamSocket::send_recv);
- CPPUNIT_TEST_SUITE_REGISTRATION(osl_StreamSocket::shutdown);
+// CPPUNIT_TEST_SUITE_REGISTRATION(osl_StreamSocket::shutdown);
CPPUNIT_TEST_SUITE_REGISTRATION(osl_StreamSocket::isExceptionPending);
- CPPUNIT_TEST_SUITE_REGISTRATION(osl_StreamSocket::justtest);
+// CPPUNIT_TEST_SUITE_REGISTRATION(osl_StreamSocket::justtest);
} // namespace osl_StreamSocket
commit e07c185aaa911526b9bdc2376d60db6845f59964
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Mar 21 14:24:22 2011 +0000
WaE: get %ld %d right for x86_64/x86
diff --git a/sal/qa/osl/socket/osl_Socket.cxx b/sal/qa/osl/socket/osl_Socket.cxx
index 755f183..566ef67 100644
--- a/sal/qa/osl/socket/osl_Socket.cxx
+++ b/sal/qa/osl/socket/osl_Socket.cxx
@@ -2454,7 +2454,7 @@ namespace osl_Socket
// on Linux, the value of option is 1, on Solaris, it's 16, but it's not important the exact value,
// just judge it is zero or not!
sal_Bool bOK = ( 0 != *pGetBuffer );
- t_print("#setOption_001: getOption is %ld \n", *pGetBuffer);
+ t_print("#setOption_001: getOption is %"SAL_PRIdINT32" \n", *pGetBuffer);
// toggle check, set to 0
*pbDontRouteSet = 0;
@@ -2466,7 +2466,7 @@ namespace osl_Socket
sal_Bool bOK2 = ( 0 == *pGetBuffer );
- t_print("#setOption_001: getOption is %ld \n", *pGetBuffer);
+ t_print("#setOption_001: getOption is %"SAL_PRIdINT32" \n", *pGetBuffer);
// LLA: sal_Bool * pbDontTouteSet = ( sal_Bool * )malloc( sizeof ( sal_Bool ) );
// LLA: *pbDontTouteSet = sal_True;
diff --git a/sal/qa/osl/socket/osl_Socket2.cxx b/sal/qa/osl/socket/osl_Socket2.cxx
index ed02581..2d39ac6 100644
--- a/sal/qa/osl/socket/osl_Socket2.cxx
+++ b/sal/qa/osl/socket/osl_Socket2.cxx
@@ -1107,7 +1107,7 @@ namespace osl_Socket
// on Linux, the value of option is 1, on Solaris, it's 16, but it's not important the exact value,
// just judge it is zero or not!
sal_Bool bOK = ( 0 != *pGetBuffer );
- t_print("#setOption_001: getOption is %ld \n", *pGetBuffer);
+ t_print("#setOption_001: getOption is %"SAL_PRIdINT32" \n", *pGetBuffer);
// toggle check, set to 0
*pbDontRouteSet = 0;
@@ -1119,7 +1119,7 @@ namespace osl_Socket
sal_Bool bOK2 = ( 0 == *pGetBuffer );
- t_print("#setOption_001: getOption is %ld \n", *pGetBuffer);
+ t_print("#setOption_001: getOption is %"SAL_PRIdINT32" \n", *pGetBuffer);
// LLA: sal_Bool * pbDontTouteSet = ( sal_Bool * )malloc( sizeof ( sal_Bool ) );
// LLA: *pbDontTouteSet = sal_True;
diff --git a/sal/qa/osl/socket/osl_StreamSocket.cxx b/sal/qa/osl/socket/osl_StreamSocket.cxx
index 2d47eba..ac4e28d 100644
--- a/sal/qa/osl/socket/osl_StreamSocket.cxx
+++ b/sal/qa/osl/socket/osl_StreamSocket.cxx
@@ -1130,10 +1130,6 @@ namespace osl_StreamSocket
t_print("received: %s\n", pBuffer2);
- // char * pBuffer3 = "quit\n";
- // nBufferSize = strlen(pBuffer3);
- // nWriteNumber = ssStreamConnection.write( pBuffer3, nBufferSize );
-
rtl::OUString suError = ssStreamConnection.getErrorAsString();
free(pBuffer2);
// ssStreamConnection.close();
@@ -1199,14 +1195,11 @@ namespace osl_StreamSocket
char const * pBuffer = "Test String\n";
sal_Int32 nBufferSize = strlen(pBuffer);
- sal_Int32 nWriteNumber = ssStreamConnection.write( pBuffer, nBufferSize );
-
- // char * pBuffer2 = " ";
- // sal_Int32 nReadNumber = ssStreamConnection.read( pBuffer2, strlen(pBuffer2) );
+ ssStreamConnection.write( pBuffer, nBufferSize );
char const * pBuffer3 = "quit\n";
nBufferSize = strlen(pBuffer3);
- nWriteNumber = ssStreamConnection.write( pBuffer3, nBufferSize );
+ ssStreamConnection.write( pBuffer3, nBufferSize );
ssStreamConnection.close();
}
@@ -1412,10 +1405,6 @@ namespace osl_StreamSocket
}
free(pBufferPeek);
- // char * pBuffer3 = "quit\n";
- // nBufferSize = strlen(pBuffer3);
- // nWriteNumber = ssStreamConnection.write( pBuffer3, nBufferSize );
-
rtl::OUString suError = ssStreamConnection.getErrorAsString();
}
aSocket.shutdown(osl_Socket_DirReadWrite);
commit 49092c2df5b4cd13f46bf928a95ede306d69d0ff
Author: Wilhelm Pflueger <Wilhelm.Pflueger at web.de>
Date: Mon Mar 21 14:14:39 2011 +0000
Tests in ure/sal/osl/socket unveiled SocketAddr comparison bug
Reenabled test unveiled a bug in socket.c when comparing socket
addresses.
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);
commit bcc3dec9bbc8be9f3a24fa24ec43391d8354601e
Author: Wilhelm Pflueger <Wilhelm.Pflueger at web.de>
Date: Mon Mar 21 14:13:51 2011 +0000
Reanimated tests in ure/sal/qa/osl/socket
I had to deactivate the tests in osl_SocketAddr.cxx
and osl_Socket2.cxx in makefile.mk. These tests failed:
osl_SocketAddr.cxx (SHL5TARGET) caused Segmentation fault.
osl_Socket2.cxx (SHL6TARGET) just failed with error 1.
I added the option SILENT_TEST in osl_Socket.cxx and in
sockethelper.hxx to allow tests without output
(t_print disabled).
diff --git a/sal/prj/build.lst b/sal/prj/build.lst
index 1813ffe..74ddc7d 100644
--- a/sal/prj/build.lst
+++ b/sal/prj/build.lst
@@ -23,6 +23,7 @@ sa sal\qa\osl\file nmake - u sa_qa_osl_file sa_cppunittester sa_util NULL
sa sal\qa\osl\module nmake - u sa_qa_osl_module sa_cppunittester sa_util NULL
sa sal\qa\osl\condition nmake - all sa_qa_osl_condition sa_cppunittester sa_util NULL
sa sal\qa\osl\security nmake - all sa_qa_osl_security sa_cppunittester sa_util NULL
+sa sal\qa\osl\socket nmake - all sa_qa_osl_socket sa_cppunittester sa_util NULL
sa sal\qa\osl\process nmake - all sa_qa_osl_process sa_cppunittester sa_util NULL
sa sal\qa\osl\setthreadname nmake - all sa_qa_osl_setthreadname sa_cppunittester sa_util NULL
sa sal\qa\rtl\math nmake - all sa_qa_rtl_math sa_cppunittester sa_util NULL
diff --git a/sal/qa/osl/socket/makefile.mk b/sal/qa/osl/socket/makefile.mk
index cdc268a..ae67d19 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_AcceptorSocket.cxx b/sal/qa/osl/socket/osl_AcceptorSocket.cxx
index b75be16..2430a93 100644
--- a/sal/qa/osl/socket/osl_AcceptorSocket.cxx
+++ b/sal/qa/osl/socket/osl_AcceptorSocket.cxx
@@ -59,7 +59,9 @@
// include files
//------------------------------------------------------------------------
-#include <testshl/simpleheader.hxx>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
#include "osl_Socket_Const.h"
#include "sockethelper.hxx"
@@ -249,9 +251,9 @@ namespace osl_AcceptorSocket
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_AcceptorSocket::ctors, "osl_AcceptorSocket");
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_AcceptorSocket::ctors);
//CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_AcceptorSocket::operator_assign, "osl_AcceptorSocket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_AcceptorSocket::listen_accept, "osl_AcceptorSocket");
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_AcceptorSocket::listen_accept);
} // namespace osl_AcceptorSocket
@@ -259,6 +261,6 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_AcceptorSocket::listen_accept, "osl_Ac
// this macro creates an empty function, which will called by the RegisterAllFunctions()
// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/osl/socket/osl_ConnectorSocket.cxx b/sal/qa/osl/socket/osl_ConnectorSocket.cxx
index 8129d71..2bfe25e 100644
--- a/sal/qa/osl/socket/osl_ConnectorSocket.cxx
+++ b/sal/qa/osl/socket/osl_ConnectorSocket.cxx
@@ -59,7 +59,9 @@
// include files
//------------------------------------------------------------------------
-#include <testshl/simpleheader.hxx>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
#include "osl_Socket_Const.h"
#include "sockethelper.hxx"
@@ -253,8 +255,8 @@ namespace osl_ConnectorSocket
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_ConnectorSocket::ctors, "osl_ConnectorSocket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_ConnectorSocket::connect, "osl_ConnectorSocket");
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_ConnectorSocket::ctors);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_ConnectorSocket::connect);
} // namespace osl_ConnectorSocket
@@ -262,6 +264,6 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_ConnectorSocket::connect, "osl_Connect
// this macro creates an empty function, which will called by the RegisterAllFunctions()
// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/osl/socket/osl_DatagramSocket.cxx b/sal/qa/osl/socket/osl_DatagramSocket.cxx
index 12df2a5..f7c0ef5 100644
--- a/sal/qa/osl/socket/osl_DatagramSocket.cxx
+++ b/sal/qa/osl/socket/osl_DatagramSocket.cxx
@@ -55,7 +55,9 @@
inline sal_Bool SAL_CALL operator== (const SocketAddr & Addr) const;
*/
-#include <testshl/simpleheader.hxx>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
#include "sockethelper.hxx"
@@ -179,8 +181,11 @@ protected:
return;
}
//blocking mode: default
- sal_Int32 nRecv = dsSocket.recvFrom( pRecvBuffer, 30, &saTargetSocketAddr); //strlen( pTestString2 ) + 1
- t_print("After recvFrom, nRecv is %d\n", nRecv);
+#if !SILENT_TEST
+ sal_Int32 nRecv =
+#endif
+ dsSocket.recvFrom( pRecvBuffer, 30, &saTargetSocketAddr); //strlen( pTestString2 ) + 1
+ t_print("After recvFrom, nRecv is %d\n", (int) nRecv);
}
void SAL_CALL onTerminated( )
@@ -301,8 +306,8 @@ public:
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_DatagramSocket::ctors, "osl_DatagramSocket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_DatagramSocket::sendTo_recvFrom, "osl_DatagramSocket");
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_DatagramSocket::ctors);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_DatagramSocket::sendTo_recvFrom);
} // namespace osl_DatagramSocket
@@ -310,6 +315,6 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_DatagramSocket::sendTo_recvFrom, "osl_
// this macro creates an empty function, which will called by the RegisterAllFunctions()
// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/osl/socket/osl_Socket.cxx b/sal/qa/osl/socket/osl_Socket.cxx
index bb4a04f..755f183 100644
--- a/sal/qa/osl/socket/osl_Socket.cxx
+++ b/sal/qa/osl/socket/osl_Socket.cxx
@@ -62,7 +62,23 @@
#include <osl_Socket_Const_orig.h>
-#include <testshl/simpleheader.hxx>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
+/** test output if SILENT_TEST is 0
+*/
+#define SILENT_TEST 0
+
+#if SILENT_TEST
+# define t_print(...) { }
+#else
+# define t_print printf
+#endif
+
+/** convert UString and OUString to std::string
+*/
+#define STD_STRING(s) (std::string((const char *)s.getStr()))
using namespace osl;
@@ -211,7 +227,7 @@ inline ::rtl::OUString outputError( const ::rtl::OUString & returnVal, const ::r
void thread_sleep( sal_Int32 _nSec )
{
/// print statement in thread process must use fflush() to force display.
- t_print("# wait %d seconds. ", _nSec );
+ t_print("# wait %d seconds. ", (int) _nSec );
fflush(stdout);
#ifdef WNT //Windows
@@ -228,7 +244,7 @@ void thread_sleep( sal_Int32 _nSec )
inline void printBool( sal_Bool bOk )
{
t_print("#printBool# " );
- ( sal_True == bOk ) ? t_print("YES!\n" ): t_print("NO!\n" );
+ t_print ("%s", (sal_True == bOk) ? "YES!\n" : "NO!\n");
}
/** print content of a ByteSequence.
@@ -237,10 +253,12 @@ inline void printByteSequence_IP( const ::rtl::ByteSequence & bsByteSeq, sal_Int
{
t_print("#ByteSequence is: " );
for ( int i = 0; i < nLen; i++ ){
+#if ! SILENT_TEST
if ( bsByteSeq[i] < 0 )
t_print("%d ", 256 + bsByteSeq[i] );
else
t_print("%d ", bsByteSeq[i] );
+#endif
}
t_print(" .\n" );
}
@@ -753,7 +771,7 @@ namespace osl_SocketAddr
suError += suHost2;
suError += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'."));
- CPPUNIT_ASSERT_MESSAGE(suError, sal_True == bOk);
+ CPPUNIT_ASSERT_MESSAGE(STD_STRING(suError), sal_True == bOk);
}
void ctors_copy()
@@ -932,7 +950,7 @@ namespace osl_SocketAddr
if ( compareUString( getIPbyName( oustring2char( suResult ) ), aHostIp4 ) == sal_True )
bOK = sal_True;
}
- CPPUNIT_ASSERT_MESSAGE( suError, sal_True == bOK);
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), sal_True == bOK);
}
// LLA: now we have to control, if this behaviour is right.
@@ -960,7 +978,7 @@ namespace osl_SocketAddr
}
}
- CPPUNIT_ASSERT_MESSAGE( suError, sal_True == bOK );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), sal_True == bOK );
}
@@ -1363,7 +1381,7 @@ namespace osl_SocketAddr
::rtl::OUString suError;
suError = outputError(suResult, getThisHostname( ), "test for getLocalHostname() function");
- CPPUNIT_ASSERT_MESSAGE( suError, bOk == true );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), bOk == true );
}
CPPUNIT_TEST_SUITE( getLocalHostname );
@@ -1776,7 +1794,7 @@ namespace osl_Socket
sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
::rtl::OUString suError1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Socket bind fail:")) + sSocket.getErrorAsString();
- CPPUNIT_ASSERT_MESSAGE( suError1, sal_True == bOK1 );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError1), sal_True == bOK1 );
sSocket.getLocalAddr( saLocalSocketAddr );
@@ -1824,7 +1842,7 @@ namespace osl_Socket
sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
::rtl::OUString suError1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Socket bind fail:")) + sSocket.getErrorAsString();
- CPPUNIT_ASSERT_MESSAGE( suError1, sal_True == bOK1 );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError1), sal_True == bOK1 );
sal_Bool bOK = ( IP_PORT_MYPORT7 == sSocket.getLocalPort( ) );
CPPUNIT_ASSERT_MESSAGE( "test for getLocalPort function: first create a new socket, then a socket address, bind them, and check the port.",
@@ -1856,7 +1874,7 @@ namespace osl_Socket
//on Unix, if Addr is not an address of type osl_Socket_FamilyInet, it returns OSL_INVALID_PORT
::rtl::OUString suError (RTL_CONSTASCII_USTRINGPARAM("on Unix, if Addr is not an address of type osl_Socket_FamilyInet, it returns OSL_INVALID_PORT, but can not create Addr of that case"));
#endif
- CPPUNIT_ASSERT_MESSAGE( suError, sal_False );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), sal_False );
}
@@ -1869,13 +1887,13 @@ namespace osl_Socket
sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
::rtl::OUString suError1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Socket bind fail:")) + sSocket.getErrorAsString();
- CPPUNIT_ASSERT_MESSAGE( suError1, sal_True == bOK1 );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError1), sal_True == bOK1 );
::rtl::OUString suError = outputError(::rtl::OUString::valueOf(sSocket.getLocalPort( )),
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("34463")),
"test for getLocalPort function: first create a new socket, then an invalid socket address, bind them, and check the port assigned");
sal_Bool bOK = ( sSocket.getLocalPort( ) >= 1 && sSocket.getLocalPort( ) <= 65535);
- CPPUNIT_ASSERT_MESSAGE( suError, sal_True == bOK );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), sal_True == bOK );
}
CPPUNIT_TEST_SUITE( getLocalPort );
@@ -1921,7 +1939,7 @@ namespace osl_Socket
sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
::rtl::OUString suError1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Socket bind fail:")) + sSocket.getErrorAsString();
- CPPUNIT_ASSERT_MESSAGE( suError1, sal_True == bOK1 );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError1), sal_True == bOK1 );
sal_Bool bOK;
::rtl::OUString suError;
#ifdef WNT
@@ -1936,7 +1954,7 @@ namespace osl_Socket
bOK = bRes1 || bRes2;
suError = outputError(sSocket.getLocalHost( ), aUString, "test for getLocalHost function: create localhost socket and check name");
#endif
- CPPUNIT_ASSERT_MESSAGE( suError, sal_True == bOK );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), sal_True == bOK );
}
void getLocalHost_002()
@@ -1951,7 +1969,7 @@ namespace osl_Socket
sal_Bool bOK = compareUString( sSocket.getLocalHost( ), aNullURL ) ;
::rtl::OUString suError = outputError(sSocket.getLocalHost( ), aNullURL, "test for getLocalHost function: getLocalHost with invalid SocketAddr");
- CPPUNIT_ASSERT_MESSAGE( suError, sal_True == bOK );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), sal_True == bOK );
}
CPPUNIT_TEST_SUITE( getLocalHost );
@@ -2436,7 +2454,7 @@ namespace osl_Socket
// on Linux, the value of option is 1, on Solaris, it's 16, but it's not important the exact value,
// just judge it is zero or not!
sal_Bool bOK = ( 0 != *pGetBuffer );
- t_print("#setOption_001: getOption is %d \n", *pGetBuffer);
+ t_print("#setOption_001: getOption is %ld \n", *pGetBuffer);
// toggle check, set to 0
*pbDontRouteSet = 0;
@@ -2448,7 +2466,7 @@ namespace osl_Socket
sal_Bool bOK2 = ( 0 == *pGetBuffer );
- t_print("#setOption_001: getOption is %d \n", *pGetBuffer);
+ t_print("#setOption_001: getOption is %ld \n", *pGetBuffer);
// LLA: sal_Bool * pbDontTouteSet = ( sal_Bool * )malloc( sizeof ( sal_Bool ) );
// LLA: *pbDontTouteSet = sal_True;
@@ -2516,7 +2534,7 @@ namespace osl_Socket
asAcceptorSocket.setOption( osl_Socket_OptionDontRoute, 1 ); //sal_True );
sal_Bool bOK = ( 0 != asAcceptorSocket.getOption( osl_Socket_OptionDontRoute ) );
- t_print("setOption_simple_001(): getoption is %d \n", asAcceptorSocket.getOption( osl_Socket_OptionDontRoute ) );
+ t_print("setOption_simple_001(): getoption is %d \n", (int) asAcceptorSocket.getOption( osl_Socket_OptionDontRoute ) );
CPPUNIT_ASSERT_MESSAGE( "test for setOption function: set option of a socket and then check.",
( sal_True == bOK ) );
}
@@ -2944,7 +2962,7 @@ namespace osl_StreamSocket
sal_Int32 nLength = myClientThread.getCount();
bool bIsOk = myClientThread.isOk(); // check if the values are right.
- t_print("Length:=%d\n", nLength);
+ t_print("Length:=%d\n", (int) nLength);
t_print(" bIsOk:=%d\n", bIsOk);
CPPUNIT_ASSERT_MESSAGE(" test for write/read values with two threads: send data from server, check readed data in client.",
@@ -2992,12 +3010,18 @@ protected:
if ( osl_Socket_Ok == csConnectorSocket.connect( saTargetSocketAddr, pTimeout ))
{
- sal_Int32 nWrite1 = csConnectorSocket.write( pTestString1, 11 ); // "test socket"
+#if !SILENT_TEST
+ sal_Int32 nWrite1 =
+#endif
+ csConnectorSocket.write( pTestString1, 11 ); // "test socket"
- sal_Int32 nWrite2 = csConnectorSocket.write( pTestString2, strlen( pTestString2 ) + 1 );
+#if !SILENT_TEST
+ sal_Int32 nWrite2 =
+#endif
+ csConnectorSocket.write( pTestString2, strlen( pTestString2 ) + 1 );
thread_sleep( 2 );
csConnectorSocket.write( pTestString2, strlen( pTestString2 ) + 1 );
- t_print("nWrite1 is %d, nWrite2 is %d\n", nWrite1, nWrite2 );
+ t_print("nWrite1 is %d, nWrite2 is %d\n", (int)nWrite1, (int)nWrite2 );
//thread_sleep( 1 );
}
else
@@ -3073,7 +3097,7 @@ protected:
sal_Int32 nRead2 = ssConnectionSocket.read( pReadBuffer + nRead1, 12 );
sal_Int32 nRead3 = ssConnectionSocket.read( pReadBuffer + nRead1 + nRead2, 12 );
- t_print("after read 2, nRead1 is %d, nRead2 is %d, nRead3 is %d \n", nRead1, nRead2, nRead3 );
+ t_print("after read 2, nRead1 is %d, nRead2 is %d, nRead3 is %d \n", (int) nRead1, (int) nRead2, (int) nRead3 );
mySendThread.join();
ssConnectionSocket.close();
@@ -3119,7 +3143,7 @@ protected:
sal_Int32 nWrite = ssConnectionSocket.write( pReadBuffer, 11 );
// still can read
sal_Int32 nRead3 = ssConnectionSocket.read( pReadBuffer + nRead1 , 12 );
- t_print("after read 2, nRead1 is %d, nWrite is %d, nRead3 is %d\n", nRead1, nWrite, nRead3 );
+ t_print("after read 2, nRead1 is %d, nWrite is %d, nRead3 is %d\n", (int) nRead1, (int) nWrite, (int) nRead3 );
mySendThread.join();
ssConnectionSocket.close();
asSocket.close();
@@ -3540,8 +3564,11 @@ protected:
return;
}
//blocking mode: default
- sal_Int32 nRecv = dsSocket.recvFrom( pRecvBuffer, 30, &saTargetSocketAddr); //strlen( pTestString2 ) + 1
- t_print("After recvFrom, nRecv is %d\n", nRecv);
+#if !SILENT_TEST
+ sal_Int32 nRecv =
+#endif
+ dsSocket.recvFrom( pRecvBuffer, 30, &saTargetSocketAddr); //strlen( pTestString2 ) + 1
+ t_print("After recvFrom, nRecv is %d\n", (int) nRecv);
}
void SAL_CALL onTerminated( )
@@ -3662,8 +3689,8 @@ public:
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_DatagramSocket::ctors, "osl_DatagramSocket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_DatagramSocket::sendTo_recvFrom, "osl_DatagramSocket");
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_DatagramSocket::ctors);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_DatagramSocket::sendTo_recvFrom);
} // namespace osl_DatagramSocket
@@ -3672,6 +3699,6 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_DatagramSocket::sendTo_recvFrom, "osl_
// this macro creates an empty function, which will called by the RegisterAllFunctions()
// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/osl/socket/osl_Socket2.cxx b/sal/qa/osl/socket/osl_Socket2.cxx
index e9cc8d7..3d5566b 100644
--- a/sal/qa/osl/socket/osl_Socket2.cxx
+++ b/sal/qa/osl/socket/osl_Socket2.cxx
@@ -55,7 +55,9 @@
inline sal_Bool SAL_CALL operator== (const SocketAddr & Addr) const;
*/
-#include <testshl/simpleheader.hxx>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
#include "sockethelper.hxx"
@@ -444,7 +446,7 @@ namespace osl_Socket
sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
::rtl::OUString suError1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Socket bind fail:")) + sSocket.getErrorAsString();
- CPPUNIT_ASSERT_MESSAGE( suError1, sal_True == bOK1 );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError1), sal_True == bOK1 );
sSocket.getLocalAddr( saLocalSocketAddr );
@@ -492,7 +494,7 @@ namespace osl_Socket
sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
::rtl::OUString suError1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Socket bind fail:")) + sSocket.getErrorAsString();
- CPPUNIT_ASSERT_MESSAGE( suError1, sal_True == bOK1 );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError1), sal_True == bOK1 );
sal_Bool bOK = ( IP_PORT_MYPORT7 == sSocket.getLocalPort( ) );
CPPUNIT_ASSERT_MESSAGE( "test for getLocalPort function: first create a new socket, then a socket address, bind them, and check the port.",
@@ -524,7 +526,7 @@ namespace osl_Socket
//on Unix, if Addr is not an address of type osl_Socket_FamilyInet, it returns OSL_INVALID_PORT
::rtl::OUString suError (RTL_CONSTASCII_USTRINGPARAM("on Unix, if Addr is not an address of type osl_Socket_FamilyInet, it returns OSL_INVALID_PORT, but can not create Addr of that case"));
#endif
- CPPUNIT_ASSERT_MESSAGE( suError, sal_False );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), sal_False );
}
@@ -537,13 +539,13 @@ namespace osl_Socket
sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
::rtl::OUString suError1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Socket bind fail:")) + sSocket.getErrorAsString();
- CPPUNIT_ASSERT_MESSAGE( suError1, sal_True == bOK1 );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError1), sal_True == bOK1 );
::rtl::OUString suError = outputError(::rtl::OUString::valueOf(sSocket.getLocalPort( )),
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("34463")),
"test for getLocalPort function: first create a new socket, then an invalid socket address, bind them, and check the port assigned");
sal_Bool bOK = ( sSocket.getLocalPort( ) >= 1 && sSocket.getLocalPort( ) <= 65535);
- CPPUNIT_ASSERT_MESSAGE( suError, sal_True == bOK );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), sal_True == bOK );
}
CPPUNIT_TEST_SUITE( getLocalPort );
@@ -589,7 +591,7 @@ namespace osl_Socket
sal_Bool bOK1 = sSocket.bind( saBindSocketAddr );
::rtl::OUString suError1 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Socket bind fail:")) + sSocket.getErrorAsString();
- CPPUNIT_ASSERT_MESSAGE( suError1, sal_True == bOK1 );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError1), sal_True == bOK1 );
sal_Bool bOK;
::rtl::OUString suError;
#ifdef WNT
@@ -604,7 +606,7 @@ namespace osl_Socket
bOK = bRes1 || bRes2;
suError = outputError(sSocket.getLocalHost( ), aUString, "test for getLocalHost function: create localhost socket and check name");
#endif
- CPPUNIT_ASSERT_MESSAGE( suError, sal_True == bOK );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), sal_True == bOK );
}
void getLocalHost_002()
@@ -619,7 +621,7 @@ namespace osl_Socket
sal_Bool bOK = compareUString( sSocket.getLocalHost( ), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")) ) ;
::rtl::OUString suError = outputError(sSocket.getLocalHost( ), rtl::OUString(), "test for getLocalHost function: getLocalHost with invalid SocketAddr");
- CPPUNIT_ASSERT_MESSAGE( suError, sal_True == bOK );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), sal_True == bOK );
}
CPPUNIT_TEST_SUITE( getLocalHost );
@@ -1104,7 +1106,7 @@ namespace osl_Socket
// on Linux, the value of option is 1, on Solaris, it's 16, but it's not important the exact value,
// just judge it is zero or not!
sal_Bool bOK = ( 0 != *pGetBuffer );
- t_print("#setOption_001: getOption is %d \n", *pGetBuffer);
+ t_print("#setOption_001: getOption is %ld \n", *pGetBuffer);
// toggle check, set to 0
*pbDontRouteSet = 0;
@@ -1116,7 +1118,7 @@ namespace osl_Socket
sal_Bool bOK2 = ( 0 == *pGetBuffer );
- t_print("#setOption_001: getOption is %d \n", *pGetBuffer);
+ t_print("#setOption_001: getOption is %ld \n", *pGetBuffer);
// LLA: sal_Bool * pbDontTouteSet = ( sal_Bool * )malloc( sizeof ( sal_Bool ) );
// LLA: *pbDontTouteSet = sal_True;
@@ -1184,7 +1186,7 @@ namespace osl_Socket
asAcceptorSocket.setOption( osl_Socket_OptionDontRoute, 1 ); //sal_True );
sal_Bool bOK = ( 0 != asAcceptorSocket.getOption( osl_Socket_OptionDontRoute ) );
- t_print("setOption_simple_001(): getoption is %d \n", asAcceptorSocket.getOption( osl_Socket_OptionDontRoute ) );
+ t_print("setOption_simple_001(): getoption is %d \n", (int) asAcceptorSocket.getOption( osl_Socket_OptionDontRoute ) );
CPPUNIT_ASSERT_MESSAGE( "test for setOption function: set option of a socket and then check.",
( sal_True == bOK ) );
}
@@ -1201,10 +1203,11 @@ namespace osl_Socket
}
CPPUNIT_TEST_SUITE( setOption );
- CPPUNIT_TEST( setOption_001 );
+// CPPUNIT_TEST( setOption_001 );
CPPUNIT_TEST( setOption_002 );
CPPUNIT_TEST( setOption_003 );
- CPPUNIT_TEST( setOption_simple_001 );
+ //TODO: Check this test
+// CPPUNIT_TEST( setOption_simple_001 );
// LLA: CPPUNIT_TEST( setOption_simple_002 );
CPPUNIT_TEST_SUITE_END();
@@ -1436,24 +1439,24 @@ namespace osl_Socket
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::ctors, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::operators, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::close, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getLocalAddr, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getLocalPort, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getLocalHost, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getPeer, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::bind, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::isRecvReady, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::isSendReady, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getType, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getOption, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::setOption, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::enableNonBlockingMode, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::isNonBlockingMode, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::clearError, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getError, "osl_Socket");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getHandle, "osl_Socket");
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::ctors);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::operators);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::close);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::getLocalAddr);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::getLocalPort);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::getLocalHost);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::getPeer);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::bind);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::isRecvReady);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::isSendReady);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::getType);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::getOption);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::setOption);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::enableNonBlockingMode);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::isNonBlockingMode);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::clearError);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::getError);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::getHandle);
} // namespace osl_Socket
@@ -1461,6 +1464,6 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::getHandle, "osl_Socket");
// this macro creates an empty function, which will called by the RegisterAllFunctions()
// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/osl/socket/osl_SocketAddr.cxx b/sal/qa/osl/socket/osl_SocketAddr.cxx
index 46cd9d5..ab52775 100644
--- a/sal/qa/osl/socket/osl_SocketAddr.cxx
+++ b/sal/qa/osl/socket/osl_SocketAddr.cxx
@@ -55,7 +55,10 @@
inline sal_Bool SAL_CALL operator== (const SocketAddr & Addr) const;
*/
-#include <testshl/simpleheader.hxx>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
#include "sockethelper.hxx"
@@ -125,7 +128,7 @@ namespace osl_SocketAddr
suError += suHost2;
suError += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'."));
- CPPUNIT_ASSERT_MESSAGE(suError, sal_True == bOk);
+ CPPUNIT_ASSERT_MESSAGE(STD_STRING(suError), sal_True == bOk);
}
void ctors_copy()
@@ -305,7 +308,7 @@ namespace osl_SocketAddr
if ( compareUString( getIPbyName( aString ), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("129.158.217.107")) ) == sal_True )
bOK = sal_True;
}
- CPPUNIT_ASSERT_MESSAGE( suError, sal_True == bOK);
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), sal_True == bOK);
}
// LLA: now we have to control, if this behaviour is right.
@@ -335,7 +338,7 @@ namespace osl_SocketAddr
}
}
- CPPUNIT_ASSERT_MESSAGE( suError, sal_True == bOK );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), sal_True == bOK );
}
@@ -743,7 +746,7 @@ namespace osl_SocketAddr
::rtl::OUString suError;
suError = outputError(suResult, getThisHostname( ), "test for getLocalHostname() function");
- CPPUNIT_ASSERT_MESSAGE( suError, bOk == true );
+ CPPUNIT_ASSERT_MESSAGE( STD_STRING(suError), bOk == true );
}
CPPUNIT_TEST_SUITE( getLocalHostname );
@@ -861,19 +864,19 @@ namespace osl_SocketAddr
// -----------------------------------------------------------------------------
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_SocketAddr::ctors, "osl_SocketAddr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_SocketAddr::is, "osl_SocketAddr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_SocketAddr::getHostname, "osl_SocketAddr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_SocketAddr::getPort, "osl_SocketAddr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_SocketAddr::setPort, "osl_SocketAddr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_SocketAddr::setAddr, "osl_SocketAddr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_SocketAddr::getAddr, "osl_SocketAddr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_SocketAddr::operator_equal, "osl_SocketAddr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_SocketAddr::getSocketAddrHandle, "osl_SocketAddr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_SocketAddr::getLocalHostname, "osl_SocketAddr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_SocketAddr::resolveHostname, "osl_SocketAddr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_SocketAddr::gettheServicePort, "osl_SocketAddr");
-CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_SocketAddr::getFamilyOfSocketAddr, "osl_SocketAddr");
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::ctors);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::is);
+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);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::getAddr);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::operator_equal);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::getSocketAddrHandle);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::getLocalHostname);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::resolveHostname);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::gettheServicePort);
+CPPUNIT_TEST_SUITE_REGISTRATION(osl_SocketAddr::getFamilyOfSocketAddr);
} // namespace osl_SocketAddr
@@ -881,6 +884,6 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_SocketAddr::getFamilyOfSocketAddr, "os
// this macro creates an empty function, which will called by the RegisterAllFunctions()
// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/osl/socket/osl_Socket_tests.cxx b/sal/qa/osl/socket/osl_Socket_tests.cxx
index 154bd49..a53d814 100644
--- a/sal/qa/osl/socket/osl_Socket_tests.cxx
+++ b/sal/qa/osl/socket/osl_Socket_tests.cxx
@@ -34,7 +34,9 @@
//------------------------------------------------------------------------
#include <osl_Socket_Const.h>
-#include <testshl/simpleheader.hxx>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
#include <osl/socket.hxx>
//------------------------------------------------------------------------
// helper functions
@@ -64,7 +66,7 @@ namespace osl_Socket
CPPUNIT_TEST_SUITE_END();
};
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Socket::tests, "osl_SocketTest");
+ CPPUNIT_TEST_SUITE_REGISTRATION(osl_Socket::tests);
}
@@ -84,7 +86,7 @@ void RegisterAdditionalFunctions( FktRegFuncPtr _pFunc )
#else*/
-NOADDITIONAL;
+CPPUNIT_PLUGIN_IMPLEMENT();
//#endif
diff --git a/sal/qa/osl/socket/osl_StreamSocket.cxx b/sal/qa/osl/socket/osl_StreamSocket.cxx
index 4315f24..2d47eba 100644
--- a/sal/qa/osl/socket/osl_StreamSocket.cxx
+++ b/sal/qa/osl/socket/osl_StreamSocket.cxx
@@ -55,7 +55,9 @@
inline sal_Bool SAL_CALL operator== (const SocketAddr & Addr) const;
*/
-#include <testshl/simpleheader.hxx>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
#include "sockethelper.hxx"
#include <osl/conditn.hxx>
@@ -660,7 +662,7 @@ namespace osl_StreamSocket
sal_Int32 nLength = myClientThread.getCount();
bool bIsOk = myClientThread.isOk(); // check if the values are right.
- t_print("Length:=%d\n", nLength);
+ t_print("Length:=%d\n", (int) nLength);
t_print(" bIsOk:=%d\n", bIsOk);
CPPUNIT_ASSERT_MESSAGE(" test for write/read values with two threads: send data from server, check readed data in client.",
@@ -717,12 +719,17 @@ namespace osl_StreamSocket
if ( osl_Socket_Ok == m_csConnectorSocket.connect( m_saTargetSocketAddr, pTimeout ))
{
- sal_Int32 nWrite1 = m_csConnectorSocket.write( pTestString1, 11 ); // "test socket"
-
- sal_Int32 nWrite2 = m_csConnectorSocket.write( pTestString2, strlen( pTestString2 ) + 1 );
+#if !SILENT_TEST
+ sal_Int32 nWrite1 =
+#endif
+ m_csConnectorSocket.write( pTestString1, 11 ); // "test socket"
+#if !SILENT_TEST
+ sal_Int32 nWrite2 =
+#endif
+ m_csConnectorSocket.write( pTestString2, strlen( pTestString2 ) + 1 );
thread_sleep( 2 );
m_csConnectorSocket.write( pTestString2, strlen( pTestString2 ) + 1 );
- t_print("nWrite1 is %d, nWrite2 is %d\n", nWrite1, nWrite2 );
+ t_print("nWrite1 is %d, nWrite2 is %d\n", (int) nWrite1, (int) nWrite2 );
//thread_sleep( 1 );
}
else
@@ -812,7 +819,7 @@ namespace osl_StreamSocket
sal_Int32 nRead2 = ssConnectionSocket.read( pReadBuffer + nRead1, 12 );
sal_Int32 nRead3 = ssConnectionSocket.read( pReadBuffer + nRead1 + nRead2, 12 );
- t_print("after read 2, nRead1 is %d, nRead2 is %d, nRead3 is %d \n", nRead1, nRead2, nRead3 );
+ t_print("after read 2, nRead1 is %d, nRead2 is %d, nRead3 is %d \n", (int) nRead1, (int) nRead2, (int) nRead3 );
mySendThread.join();
ssConnectionSocket.close();
@@ -859,7 +866,7 @@ namespace osl_StreamSocket
sal_Int32 nWrite = ssConnectionSocket.write( pReadBuffer, 11 );
// still can read
sal_Int32 nRead3 = ssConnectionSocket.read( pReadBuffer + nRead1 , 12 );
- t_print("after read 2, nRead1 is %d, nWrite is %d, nRead3 is %d\n", nRead1, nWrite, nRead3 );
+ t_print("after read 2, nRead1 is %d, nWrite is %d, nRead3 is %d\n", (int) nRead1, (int) nWrite, (int) nRead3 );
mySendThread.join();
ssConnectionSocket.close();
asSocket.close();
@@ -961,7 +968,7 @@ namespace osl_StreamSocket
{
t_print("read()\n");
m_nReadCount = aSocket.read( m_pBuffer, m_nBufferSize );
- t_print("%d bytes recived.\n", m_nReadCount);
+ t_print("%d bytes recived.\n", (int) m_nReadCount);
}
}
else
@@ -1283,10 +1290,17 @@ namespace osl_StreamSocket
// termAndJoinThread(&myReadThread);
// statistics
- sal_uInt32 nLength = myReadThread.getCount();
- bool bIsOk = myReadThread.isOk(); // check if the values are right.
+#if !SILENT_TEST
+ sal_uInt32 nLength =
+#endif
+ myReadThread.getCount();
+
+#if !SILENT_TEST
+ bool bIsOk =
+#endif
+ myReadThread.isOk(); // check if the values are right.
- t_print("Length:=%d\n", nLength);
+ t_print("Length:=%d\n", (int) nLength);
t_print(" bIsOk:=%d\n", bIsOk);
}
else
@@ -1410,12 +1424,12 @@ namespace osl_StreamSocket
// -----------------------------------------------------------------------------
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_StreamSocket::ctors, "osl_StreamSocket");
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_StreamSocket::send_recv, "osl_StreamSocket");
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_StreamSocket::shutdown, "osl_StreamSocket");
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_StreamSocket::isExceptionPending, "osl_StreamSocket");
+ CPPUNIT_TEST_SUITE_REGISTRATION(osl_StreamSocket::ctors);
+ CPPUNIT_TEST_SUITE_REGISTRATION(osl_StreamSocket::send_recv);
+ CPPUNIT_TEST_SUITE_REGISTRATION(osl_StreamSocket::shutdown);
+ CPPUNIT_TEST_SUITE_REGISTRATION(osl_StreamSocket::isExceptionPending);
- CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_StreamSocket::justtest, "osl_StreamSocket");
+ CPPUNIT_TEST_SUITE_REGISTRATION(osl_StreamSocket::justtest);
} // namespace osl_StreamSocket
@@ -1423,6 +1437,6 @@ namespace osl_StreamSocket
// this macro creates an empty function, which will called by the RegisterAllFunctions()
// to let the user the possibility to also register some functions by hand.
-NOADDITIONAL;
+CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/osl/socket/sockethelper.cxx b/sal/qa/osl/socket/sockethelper.cxx
index 91585e9..df29d3b 100644
--- a/sal/qa/osl/socket/sockethelper.cxx
+++ b/sal/qa/osl/socket/sockethelper.cxx
@@ -30,7 +30,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sal.hxx"
#include "sockethelper.hxx"
-#include <testshl/simpleheader.hxx>
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
+#define t_print printf
//------------------------------------------------------------------------
// Ip version definition
diff --git a/sal/qa/osl/socket/sockethelper.hxx b/sal/qa/osl/socket/sockethelper.hxx
index dad0905..5f683ce 100644
--- a/sal/qa/osl/socket/sockethelper.hxx
+++ b/sal/qa/osl/socket/sockethelper.hxx
@@ -86,6 +86,20 @@ extern "C"
}
#endif
+/** test output if SILENT_TEST is 0
+*/
+#define SILENT_TEST 0
+
+#if SILENT_TEST
+# define t_print(...) { }
+#else
+# define t_print printf
+#endif
+
+/** convert UString and OUString to std::string
+*/
+#define STD_STRING(s) (std::string((const char *)s.getStr()))
+
/** compare two OUString.
*/
sal_Bool compareUString( const ::rtl::OUString & ustr1, const ::rtl::OUString & ustr2 );
More information about the Libreoffice-commits
mailing list