author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 23:56:21 +0300 | |
branch | RCL_3 |
changeset 45 | 9e2d4f7f5028 |
parent 42 | a179b74831c9 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 2008-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\demandpaging\t_svrpinning.cpp |
|
15 |
// Overview: |
|
16 |
// Test the pinning of RMessage descriptor arguments. |
|
17 |
// API Information: |
|
18 |
// RMessage2, RMessagePtr2, RSessionBase, CSession2, CServer2 |
|
19 |
// Details: |
|
20 |
// Platforms/Drives/Compatibility: |
|
21 |
// All. |
|
22 |
// Assumptions/Requirement/Pre-requisites: |
|
23 |
// Failures and causes: |
|
24 |
// Base Port information: |
|
25 |
// |
|
26 |
// |
|
27 |
||
28 |
#define __E32TEST_EXTENSION__ |
|
29 |
||
30 |
#include <e32std.h> |
|
31 |
#include <e32std_private.h> |
|
32 |
#include <e32def.h> |
|
33 |
#include <e32def_private.h> |
|
34 |
#include <e32test.h> |
|
6
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
35 |
#include <e32ver.h> |
0 | 36 |
#include <e32panic.h> |
37 |
#include <dptest.h> |
|
38 |
#include <u32hal.h> |
|
39 |
#include <hal.h> |
|
40 |
||
41 |
const TInt KHeapMinSize=0x1000; |
|
42 |
const TInt KHeapMaxSize=0x1000; |
|
43 |
||
44 |
const TUint KPageSize = 0x1000; |
|
45 |
TInt gPageSize; |
|
46 |
TUint gPageMask; |
|
47 |
TBool gDataPagingSupport = EFalse; |
|
48 |
TBool gProcessPaged; |
|
49 |
enum TServerPinning |
|
50 |
{ |
|
51 |
EServerDefault, |
|
52 |
EServerPinning, |
|
53 |
EServerNotPinning, |
|
54 |
EServerSetPinningTooLate, |
|
55 |
EServerPinningCount, |
|
56 |
}; |
|
57 |
TInt gServerPinningState; |
|
58 |
||
59 |
class CTestServer : public CServer2 |
|
60 |
{ |
|
61 |
public: |
|
62 |
CTestServer(TInt aPriority); |
|
63 |
protected: |
|
64 |
//override the pure virtual functions: |
|
65 |
virtual CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const; |
|
66 |
}; |
|
67 |
||
68 |
||
69 |
class CTestSession : public CSession2 |
|
70 |
{ |
|
71 |
public: |
|
72 |
enum TTestMode |
|
73 |
{ |
|
74 |
EStop, |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
75 |
ETestRdPinAll, |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
76 |
ETestRdUnpin3, |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
77 |
ETestRdUnpin2, |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
78 |
ETestRdUnpin1, |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
79 |
ETestRdUnpin0, |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
80 |
ETestWrPinAll, |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
81 |
ETestWrPinNone, |
0 | 82 |
ETestPinOOM, |
83 |
ETestPinDefault, |
|
84 |
ETestDeadServer, |
|
85 |
}; |
|
86 |
//Override pure virtual |
|
87 |
IMPORT_C virtual void ServiceL(const RMessage2& aMessage); |
|
88 |
private: |
|
89 |
TInt CheckDesPresent(const RMessage2& aMessage, TUint aArgIndex, TBool aExpected, TBool aWrite); |
|
90 |
TInt CheckArgsPresent(const RMessage2& aMessage, TBool arg0Present, TBool arg1Present, TBool arg2Present, TBool arg3Present, TBool aWrite); |
|
91 |
TBool iClientDied; |
|
92 |
}; |
|
93 |
||
94 |
||
95 |
class CMyActiveScheduler : public CActiveScheduler |
|
96 |
{ |
|
97 |
public: |
|
98 |
virtual void Error(TInt anError) const; //override pure virtual error function |
|
99 |
}; |
|
100 |
||
101 |
||
102 |
class RSession : public RSessionBase |
|
103 |
{ |
|
104 |
public: |
|
105 |
TInt PublicSendReceive(TInt aFunction, const TIpcArgs &aPtr) |
|
106 |
{ |
|
107 |
return (SendReceive(aFunction, aPtr)); |
|
108 |
} |
|
109 |
TInt PublicCreateSession(const TDesC& aServer,TInt aMessageSlots) |
|
110 |
{ |
|
111 |
return (CreateSession(aServer,User::Version(),aMessageSlots)); |
|
112 |
} |
|
113 |
}; |
|
114 |
||
115 |
||
116 |
_LIT(KServerName,"CTestServer"); |
|
117 |
||
118 |
TBool UpdateExpected(TBool aExpected) |
|
119 |
{ |
|
120 |
if (!gDataPagingSupport // Data paging is not supported so memory should always be present |
|
121 |
|| gServerPinningState == EServerPinning // The server is a pinning server. |
|
122 |
/*|| (gServerPinningState == EServerDefault && !gProcessPaged)*/// The process isn't paged and default server policy |
|
123 |
) |
|
124 |
{ |
|
125 |
aExpected = ETrue; |
|
126 |
} |
|
127 |
return aExpected; |
|
128 |
} |
|
129 |
||
130 |
||
131 |
CTestServer::CTestServer(TInt aPriority) |
|
132 |
// |
|
133 |
// Constructor - sets name |
|
134 |
// |
|
135 |
: CServer2(aPriority) |
|
136 |
{} |
|
137 |
||
138 |
CSession2* CTestServer::NewSessionL(const TVersion& aVersion,const RMessage2& /*aMessage*/) const |
|
139 |
// |
|
140 |
// Virtual fn - checks version supported and creates a CTestSession |
|
141 |
// |
|
142 |
{ |
|
143 |
TVersion version(KE32MajorVersionNumber,KE32MinorVersionNumber,KE32BuildVersionNumber); |
|
144 |
if (User::QueryVersionSupported(version,aVersion)==EFalse) |
|
145 |
User::Leave(KErrNotSupported); |
|
146 |
CTestSession* newCTestSession = new CTestSession; |
|
147 |
if (newCTestSession==NULL) |
|
148 |
User::Panic(_L("NewSessionL failure"), KErrNoMemory); |
|
149 |
return(newCTestSession); |
|
150 |
} |
|
151 |
||
152 |
RSemaphore gSem; |
|
153 |
RSemaphore gSem1; |
|
154 |
||
155 |
TInt CTestSession::CheckDesPresent(const RMessage2& aMessage, TUint aArgIndex, TBool aExpected, TBool aWrite) |
|
156 |
{ |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
157 |
TRequestStatus clientStat; |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
158 |
|
0 | 159 |
if (aExpected) |
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
160 |
{ |
0 | 161 |
RDebug::Printf(" Checking message argument at %d is present", aArgIndex); |
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
162 |
} |
0 | 163 |
else |
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
164 |
{ |
0 | 165 |
RDebug::Printf(" Checking message argument at %d is not present", aArgIndex); |
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
166 |
// Start watching for client thread death |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
167 |
RThread clientThread; |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
168 |
aMessage.Client(clientThread); |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
169 |
clientThread.Logon(clientStat); |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
170 |
clientThread.Close(); |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
171 |
} |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
172 |
|
0 | 173 |
// Get the length of the descriptor and verify it is as expected. |
174 |
TInt length = aMessage.GetDesLength(aArgIndex); |
|
175 |
if (length < KErrNone) |
|
176 |
{ |
|
177 |
RDebug::Printf(" Error getting descriptor length %d", length); |
|
178 |
return length; |
|
179 |
} |
|
180 |
if (length < 3) |
|
181 |
{// The incorrect descriptor length. |
|
182 |
RDebug::Printf(" Error - Descriptor length too small %d", length); |
|
183 |
return KErrArgument; |
|
184 |
} |
|
185 |
if (!aWrite) |
|
186 |
{// Now read the descriptor and verify that it is present or not. |
|
187 |
TBuf8<5> des; |
|
188 |
TInt r = aMessage.Read(aArgIndex, des); |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
189 |
if (r != (aExpected ? KErrNone : KErrBadDescriptor)) |
0 | 190 |
{ |
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
191 |
RDebug::Printf(" Unexpected value returned from aMessage.Read:%d", r); |
0 | 192 |
return KErrGeneral; |
193 |
} |
|
194 |
if (r==KErrNone && (des[0] != 'a' || des[1] != 'r' || des[2] != 'g')) |
|
195 |
{// The incorrect descriptor data has been passed. |
|
196 |
RDebug::Printf(" Error in descriptor data is corrupt r %d", r); |
|
197 |
return KErrArgument; |
|
198 |
} |
|
199 |
} |
|
200 |
else |
|
201 |
{// Now write to the maximum length of the descriptor. |
|
202 |
TInt max = aMessage.GetDesMaxLength(aArgIndex); |
|
203 |
if (max < 0) |
|
204 |
{ |
|
205 |
RDebug::Printf(" Error getting descriptor max. length %d", max); |
|
206 |
return length; |
|
207 |
} |
|
208 |
HBufC8* argTmp = HBufC8::New(max); |
|
209 |
TPtr8 argPtr = argTmp->Des(); |
|
210 |
argPtr.SetLength(max); |
|
211 |
for (TInt i = 0; i < max; i++) |
|
212 |
argPtr[i] = (TUint8)aArgIndex; |
|
213 |
TInt r = aMessage.Write(aArgIndex, argPtr); |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
214 |
if (r != (aExpected ? KErrNone : KErrBadDescriptor)) |
0 | 215 |
{ |
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
216 |
RDebug::Printf(" Unexpected value returned from aMessage.Write:%d", r); |
0 | 217 |
return KErrGeneral; |
218 |
} |
|
219 |
} |
|
220 |
||
221 |
if (!aExpected) |
|
222 |
{// The client should have been killed as the data wasn't present. |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
223 |
RDebug::Printf(" CheckDesPresent: Waiting for client to die"); |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
224 |
User::WaitForRequest(clientStat); |
0 | 225 |
iClientDied = ETrue; |
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
226 |
RDebug::Printf(" CheckDesPresent: Client dead"); |
0 | 227 |
} |
228 |
return KErrNone; |
|
229 |
} |
|
230 |
||
231 |
TInt CTestSession::CheckArgsPresent(const RMessage2& aMessage, TBool arg0Present, TBool arg1Present, TBool arg2Present, TBool arg3Present, TBool aWrite=EFalse) |
|
232 |
{ |
|
233 |
// Adjust the pinning status expected based on the default policies. |
|
234 |
// (Must do this before anything else as UpdateExpected() accessed paged global data) |
|
235 |
arg0Present = UpdateExpected(arg0Present); |
|
236 |
arg1Present = UpdateExpected(arg1Present); |
|
237 |
arg2Present = UpdateExpected(arg2Present); |
|
238 |
arg3Present = UpdateExpected(arg3Present); |
|
239 |
||
240 |
// Flush the cache so on paged systems, unpinned paged memory will be discarded. |
|
241 |
DPTest::FlushCache(); |
|
242 |
||
243 |
TInt r = User::SetRealtimeState(User::ERealtimeStateOn); |
|
244 |
if (r != KErrNone) |
|
245 |
{ |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
246 |
RDebug::Printf("CheckArgsPresent: Error setting realtime state r = %d", r); |
0 | 247 |
return r; |
248 |
} |
|
249 |
||
250 |
r = CheckDesPresent(aMessage, 0, arg0Present, aWrite); |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
251 |
if ((r == KErrNone) && !iClientDied) |
0 | 252 |
r = CheckDesPresent(aMessage, 1, arg1Present, aWrite); |
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
253 |
if ((r == KErrNone) && !iClientDied) |
0 | 254 |
r = CheckDesPresent(aMessage, 2, arg2Present, aWrite); |
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
255 |
if ((r == KErrNone) && !iClientDied) |
0 | 256 |
r = CheckDesPresent(aMessage, 3, arg3Present, aWrite); |
257 |
||
258 |
User::SetRealtimeState(User::ERealtimeStateOff); |
|
259 |
||
260 |
return r; |
|
261 |
} |
|
262 |
||
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
263 |
EXPORT_C void CTestSession::ServiceL(const RMessage2& aMessage) |
0 | 264 |
// |
265 |
// Virtual message-handler |
|
266 |
// |
|
267 |
{ |
|
268 |
TInt r = KErrNone; |
|
269 |
iClientDied = EFalse; |
|
270 |
switch (aMessage.Function()) |
|
271 |
{ |
|
272 |
case EStop: |
|
273 |
CActiveScheduler::Stop(); |
|
274 |
break; |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
275 |
case ETestRdPinAll: |
0 | 276 |
r = CheckArgsPresent(aMessage, ETrue, ETrue, ETrue, ETrue); |
277 |
break; |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
278 |
case ETestRdUnpin3: |
0 | 279 |
r = CheckArgsPresent(aMessage, ETrue, ETrue, ETrue, EFalse); |
280 |
break; |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
281 |
case ETestRdUnpin2: |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
282 |
r = CheckArgsPresent(aMessage, ETrue, ETrue, EFalse, ETrue); |
0 | 283 |
break; |
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
284 |
case ETestRdUnpin1: |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
285 |
r = CheckArgsPresent(aMessage, ETrue, EFalse, ETrue, ETrue); |
0 | 286 |
break; |
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
287 |
case ETestRdUnpin0: |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
288 |
r = CheckArgsPresent(aMessage, EFalse, ETrue, ETrue, ETrue); |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
289 |
break; |
0 | 290 |
case ETestPinDefault: |
291 |
r = CheckArgsPresent(aMessage, EFalse, EFalse, EFalse, EFalse); |
|
292 |
break; |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
293 |
case ETestWrPinAll: |
0 | 294 |
r = CheckArgsPresent(aMessage, ETrue, ETrue, ETrue, ETrue, ETrue); |
295 |
break; |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
296 |
case ETestWrPinNone: |
0 | 297 |
r = CheckArgsPresent(aMessage, EFalse, EFalse, EFalse, EFalse, ETrue); |
298 |
break; |
|
299 |
default: |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
300 |
RDebug::Printf("CTestSession::ServiceL Unsupported Function: %d", aMessage.Function()); |
0 | 301 |
r = KErrNotSupported; |
302 |
||
303 |
} |
|
304 |
aMessage.Complete(r); |
|
305 |
||
306 |
// If descriptors aren't as expected then panic so the test will fail. |
|
307 |
if (r != KErrNone) |
|
308 |
User::Panic(_L("ServiceL failure"), r); |
|
309 |
} |
|
310 |
||
311 |
// CTestSession funtions |
|
312 |
||
313 |
void CMyActiveScheduler::Error(TInt anError) const |
|
314 |
// |
|
315 |
// Virtual error handler |
|
316 |
// |
|
317 |
{ |
|
318 |
User::Panic(_L("CMyActiveScheduer::Error"), anError); |
|
319 |
} |
|
320 |
||
321 |
TInt ServerThread(TAny* aPinningAttrib) |
|
322 |
// |
|
323 |
// Passed as the server thread in 2 tests - sets up and runs CTestServer |
|
324 |
// |
|
325 |
{ |
|
326 |
RTest test(_L("T_SVRPINNING...server")); |
|
327 |
CMyActiveScheduler* pScheduler = new CMyActiveScheduler; |
|
328 |
if (pScheduler == NULL) |
|
329 |
{ |
|
330 |
gSem.Signal(); |
|
331 |
test(0); |
|
332 |
} |
|
333 |
||
334 |
CActiveScheduler::Install(pScheduler); |
|
335 |
||
336 |
CTestServer* pServer = new CTestServer(0); |
|
337 |
if (pServer == NULL) |
|
338 |
{ |
|
339 |
gSem.Signal(); |
|
340 |
test(0); |
|
341 |
} |
|
342 |
||
343 |
// Set the pinning attributes of the server. |
|
344 |
TServerPinning pinningAttrib = (TServerPinning)(TInt)aPinningAttrib; |
|
345 |
switch (pinningAttrib) |
|
346 |
{ |
|
347 |
case EServerDefault : |
|
348 |
case EServerSetPinningTooLate : |
|
349 |
break; |
|
350 |
case EServerPinning : |
|
351 |
pServer->SetPinClientDescriptors(ETrue); |
|
352 |
break; |
|
353 |
case EServerNotPinning : |
|
354 |
pServer->SetPinClientDescriptors(EFalse); |
|
355 |
break; |
|
356 |
default : |
|
357 |
break; |
|
358 |
} |
|
359 |
||
360 |
//Starting a CServer2 also Adds it to the ActiveScheduler |
|
361 |
TInt r = pServer->Start(KServerName); |
|
362 |
if (r != KErrNone) |
|
363 |
{ |
|
364 |
gSem.Signal(); |
|
365 |
test(0); |
|
366 |
} |
|
367 |
||
368 |
if (pinningAttrib == EServerSetPinningTooLate) |
|
369 |
{ |
|
370 |
pServer->SetPinClientDescriptors(EFalse); |
|
371 |
} |
|
372 |
||
373 |
test.Next(_L("Start ActiveScheduler and signal to client")); |
|
374 |
test.Printf(_L(" There might be something going on beneath this window\n")); |
|
375 |
gSem.Signal(); |
|
376 |
CActiveScheduler::Start(); |
|
377 |
test.Next(_L("Destroy ActiveScheduler")); |
|
378 |
delete pScheduler; |
|
379 |
delete pServer; |
|
380 |
||
381 |
test.Close(); |
|
382 |
||
383 |
return (KErrNone); |
|
384 |
} |
|
385 |
||
386 |
||
387 |
||
388 |
#include <e32svr.h> |
|
389 |
||
390 |
void dummyFunction(TUint8* /*a0*/, TUint8* /*a1*/, TUint8* /*a2*/, TUint8* /*a3*/, TUint8* /*a4*/, TUint8* /*a5*/) |
|
391 |
{ |
|
392 |
} |
|
393 |
||
394 |
TInt ClientThread(TAny* aTestMode) |
|
395 |
// |
|
396 |
// Passed as the first client thread - signals the server to do several tests |
|
397 |
// |
|
398 |
{ |
|
399 |
// Create the message arguments to be pinned. Should be one of each type of |
|
400 |
// descriptor to test that the pinning code can correctly pin each type |
|
401 |
// descriptor data. Each descriptor's data should in a separate page in |
|
402 |
// thread's stack to ensure that access to each argument will cause a |
|
403 |
// separate page fault. |
|
404 |
||
405 |
TUint8 argBufs[KPageSize*(6+2)]; // enough for 6 whole pages |
|
406 |
TUint8* argBuf0 = (TUint8*)(TUintPtr(argBufs+gPageMask)&~gPageMask); |
|
407 |
TUint8* argBuf1 = argBuf0+KPageSize; |
|
408 |
TUint8* argBuf2 = argBuf1+KPageSize; |
|
409 |
TUint8* argBuf3 = argBuf2+KPageSize; |
|
410 |
TUint8* argBuf4 = argBuf3+KPageSize; |
|
411 |
TUint8* argBuf5 = argBuf4+KPageSize; |
|
412 |
||
413 |
argBuf0[0]='a'; argBuf0[1]='r'; argBuf0[2]='g'; argBuf0[3]='0'; argBuf0[4]='\0'; |
|
414 |
TPtr8 arg0(argBuf0, 5, 20); |
|
415 |
||
416 |
TBufC8<5>& arg1 = *(TBufC8<5>*)argBuf1; |
|
417 |
new (&arg1) TBufC8<5>((const TUint8*)"arg1"); |
|
418 |
||
419 |
argBuf2[0]='a'; argBuf2[1]='r'; argBuf2[2]='g'; argBuf2[3]='1'; argBuf2[4]='\0'; |
|
420 |
TPtrC8 arg2((const TUint8*)argBuf2); |
|
421 |
||
422 |
TBuf8<50>& arg3 = *(TBuf8<50>*)argBuf3; |
|
423 |
new (&arg3) TBuf8<50>((const TUint8*)"arg3"); |
|
424 |
||
425 |
// For some tests use this 5th and final type of descriptor. |
|
426 |
HBufC8* argTmp = HBufC8::New(7); |
|
427 |
*argTmp = (const TUint8*)"argTmp"; |
|
428 |
RBuf8 argTmpBuf(argTmp); |
|
429 |
||
430 |
// Need a couple of extra writable argments |
|
431 |
argBuf4[0]='a'; argBuf4[1]='r'; argBuf4[2]='g'; argBuf4[3]='4'; argBuf4[4]='\0'; |
|
432 |
TPtr8 arg4(argBuf4, 5, 20); |
|
433 |
argBuf5[0]='a'; argBuf5[1]='r'; argBuf5[2]='g'; argBuf5[3]='5'; argBuf5[4]='\0'; |
|
434 |
TPtr8 arg5(argBuf5, 5, 20); |
|
435 |
||
436 |
RTest test(_L("T_SVRPINNING...client")); |
|
437 |
RSession session; |
|
438 |
TInt r = session.PublicCreateSession(_L("CTestServer"),5); |
|
439 |
if (r != KErrNone) |
|
440 |
{ |
|
441 |
gSem.Signal(); |
|
442 |
test(0); |
|
443 |
} |
|
444 |
||
445 |
switch((TInt)aTestMode) |
|
446 |
{ |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
447 |
case CTestSession::ETestRdPinAll: |
0 | 448 |
test.Printf(_L("Test pinning all args\n")); |
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
449 |
r = session.PublicSendReceive(CTestSession::ETestRdPinAll, TIpcArgs(&arg0, &arg1, &arg2, &arg3).PinArgs()); |
0 | 450 |
break; |
451 |
||
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
452 |
case CTestSession::ETestRdUnpin3: |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
453 |
test.Printf(_L("Read Arg3 unpinned\n")); |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
454 |
r = session.PublicSendReceive(CTestSession::ETestRdUnpin3, TIpcArgs(&arg0, argTmp, &argTmpBuf, &arg3).PinArgs(ETrue, ETrue, ETrue, EFalse)); |
0 | 455 |
break; |
456 |
||
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
457 |
case CTestSession::ETestRdUnpin2: |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
458 |
test.Printf(_L("Read Arg2 unpinned\n")); |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
459 |
r = session.PublicSendReceive(CTestSession::ETestRdUnpin2, TIpcArgs(argTmp, &arg1, &arg2, &arg3).PinArgs(ETrue, ETrue, EFalse, ETrue)); |
0 | 460 |
break; |
461 |
||
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
462 |
case CTestSession::ETestRdUnpin1: |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
463 |
test.Printf(_L("Read Arg1 unpinned\n")); |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
464 |
r = session.PublicSendReceive(CTestSession::ETestRdUnpin1, TIpcArgs(&argTmpBuf, &arg1, &arg2, &arg3).PinArgs(ETrue, EFalse, ETrue, ETrue)); |
0 | 465 |
break; |
466 |
||
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
467 |
case CTestSession::ETestRdUnpin0: |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
468 |
test.Printf(_L("Read Arg0 unpinned\n")); |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
469 |
r = session.PublicSendReceive(CTestSession::ETestRdUnpin0, TIpcArgs(&arg0, &arg1, &arg2, &arg3).PinArgs(EFalse, ETrue, ETrue, ETrue)); |
0 | 470 |
break; |
471 |
||
472 |
case CTestSession::ETestPinDefault: |
|
473 |
test.Printf(_L("Test the default pinning policy of this server\n")); |
|
474 |
r = session.PublicSendReceive(CTestSession::ETestPinDefault, TIpcArgs(&arg0, &arg1, &arg2, argTmp)); |
|
475 |
break; |
|
476 |
||
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
477 |
case CTestSession::ETestWrPinAll: |
0 | 478 |
test.Printf(_L("Test writing to pinned descriptors\n")); |
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
479 |
r = session.PublicSendReceive(CTestSession::ETestWrPinAll, TIpcArgs(&arg0, &arg3, &arg4, &arg5).PinArgs(ETrue, ETrue, ETrue, ETrue)); |
0 | 480 |
// Verify the index of each argument has been written to each descriptor. |
481 |
{ |
|
482 |
TUint maxLength = arg0.MaxLength(); |
|
483 |
test_Equal(maxLength, arg0.Length()); |
|
484 |
TUint j = 0; |
|
485 |
for (; j < maxLength; j++) |
|
486 |
test_Equal(0, arg0[j]); |
|
487 |
maxLength = arg3.MaxLength(); |
|
488 |
test_Equal(maxLength, arg3.Length()); |
|
489 |
for (j = 0; j < maxLength; j++) |
|
490 |
test_Equal(1, arg3[j]); |
|
491 |
maxLength = arg4.MaxLength(); |
|
492 |
test_Equal(maxLength, arg4.Length()); |
|
493 |
for (j = 0; j < maxLength; j++) |
|
494 |
test_Equal(2, arg4[j]); |
|
495 |
maxLength = arg5.MaxLength(); |
|
496 |
test_Equal(maxLength, arg5.Length()); |
|
497 |
for (j = 0; j < maxLength; j++) |
|
498 |
test_Equal(3, arg5[j]); |
|
499 |
} |
|
500 |
break; |
|
501 |
||
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
502 |
case CTestSession::ETestWrPinNone: |
0 | 503 |
test.Printf(_L("Test writing to unpinned descriptors\n")); |
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
504 |
r = session.PublicSendReceive(CTestSession::ETestWrPinNone, TIpcArgs(&arg0, &arg3, &arg4, &arg5).PinArgs(EFalse, EFalse, EFalse, EFalse)); |
0 | 505 |
// Verify the index of each argument has been written to each descriptor. |
506 |
// Unless this is a pinnning server than the thread will be panicked before we reach there. |
|
507 |
{ |
|
508 |
TUint maxLength = arg0.MaxLength(); |
|
509 |
test_Equal(maxLength, arg0.Length()); |
|
510 |
TUint j = 0; |
|
511 |
for (j = 0; j < maxLength; j++) |
|
512 |
test_Equal(0, arg0[j]); |
|
513 |
maxLength = arg3.MaxLength(); |
|
514 |
test_Equal(maxLength, arg3.Length()); |
|
515 |
for (j = 0; j < maxLength; j++) |
|
516 |
test_Equal(1, arg3[j]); |
|
517 |
maxLength = arg4.MaxLength(); |
|
518 |
test_Equal(maxLength, arg4.Length()); |
|
519 |
for (j = 0; j < maxLength; j++) |
|
520 |
test_Equal(2, arg4[j]); |
|
521 |
maxLength = arg5.MaxLength(); |
|
522 |
test_Equal(maxLength, arg5.Length()); |
|
523 |
for (j = 0; j < maxLength; j++) |
|
524 |
test_Equal(3, arg5[j]); |
|
525 |
} |
|
526 |
break; |
|
527 |
||
528 |
case CTestSession::ETestDeadServer: |
|
529 |
test.Printf(_L("Test pinning to dead server\n")); |
|
530 |
gSem.Signal(); |
|
531 |
gSem1.Wait(); |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
532 |
r = session.PublicSendReceive(CTestSession::ETestRdPinAll, TIpcArgs(&arg0, &arg1, &arg2, &arg3).PinArgs()); |
0 | 533 |
break; |
534 |
||
535 |
case CTestSession::ETestPinOOM: |
|
536 |
test.Printf(_L("Pinning OOM tests\n")); |
|
537 |
__KHEAP_MARK; |
|
538 |
const TUint KMaxKernelAllocations = 1024; |
|
539 |
TUint i; |
|
540 |
r = KErrNoMemory; |
|
541 |
for (i = 0; i < KMaxKernelAllocations && r == KErrNoMemory; i++) |
|
542 |
{ |
|
543 |
__KHEAP_FAILNEXT(i); |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
544 |
r = session.PublicSendReceive(CTestSession::ETestRdPinAll, TIpcArgs(&arg0, &arg1, &arg2, &arg3).PinArgs()); |
0 | 545 |
__KHEAP_RESET; |
546 |
} |
|
547 |
test.Printf(_L("SendReceive took %d tries\n"),i); |
|
548 |
test_KErrNone(r); |
|
549 |
||
550 |
__KHEAP_MARKEND; |
|
551 |
break; |
|
552 |
} |
|
553 |
||
554 |
session.Close(); |
|
555 |
test.Close(); |
|
556 |
return r; |
|
557 |
} |
|
558 |
||
559 |
||
560 |
GLDEF_C TInt E32Main() |
|
561 |
{ |
|
562 |
RTest test(_L("T_SVRPINNING...main")); |
|
563 |
test.Title(); |
|
564 |
||
565 |
||
566 |
if (DPTest::Attributes() & DPTest::ERomPaging) |
|
567 |
test.Printf(_L("Rom paging supported\n")); |
|
568 |
if (DPTest::Attributes() & DPTest::ECodePaging) |
|
569 |
test.Printf(_L("Code paging supported\n")); |
|
570 |
if (DPTest::Attributes() & DPTest::EDataPaging) |
|
571 |
{ |
|
572 |
test.Printf(_L("Data paging supported\n")); |
|
573 |
gDataPagingSupport = ETrue; |
|
574 |
} |
|
575 |
||
576 |
// Determine the data paging attribute. |
|
577 |
RProcess process; // Default to point to current process. |
|
578 |
gProcessPaged = process.DefaultDataPaged(); |
|
579 |
test.Printf(_L("Process data paged %x\n"), gProcessPaged); |
|
580 |
||
581 |
test.Start(_L("Test IPC message arguments pinning")); |
|
582 |
test_KErrNone(HAL::Get(HAL::EMemoryPageSize, gPageSize)); |
|
583 |
gPageMask = gPageSize - 1; |
|
584 |
test_Equal(KPageSize, gPageSize); |
|
585 |
// Disable JIT as we are testing panics and don't want the emulator to hang. |
|
586 |
TBool justInTime = User::JustInTime(); |
|
587 |
User::SetJustInTime(EFalse); |
|
588 |
||
589 |
TBool exitFailure = EFalse; |
|
590 |
for ( gServerPinningState = EServerDefault; |
|
591 |
gServerPinningState < EServerSetPinningTooLate && !exitFailure; |
|
592 |
gServerPinningState++) |
|
593 |
{ |
|
594 |
// Create the server with the specified pinning mode. |
|
595 |
switch (gServerPinningState) |
|
596 |
{ |
|
597 |
case EServerDefault : |
|
598 |
test.Next(_L("Test server with default pinning policy")); |
|
599 |
break; |
|
600 |
case EServerPinning : |
|
601 |
test.Next(_L("Test server with pinning policy")); |
|
602 |
break; |
|
603 |
case EServerNotPinning : |
|
604 |
test.Next(_L("Test server with not pinning policy")); |
|
605 |
break; |
|
606 |
} |
|
607 |
test_KErrNone(gSem.CreateLocal(0)); |
|
608 |
test_KErrNone(gSem1.CreateLocal(0)); |
|
609 |
// Create the server thread it needs to have a unpaged stack and heap. |
|
610 |
TThreadCreateInfo serverInfo(_L("Server Thread"), ServerThread, KDefaultStackSize, (TAny*)gServerPinningState); |
|
611 |
serverInfo.SetPaging(TThreadCreateInfo::EUnpaged); |
|
612 |
serverInfo.SetCreateHeap(KHeapMinSize, KHeapMaxSize); |
|
613 |
RThread serverThread; |
|
614 |
test_KErrNone(serverThread.Create(serverInfo)); |
|
615 |
TRequestStatus serverStat; |
|
616 |
serverThread.Logon(serverStat); |
|
617 |
serverThread.Resume(); |
|
618 |
||
619 |
// Wait for the server to start and then create a session to it. |
|
620 |
gSem.Wait(); |
|
621 |
RSession session; |
|
622 |
test_KErrNone(session.PublicCreateSession(_L("CTestServer"),5)); |
|
623 |
||
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
624 |
for ( TUint clientTest = CTestSession::ETestRdPinAll; |
0 | 625 |
clientTest <= CTestSession::ETestPinDefault && !exitFailure; |
626 |
clientTest++) |
|
627 |
{ |
|
628 |
// Create the client thread it needs to have a paged stack and heap. |
|
629 |
TThreadCreateInfo clientInfo(_L("Client Thread"), ClientThread, 10 * gPageSize, (TAny*)clientTest); |
|
630 |
clientInfo.SetPaging(TThreadCreateInfo::EPaged); |
|
631 |
clientInfo.SetCreateHeap(KHeapMinSize, KHeapMaxSize); |
|
632 |
RThread clientThread; |
|
633 |
test_KErrNone(clientThread.Create(clientInfo)); |
|
634 |
||
635 |
TRequestStatus clientStat; |
|
636 |
clientThread.Logon(clientStat); |
|
637 |
clientThread.Resume(); |
|
638 |
||
639 |
// Wait for the client thread to end. |
|
640 |
User::WaitForRequest(clientStat); |
|
641 |
||
642 |
// If all the descriptor arguments were not pinned then the client |
|
643 |
// thread should have been panicked. |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
644 |
TBool expectPanic = (clientTest == CTestSession::ETestRdPinAll || |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
645 |
clientTest == CTestSession::ETestWrPinAll || |
0 | 646 |
clientTest == CTestSession::ETestPinOOM )? 0 : 1; |
647 |
expectPanic = !UpdateExpected(!expectPanic); |
|
648 |
||
649 |
TInt exitReason = clientThread.ExitReason(); |
|
650 |
TInt exitType = clientThread.ExitType(); |
|
651 |
if (expectPanic) |
|
652 |
{ |
|
653 |
if (exitType != EExitPanic || |
|
654 |
exitReason != EIllegalFunctionForRealtimeThread || |
|
655 |
clientThread.ExitCategory() != _L("KERN-EXEC")) |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
656 |
{ |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
657 |
test.Printf(_L("Thread didn't panic as expected\n")); |
0 | 658 |
exitFailure = ETrue; |
659 |
} |
|
660 |
} |
|
661 |
else |
|
662 |
{ |
|
663 |
if (exitType != EExitKill || exitReason != KErrNone) |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
664 |
{ |
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
665 |
test.Printf(_L("Thread didn't exit gracefully as expected\n")); |
0 | 666 |
exitFailure = ETrue; |
667 |
} |
|
668 |
} |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
669 |
test(!exitFailure); |
0 | 670 |
CLOSE_AND_WAIT(clientThread); |
671 |
} |
|
672 |
||
673 |
test.Next(_L("Test client sending message to closed server")); |
|
674 |
TThreadCreateInfo clientInfo(_L("Client Thread"), ClientThread, 10 * gPageSize, (TAny*)CTestSession::ETestDeadServer); |
|
675 |
clientInfo.SetPaging(TThreadCreateInfo::EPaged); |
|
676 |
clientInfo.SetCreateHeap(KHeapMinSize, KHeapMaxSize); |
|
677 |
RThread clientThread; |
|
678 |
test_KErrNone(clientThread.Create(clientInfo)); |
|
679 |
TRequestStatus clientStat; |
|
680 |
clientThread.Logon(clientStat); |
|
681 |
clientThread.Resume(); |
|
682 |
gSem.Wait(); |
|
683 |
||
684 |
// Signal to stop ActiveScheduler and wait for server to stop. |
|
685 |
session.PublicSendReceive(CTestSession::EStop, TIpcArgs()); |
|
686 |
session.Close(); |
|
687 |
User::WaitForRequest(serverStat); |
|
688 |
if (serverThread.ExitType() != EExitKill) |
|
689 |
{ |
|
42
a179b74831c9
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
6
diff
changeset
|
690 |
test.Printf(_L("!!Server thread did something bizarre %d\n"), serverThread.ExitReason()); |
0 | 691 |
} |
692 |
||
693 |
gSem1.Signal(); |
|
694 |
User::WaitForRequest(clientStat); |
|
695 |
test_Equal(EExitKill, clientThread.ExitType()); |
|
696 |
test_Equal(KErrServerTerminated, clientThread.ExitReason()); |
|
697 |
||
698 |
CLOSE_AND_WAIT(clientThread); |
|
699 |
CLOSE_AND_WAIT(serverThread); |
|
700 |
CLOSE_AND_WAIT(gSem); |
|
701 |
CLOSE_AND_WAIT(gSem1); |
|
702 |
} |
|
703 |
||
704 |
test.Next(_L("Test server setting pinning policy after server started")); |
|
705 |
RThread serverThread; |
|
706 |
test_KErrNone(serverThread.Create(_L("Server Thread"),ServerThread,KDefaultStackSize,KHeapMinSize,KHeapMaxSize, (TAny*)gServerPinningState)); |
|
707 |
TRequestStatus serverStat; |
|
708 |
serverThread.Logon(serverStat); |
|
709 |
serverThread.Resume(); |
|
710 |
// The server should have panicked with E32USER-CBase 106. |
|
711 |
User::WaitForRequest(serverStat); |
|
712 |
TInt exitReason = serverThread.ExitReason(); |
|
713 |
TInt exitType = serverThread.ExitType(); |
|
714 |
test_Equal(EExitPanic, exitType); |
|
715 |
test_Equal(ECServer2InvalidSetPin, exitReason); |
|
716 |
if (_L("E32USER-CBase") != serverThread.ExitCategory()) |
|
717 |
test(0); |
|
718 |
CLOSE_AND_WAIT(serverThread); |
|
719 |
||
720 |
test.End(); |
|
721 |
||
722 |
// Set JIT back to original state. |
|
723 |
User::SetJustInTime(justInTime); |
|
724 |
||
725 |
return (KErrNone); |
|
726 |
} |