kerneltest/e32test/pipe/t_pipe2.cpp
author Tom Cosgrove <tom.cosgrove@nokia.com>
Fri, 28 May 2010 16:29:07 +0100
changeset 30 8aab599e3476
parent 0 a41df078684a
permissions -rw-r--r--
Fix for bug 2283 (RVCT 4.0 support is missing from PDK 3.0.h) Have multiple extension sections in the bld.inf, one for each version of the compiler. The RVCT version building the tools will build the runtime libraries for its version, but make sure we extract all the other versions from zip archives. Also add the archive for RVCT4.

// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// e32test\pipe\t_pipe2.cpp
// This is supporting program for testing pipes.
// This is used by main test file ( t_pipe.cpp) for testing
// pipes in multiprocess environment.
// 
//

#define __E32TEST_EXTENSION__
#include <e32test.h>
#include <e32svr.h>
#include <rpipe.h>


LOCAL_D RTest test(_L("t_pipe2"));
_LIT(KPipeName5, "InterProcessPipe1");


_LIT8(KTestDataIP, "ABCDEFGHIJ");
_LIT8(KTestData,"Pipe Data To Be Passed");

LOCAL_C void RunTests(void)
	{
	test.Start(_L("Testing In Pipe Process 2"));

	TInt 				ret;									// Return value variable

	RPipe 				aReader;
	RPipe 				aReaderUN;
	const	TBufC<50>	cPipeName1(KPipeName5);
	
	TBuf8<150>			cPipeReadData1;
	TInt				aSize;
	TRequestStatus		stat1;
	
	test.Next(_L("PIPE TEST: PipeProcess 2-1: Open Read Handle to unamed Pipe\n"));
	ret=aReaderUN.Open(3,EOwnerProcess);
	test_KErrNone(ret);

	test.Next(_L("PIPE TEST: PipeProcess 2-1.1: Get the UnNamed pipe read handle from another process \n"));
	ret = aReaderUN.Size();
	test (ret = 22);
	
	ret = aReaderUN.MaxSize();
	test (ret = 512);
	
	ret = aReaderUN.Read(cPipeReadData1,22);
	test (ret == 22);
	
	ret = 	cPipeReadData1.Compare(KTestData);
	test (ret == KErrNone);

	aReaderUN.Close();
	

	test.Next(_L("Open handle to named pipe\n"));

	aSize =10;
	ret = aReader.Open(cPipeName1, RPipe::EOpenToRead);
	test_KErrNone(ret);	

	test.Next(_L("PIPE TEST: PipeProcess 2-2: Wait till NotifyDataAvailable.\n"));

	aReader.NotifyDataAvailable(stat1);

	User::WaitForRequest(stat1);

	test.Next(_L("PIPE TEST: PipeProcess 2-3: Call ReadBlocking and Read the data.\n"));

	aReader.Flush(); 
	ret = aReader.ReadBlocking(cPipeReadData1,aSize);
	test_Equal(aSize, ret);
	ret = cPipeReadData1.Compare(KTestDataIP);
	test( ret== KErrNone);
		
	test.Next(_L("PIPE TEST: PipeProcess 2-4: Exit Process t_pipe2.\n"));
	aReader.Close();
	test.End();
	test.Close();
}

GLDEF_C TInt E32Main()
//
//
    {

	test.Title();

	RunTests();

	return KErrNone;
    }