diff options
-rw-r--r-- | sal/prj/build.lst | 1 | ||||
-rw-r--r-- | sal/qa/osl/pipe/makefile.mk | 2 | ||||
-rw-r--r-- | sal/qa/osl/pipe/osl_Pipe.cxx | 87 |
3 files changed, 46 insertions, 44 deletions
diff --git a/sal/prj/build.lst b/sal/prj/build.lst index 638252ad4ee8..c96c3977f725 100644 --- a/sal/prj/build.lst +++ b/sal/prj/build.lst @@ -18,4 +18,5 @@ sa sal\cppunittester nmake - all sa_cppunittester sa_cpprt.u sa_util NULL sa sal\qa\ByteSequence nmake - all sa_qa_ByteSequence sa_cppunittester sa_util NULL sa sal\qa\OStringBuffer nmake - all sa_qa_OStringBuffer sa_cppunittester sa_util NULL sa sal\qa\osl\mutex nmake - all sa_qa_osl_mutex sa_cppunittester sa_util NULL +sa sal\qa\osl\pipe nmake - all sa_qa_osl_pipe sa_cppunittester sa_util NULL sa sal\qa\osl\profile nmake - all sa_qa_osl_profile sa_cppunittester sa_util NULL diff --git a/sal/qa/osl/pipe/makefile.mk b/sal/qa/osl/pipe/makefile.mk index 6350cdba0233..85452eac8655 100644 --- a/sal/qa/osl/pipe/makefile.mk +++ b/sal/qa/osl/pipe/makefile.mk @@ -51,7 +51,7 @@ SHL1OBJS= \ $(SLO)$/osl_Pipe.obj SHL1TARGET= osl_Pipe -SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) +SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTLIB) SHL1IMPLIB= i$(SHL1TARGET) # SHL1DEF= $(MISC)$/$(SHL1TARGET).def diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx index 6371ad3b5250..ffb9f314a5bf 100644 --- a/sal/qa/osl/pipe/osl_Pipe.cxx +++ b/sal/qa/osl/pipe/osl_Pipe.cxx @@ -36,6 +36,7 @@ #include "cppunit/TestFixture.h" #include "cppunit/extensions/HelperMacros.h" #include "cppunit/plugin/TestPlugIn.h" +#include "test/uniquepipename.hxx" #include <sal/types.h> #include <rtl/ustring.hxx> @@ -186,8 +187,8 @@ namespace osl_Pipe void ctors_name_option( ) { /// create a named pipe. - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE ); - ::osl::Pipe aAssignPipe( aTestPipeName, osl_Pipe_OPEN ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); + ::osl::Pipe aAssignPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN ); bRes = aPipe.is( ) && aAssignPipe.is( ); @@ -199,7 +200,7 @@ namespace osl_Pipe { /// create a security pipe. const ::osl::Security rSecurity; - ::osl::Pipe aSecurityPipe( aTestPipeName, osl_Pipe_CREATE, rSecurity ); + ::osl::Pipe aSecurityPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSecurity ); bRes = aSecurityPipe.is( ); @@ -210,7 +211,7 @@ namespace osl_Pipe void ctors_copy( ) { /// create a pipe. - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); /// create a pipe using copy constructor. ::osl::Pipe aCopyPipe( aPipe ); @@ -233,7 +234,7 @@ namespace osl_Pipe void ctors_no_acquire( ) { /// create a pipe. - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); /// constructs a pipe reference without acquiring the handle. ::osl::Pipe aNoAcquirePipe( aPipe.getHandle( ), SAL_NO_ACQUIRE ); @@ -249,7 +250,7 @@ namespace osl_Pipe void ctors_acquire( ) { /// create a base pipe. - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); /// constructs two pipes without acquiring the handle on the base pipe. ::osl::Pipe aAcquirePipe( aPipe.getHandle( ) ); ::osl::Pipe aAcquirePipe1( NULL ); @@ -287,14 +288,14 @@ namespace osl_Pipe void is_002( ) { - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test is(), a normal pipe creation.", sal_True == aPipe.is( ) ); } void is_003( ) { - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); aPipe.clear( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test is(), an invalid case.", sal_False == aPipe.is( ) ); @@ -337,8 +338,8 @@ namespace osl_Pipe { const Security rSec; ::osl::Pipe aPipe; - bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE, rSec ); - bRes1 = aPipe.create( aTestPipeName, osl_Pipe_CREATE, rSec ); + bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSec ); + bRes1 = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSec ); aPipe.clear( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation.", @@ -349,8 +350,8 @@ namespace osl_Pipe { const Security rSec; ::osl::Pipe aPipe, aPipe1; - bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE, rSec ); - bRes1 = aPipe1.create( aTestPipeName, osl_Pipe_OPEN, rSec ); + bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSec ); + bRes1 = aPipe1.create( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN, rSec ); aPipe.clear( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation and open.", @@ -360,8 +361,8 @@ namespace osl_Pipe void create_named_001( ) { ::osl::Pipe aPipe; - bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE ); - bRes1 = aPipe.create( aTestPipeName, osl_Pipe_CREATE ); + bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); + bRes1 = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); aPipe.clear( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation.", @@ -371,8 +372,8 @@ namespace osl_Pipe void create_named_002( ) { ::osl::Pipe aPipe, aPipe1; - bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE ); - bRes1 = aPipe1.create( aTestPipeName, osl_Pipe_OPEN ); + bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); + bRes1 = aPipe1.create( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN ); aPipe.clear( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation and open.", @@ -382,7 +383,7 @@ namespace osl_Pipe void create_named_003( ) { ::osl::Pipe aPipe; - bRes = aPipe.create( aTestPipeName ); + bRes = aPipe.create( test::uniquePipeName(aTestPipeName) ); aPipe.clear( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test default option is open.", @@ -410,7 +411,7 @@ namespace osl_Pipe void clear_001( ) { ::osl::Pipe aPipe; - aPipe.create( aTestPipeName, osl_Pipe_CREATE ); + aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); aPipe.clear( ); bRes = aPipe.is( ); @@ -436,7 +437,7 @@ namespace osl_Pipe void assign_ref( ) { ::osl::Pipe aPipe, aPipe1; - aPipe.create( aTestPipeName, osl_Pipe_CREATE ); + aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); aPipe1 = aPipe; bRes = aPipe1.is( ); bRes1 = aPipe == aPipe1; @@ -450,7 +451,7 @@ namespace osl_Pipe void assign_handle( ) { ::osl::Pipe aPipe, aPipe1; - aPipe.create( aTestPipeName, osl_Pipe_CREATE ); + aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); aPipe1 = aPipe.getHandle( ); bRes = aPipe1.is( ); bRes1 = aPipe == aPipe1; @@ -500,7 +501,7 @@ namespace osl_Pipe void isEqual_001( ) { ::osl::Pipe aPipe; - aPipe.create( aTestPipeName, osl_Pipe_CREATE ); + aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); bRes = aPipe == aPipe; aPipe.close( ); @@ -511,10 +512,10 @@ namespace osl_Pipe void isEqual_002( ) { ::osl::Pipe aPipe, aPipe1, aPipe2; - aPipe.create( aTestPipeName, osl_Pipe_CREATE ); + aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); aPipe1 = aPipe; - aPipe2.create( aTestPipeName, osl_Pipe_CREATE ); + aPipe2.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); bRes = aPipe == aPipe1; bRes1 = aPipe == aPipe2; @@ -543,7 +544,7 @@ namespace osl_Pipe void close_001( ) { - ::osl::Pipe aPipe( aTestPipe1, osl_Pipe_CREATE ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipe1), osl_Pipe_CREATE ); aPipe.close( ); bRes = aPipe.is( ); @@ -556,7 +557,7 @@ namespace osl_Pipe void close_002( ) { - ::osl::StreamPipe aPipe( aTestPipe1, osl_Pipe_CREATE ); + ::osl::StreamPipe aPipe( test::uniquePipeName(aTestPipe1), osl_Pipe_CREATE ); aPipe.close( ); int nRet = aPipe.send( m_pTestString1.getStr(), 3 ); @@ -624,7 +625,7 @@ namespace osl_Pipe void getError_001( ) { - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_OPEN ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN ); oslPipeError nError = aPipe.getError( ); printPipeError( aPipe ); aPipe.clear( ); @@ -635,8 +636,8 @@ namespace osl_Pipe void getError_002( ) { - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE ); - ::osl::Pipe aPipe1( aTestPipeName, osl_Pipe_CREATE ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); + ::osl::Pipe aPipe1( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); oslPipeError nError = aPipe.getError( ); printPipeError( aPipe ); aPipe.clear( ); @@ -663,7 +664,7 @@ namespace osl_Pipe void getHandle_001( ) { - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_OPEN ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN ); bRes = aPipe == aPipe.getHandle( ); aPipe.clear( ); @@ -673,7 +674,7 @@ namespace osl_Pipe void getHandle_002( ) { - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); ::osl::Pipe aPipe1( aPipe.getHandle( ) ); bRes = aPipe == aPipe1; aPipe.clear( ); @@ -726,7 +727,7 @@ namespace osl_StreamPipe void ctors_none( ) { // create a pipe. - ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); // create an unattached pipe. ::osl::StreamPipe aStreamPipe1; bRes = aStreamPipe1.is( ); @@ -744,7 +745,7 @@ namespace osl_StreamPipe void ctors_handle( ) { // create a pipe. - ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); // create a pipe with last handle. ::osl::StreamPipe aStreamPipe1( aStreamPipe.getHandle( ) ); bRes = aStreamPipe1.is( ) && aStreamPipe == aStreamPipe1; @@ -758,7 +759,7 @@ namespace osl_StreamPipe void ctors_copy( ) { // create a pipe. - ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); // create an unattached pipe. ::osl::StreamPipe aStreamPipe1( aStreamPipe ); bRes = aStreamPipe1.is( ) && aStreamPipe == aStreamPipe1; @@ -772,9 +773,9 @@ namespace osl_StreamPipe void ctors_name_option( ) { // create a pipe. - ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); // create an unattached pipe. - ::osl::StreamPipe aStreamPipe1( aTestPipeName, osl_Pipe_OPEN ); + ::osl::StreamPipe aStreamPipe1( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN ); bRes = aStreamPipe1.is( ) && aStreamPipe.is( ); aStreamPipe.clear( ); aStreamPipe1.clear( ); @@ -787,7 +788,7 @@ namespace osl_StreamPipe { /// create a security pipe. const ::osl::Security rSecurity; - ::osl::StreamPipe aSecurityPipe( aTestPipeName, osl_Pipe_CREATE, rSecurity ); + ::osl::StreamPipe aSecurityPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSecurity ); bRes = aSecurityPipe.is( ); aSecurityPipe.clear( ); @@ -809,7 +810,7 @@ namespace osl_StreamPipe void ctors_no_acquire( ) { // create a pipe. - ::osl::StreamPipe aPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::StreamPipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); // constructs a pipe reference without acquiring the handle. ::osl::StreamPipe aNoAcquirePipe( aPipe.getHandle( ), SAL_NO_ACQUIRE ); @@ -846,7 +847,7 @@ namespace osl_StreamPipe void assign_ref( ) { ::osl::StreamPipe aPipe, aPipe1; - aPipe.create( aTestPipeName, osl_Pipe_CREATE ); + aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); aPipe1 = aPipe; bRes = aPipe1.is( ); bRes1 = aPipe == aPipe1; @@ -859,7 +860,7 @@ namespace osl_StreamPipe void assign_handle( ) { - ::osl::StreamPipe * pPipe = new ::osl::StreamPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::StreamPipe * pPipe = new ::osl::StreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); ::osl::StreamPipe * pAssignPipe = new ::osl::StreamPipe; *pAssignPipe = pPipe->getHandle( ); @@ -914,7 +915,7 @@ namespace osl_StreamPipe sal_Int32 nChars = 0; printf("open pipe\n"); - ::osl::StreamPipe aSenderPipe( aTestPipeName, osl_Pipe_OPEN ); // aTestPipeName is a string = "TestPipe" + ::osl::StreamPipe aSenderPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN ); // test::uniquePipeName(aTestPipeName) is a string = "TestPipe" if ( aSenderPipe.is() == sal_False ) { printf("pipe open failed! \n"); @@ -947,13 +948,13 @@ namespace osl_StreamPipe { public: sal_Char buf[256]; - //::osl::StreamPipe aListenPipe; //( aTestPipeName, osl_Pipe_CREATE ); + //::osl::StreamPipe aListenPipe; //( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); ::osl::Pipe aListenPipe; ::osl::StreamPipe aConnectionPipe; Pipe_DataSource_Thread( ) { printf("create pipe\n"); - aListenPipe.create( aTestPipeName, osl_Pipe_CREATE ); + aListenPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); } ~Pipe_DataSource_Thread( ) { @@ -964,7 +965,7 @@ namespace osl_StreamPipe { //create pipe. sal_Int32 nChars; - //::osl::StreamPipe aListenPipe( aTestPipeName, osl_Pipe_CREATE ); + //::osl::StreamPipe aListenPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); printf("listen\n"); if ( aListenPipe.is() == sal_False ) { |