0
|
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".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// e32test\realtime\t_write.cpp
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include <e32test.h>
|
|
19 |
#include "u32std.h"
|
|
20 |
#include "../misc/prbs.h"
|
|
21 |
|
|
22 |
LOCAL_D RTest test(_L("Remote Write"));
|
|
23 |
|
|
24 |
class RMySession : public RSessionBase
|
|
25 |
{
|
|
26 |
public:
|
|
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));}
|
|
31 |
};
|
|
32 |
|
|
33 |
void RunTest(RMessage2& aMsg,TPtr8& aDes)
|
|
34 |
{
|
|
35 |
// never return or complete message, just do lots of writes...
|
|
36 |
|
|
37 |
TUint seed[2];
|
|
38 |
seed[0]=0xadf85458;
|
|
39 |
seed[1]=0;
|
|
40 |
|
|
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);
|
|
45 |
if (!pS || !pD)
|
|
46 |
User::Panic(_L("OOM"),0);
|
|
47 |
|
|
48 |
RProcess().SetPriority(EPriorityLow);
|
|
49 |
FOREVER
|
|
50 |
{
|
|
51 |
TInt i;
|
|
52 |
for (i=0; i<16384; i++)
|
|
53 |
pS[i]=(TInt)Random(seed);
|
|
54 |
TInt r=aMsg.Write(0,s);
|
|
55 |
if (r!=KErrNone)
|
|
56 |
User::Panic(_L("WriteL"),r);
|
|
57 |
for (i=0; i<16384; i++)
|
|
58 |
{
|
|
59 |
if (pD[i]!=pS[i])
|
|
60 |
User::Panic(_L("ERROR"),i);
|
|
61 |
}
|
|
62 |
}
|
|
63 |
}
|
|
64 |
|
|
65 |
GLDEF_C TInt E32Main()
|
|
66 |
{
|
|
67 |
test.Title();
|
|
68 |
|
|
69 |
RServer2 srv;
|
|
70 |
srv.CreateGlobal(KNullDesC);
|
|
71 |
|
|
72 |
RMySession sess;
|
|
73 |
TRequestStatus stat;
|
|
74 |
sess.Connect(srv,stat);
|
|
75 |
|
|
76 |
RMessage2 m;
|
|
77 |
srv.Receive(m);
|
|
78 |
m.Complete(KErrNone); // connect message
|
|
79 |
|
|
80 |
User::WaitForRequest(stat); // connected
|
|
81 |
|
|
82 |
TPtr8 des(0,0);
|
|
83 |
sess.Test(des);
|
|
84 |
|
|
85 |
srv.Receive(m);
|
|
86 |
RunTest(m, des);
|
|
87 |
|
|
88 |
test.End();
|
|
89 |
return 0;
|
|
90 |
}
|
|
91 |
|