diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-03-21 15:38:53 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-03-21 15:38:53 +0000 |
commit | 59a1b6654ceef566153c9dbd28bd036fe29ba875 (patch) | |
tree | 0e85072ebda176d92b0eaafe0e485a59877144d3 /sal | |
parent | 24604d79578a8de5ab45312c31a276a595ad0d72 (diff) |
silence tests
Diffstat (limited to 'sal')
-rw-r--r-- | sal/qa/osl/socket/osl_Socket.cxx | 28 | ||||
-rw-r--r-- | sal/qa/osl/socket/osl_SocketAddr.cxx | 4 | ||||
-rw-r--r-- | sal/qa/osl/socket/sockethelper.cxx | 34 | ||||
-rw-r--r-- | sal/qa/osl/socket/sockethelper.hxx | 6 |
4 files changed, 57 insertions, 15 deletions
diff --git a/sal/qa/osl/socket/osl_Socket.cxx b/sal/qa/osl/socket/osl_Socket.cxx index cfcd3789a6ea..47ae4d0cef32 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 32bdf366ef0b..476fadea3d49 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 8b238b67d524..c60ca0006fcc 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 0a851fe2c396..84be1a5c330b 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(...) { } |