First public contribution.
1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\realtime\t_write.cpp
20 #include "../misc/prbs.h"
22 LOCAL_D RTest test(_L("Remote Write"));
24 class RMySession : public RSessionBase
27 TInt Connect(RServer2 aSrv,TRequestStatus& aStat)
28 {return CreateSession(aSrv,TVersion(),1,EIpcSession_Unsharable,0,&aStat);}
29 void Test(TDes8& aDes)
30 {Send(0,TIpcArgs(&aDes));}
33 void RunTest(RMessage2& aMsg,TPtr8& aDes)
35 // never return or complete message, just do lots of writes...
41 TInt* pS=(TInt*)User::Alloc(65536);
42 TInt* pD=(TInt*)User::Alloc(65536);
43 TPtrC8 s((TUint8*)pS,65536);
44 aDes.Set((TUint8*)pD,0,65536);
46 User::Panic(_L("OOM"),0);
48 RProcess().SetPriority(EPriorityLow);
52 for (i=0; i<16384; i++)
53 pS[i]=(TInt)Random(seed);
54 TInt r=aMsg.Write(0,s);
56 User::Panic(_L("WriteL"),r);
57 for (i=0; i<16384; i++)
60 User::Panic(_L("ERROR"),i);
65 GLDEF_C TInt E32Main()
70 srv.CreateGlobal(KNullDesC);
74 sess.Connect(srv,stat);
78 m.Complete(KErrNone); // connect message
80 User::WaitForRequest(stat); // connected