sl@0
|
1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\realtime\t_write.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <e32test.h>
|
sl@0
|
19 |
#include "u32std.h"
|
sl@0
|
20 |
#include "../misc/prbs.h"
|
sl@0
|
21 |
|
sl@0
|
22 |
LOCAL_D RTest test(_L("Remote Write"));
|
sl@0
|
23 |
|
sl@0
|
24 |
class RMySession : public RSessionBase
|
sl@0
|
25 |
{
|
sl@0
|
26 |
public:
|
sl@0
|
27 |
TInt Connect(RServer2 aSrv,TRequestStatus& aStat)
|
sl@0
|
28 |
{return CreateSession(aSrv,TVersion(),1,EIpcSession_Unsharable,0,&aStat);}
|
sl@0
|
29 |
void Test(TDes8& aDes)
|
sl@0
|
30 |
{Send(0,TIpcArgs(&aDes));}
|
sl@0
|
31 |
};
|
sl@0
|
32 |
|
sl@0
|
33 |
void RunTest(RMessage2& aMsg,TPtr8& aDes)
|
sl@0
|
34 |
{
|
sl@0
|
35 |
// never return or complete message, just do lots of writes...
|
sl@0
|
36 |
|
sl@0
|
37 |
TUint seed[2];
|
sl@0
|
38 |
seed[0]=0xadf85458;
|
sl@0
|
39 |
seed[1]=0;
|
sl@0
|
40 |
|
sl@0
|
41 |
TInt* pS=(TInt*)User::Alloc(65536);
|
sl@0
|
42 |
TInt* pD=(TInt*)User::Alloc(65536);
|
sl@0
|
43 |
TPtrC8 s((TUint8*)pS,65536);
|
sl@0
|
44 |
aDes.Set((TUint8*)pD,0,65536);
|
sl@0
|
45 |
if (!pS || !pD)
|
sl@0
|
46 |
User::Panic(_L("OOM"),0);
|
sl@0
|
47 |
|
sl@0
|
48 |
RProcess().SetPriority(EPriorityLow);
|
sl@0
|
49 |
FOREVER
|
sl@0
|
50 |
{
|
sl@0
|
51 |
TInt i;
|
sl@0
|
52 |
for (i=0; i<16384; i++)
|
sl@0
|
53 |
pS[i]=(TInt)Random(seed);
|
sl@0
|
54 |
TInt r=aMsg.Write(0,s);
|
sl@0
|
55 |
if (r!=KErrNone)
|
sl@0
|
56 |
User::Panic(_L("WriteL"),r);
|
sl@0
|
57 |
for (i=0; i<16384; i++)
|
sl@0
|
58 |
{
|
sl@0
|
59 |
if (pD[i]!=pS[i])
|
sl@0
|
60 |
User::Panic(_L("ERROR"),i);
|
sl@0
|
61 |
}
|
sl@0
|
62 |
}
|
sl@0
|
63 |
}
|
sl@0
|
64 |
|
sl@0
|
65 |
GLDEF_C TInt E32Main()
|
sl@0
|
66 |
{
|
sl@0
|
67 |
test.Title();
|
sl@0
|
68 |
|
sl@0
|
69 |
RServer2 srv;
|
sl@0
|
70 |
srv.CreateGlobal(KNullDesC);
|
sl@0
|
71 |
|
sl@0
|
72 |
RMySession sess;
|
sl@0
|
73 |
TRequestStatus stat;
|
sl@0
|
74 |
sess.Connect(srv,stat);
|
sl@0
|
75 |
|
sl@0
|
76 |
RMessage2 m;
|
sl@0
|
77 |
srv.Receive(m);
|
sl@0
|
78 |
m.Complete(KErrNone); // connect message
|
sl@0
|
79 |
|
sl@0
|
80 |
User::WaitForRequest(stat); // connected
|
sl@0
|
81 |
|
sl@0
|
82 |
TPtr8 des(0,0);
|
sl@0
|
83 |
sess.Test(des);
|
sl@0
|
84 |
|
sl@0
|
85 |
srv.Receive(m);
|
sl@0
|
86 |
RunTest(m, des);
|
sl@0
|
87 |
|
sl@0
|
88 |
test.End();
|
sl@0
|
89 |
return 0;
|
sl@0
|
90 |
}
|
sl@0
|
91 |
|