|
1 // Copyright (c) 2003-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 "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 // This contains ESock Test cases from section 3 |
|
15 // |
|
16 // |
|
17 |
|
18 // EPOC includes |
|
19 #include <e32base.h> |
|
20 #include <es_mbman.h> |
|
21 |
|
22 // Test system includes |
|
23 //#include <networking/log.h> |
|
24 //#include <networking/teststep.h> |
|
25 //#include <networking/testsuite.h> |
|
26 |
|
27 #include "TestStepRootServer.h" |
|
28 #include "TestAsynchHandler.h" |
|
29 |
|
30 #include "RootServerTest.h" |
|
31 #include "RootServerTestSection3.h" |
|
32 #include <es_mbman.h> |
|
33 |
|
34 |
|
35 // Note: Test step 3.1 was a RRootServ::Connect() test; this is now obsolete |
|
36 |
|
37 // Test step 3.2 - SetMBufPoolSize After LoadServer |
|
38 CRootServerTest3_2::CRootServerTest3_2(CTE_RootServerServer *aSuite) : CTestStepRootServer(aSuite) |
|
39 { |
|
40 // store the name of this test case |
|
41 SetTestStepName(_L("Test3.2")); |
|
42 } |
|
43 |
|
44 |
|
45 TVerdict CRootServerTest3_2::doTestStepL( void ) |
|
46 { |
|
47 SetTestStepResult(EPass); |
|
48 INFO_PRINTF1(_L("Test Purpose: SetMBufPoolSize After LoadServer")); |
|
49 |
|
50 // Create scheduler/active object framework |
|
51 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
52 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
53 |
|
54 INFO_PRINTF2(_L("01 Loading test module: %S"), &KModule1()); |
|
55 LoadNormalModuleL(asynchHandler, KModule1); |
|
56 |
|
57 // uninstall and destroy active scheduler |
|
58 CleanupStack::PopAndDestroy(asynchHandler); |
|
59 CleanupStack::PopAndDestroy(scheduler); |
|
60 |
|
61 // now try to set the buffer pool size |
|
62 INFO_PRINTF1(_L("03 Setting MBufPoolSize")); |
|
63 TInt ret = iRootServerSuite->RootSess().SetMBufPoolSize(0,KMBufDefaultHeapSize); |
|
64 INFO_PRINTF2(_L("SetMBufPoolSize returned %d"), ret); |
|
65 if (KErrInUse != ret) |
|
66 { |
|
67 SetTestStepResult(EFail); |
|
68 } |
|
69 |
|
70 return TestStepResult(); |
|
71 } |
|
72 |
|
73 // Test step 3.5 - Retrieve Module Information |
|
74 CRootServerTest3_DblLoad::CRootServerTest3_DblLoad(CTE_RootServerServer *aSuite) : CTestStepRootServer(aSuite) |
|
75 { |
|
76 } |
|
77 |
|
78 |
|
79 TVerdict CRootServerTest3_DblLoad::LoadSameModuleTwiceL(TThreadPriority aPriority) |
|
80 { |
|
81 SetTestStepResult(EPass); |
|
82 // Create scheduler/active object framework |
|
83 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
84 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
85 |
|
86 TRSStartModuleParams startParams; |
|
87 TTestModuleIniData iniData; |
|
88 DefaultStartParams(startParams, iniData); |
|
89 startParams.iParams.iName = KModule1; |
|
90 startParams.iParams.iPriority = aPriority; |
|
91 |
|
92 INFO_PRINTF2(_L("02 Loading module: %S"), &startParams.iParams.iName); |
|
93 asynchHandler->TryLoad(startParams, iniData); |
|
94 |
|
95 CActiveScheduler::Start(); |
|
96 |
|
97 if (asynchHandler->iStatus != KErrNone) |
|
98 { |
|
99 INFO_PRINTF2(_L("LoadServer returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
100 User::Leave(asynchHandler->iStatus.Int()); |
|
101 } |
|
102 |
|
103 // try to load same module again |
|
104 INFO_PRINTF1(_L("03 Trying to load same module again")); |
|
105 asynchHandler->TryLoad(startParams, iniData); |
|
106 CActiveScheduler::Start(); |
|
107 |
|
108 INFO_PRINTF2(_L("LoadServer returned %d"), asynchHandler->iStatus.Int()); |
|
109 if (asynchHandler->iStatus != KErrRSModuleAlreadyExist) |
|
110 { |
|
111 SetTestStepResult(EFail); |
|
112 } |
|
113 // uninstall and destroy active scheduler |
|
114 CleanupStack::PopAndDestroy(asynchHandler); |
|
115 CleanupStack::PopAndDestroy(scheduler); |
|
116 |
|
117 return TestStepResult(); |
|
118 } |
|
119 |
|
120 // Test step 3.3 - Load Same Module Twice |
|
121 CRootServerTest3_3::CRootServerTest3_3(CTE_RootServerServer *aSuite) : CRootServerTest3_DblLoad(aSuite) |
|
122 { |
|
123 // store the name of this test case |
|
124 SetTestStepName(_L("Test3.3")); |
|
125 } |
|
126 |
|
127 TVerdict CRootServerTest3_3::doTestStepL( void ) |
|
128 { |
|
129 INFO_PRINTF1(_L("Test Purpose: Load Same Module Twice (normal priority)")); |
|
130 return LoadSameModuleTwiceL(EPriorityNormal); |
|
131 } |
|
132 |
|
133 // Test step 3.4 - Load Same Module Twice with elevated priority |
|
134 CRootServerTest3_4::CRootServerTest3_4(CTE_RootServerServer *aSuite) : CRootServerTest3_DblLoad(aSuite) |
|
135 { |
|
136 // store the name of this test case |
|
137 SetTestStepName(_L("Test3.4")); |
|
138 } |
|
139 |
|
140 TVerdict CRootServerTest3_4::doTestStepL( void ) |
|
141 { |
|
142 INFO_PRINTF1(_L("Test Purpose: Load Same Module Twice (elevated priority)")); |
|
143 return LoadSameModuleTwiceL(EPriorityRealTime); |
|
144 } |
|
145 |
|
146 |
|
147 // Test step 3.5 - Retrieve Module Information |
|
148 CRootServerTest3_5::CRootServerTest3_5(CTE_RootServerServer *aSuite) : CTestStepRootServer(aSuite) |
|
149 { |
|
150 // store the name of this test case |
|
151 SetTestStepName(_L("Test3.5")); |
|
152 } |
|
153 |
|
154 TVerdict CRootServerTest3_5::doTestStepL( void ) |
|
155 { |
|
156 SetTestStepResult(EPass); |
|
157 INFO_PRINTF1(_L("Test Purpose: Retrieve Module Information")); |
|
158 |
|
159 // Create scheduler/active object framework |
|
160 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
161 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
162 |
|
163 TRSStartModuleParams startParams; |
|
164 TTestModuleIniData iniData; |
|
165 DefaultStartParams(startParams, iniData); |
|
166 startParams.iParams.iName = KModule1; |
|
167 |
|
168 INFO_PRINTF2(_L("02 Loading module: %S"), &startParams.iParams.iName); |
|
169 asynchHandler->TryLoad(startParams, iniData); |
|
170 CActiveScheduler::Start(); |
|
171 |
|
172 if (asynchHandler->iStatus != KErrNone) |
|
173 { |
|
174 INFO_PRINTF2(_L("LoadServer returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
175 User::Leave(asynchHandler->iStatus.Int()); |
|
176 } |
|
177 CleanupStack::PopAndDestroy(asynchHandler); |
|
178 CleanupStack::PopAndDestroy(scheduler); |
|
179 |
|
180 // now try to retrieve information about the module |
|
181 INFO_PRINTF1(_L("03 Getting module information")); |
|
182 TRSModuleInfo info; |
|
183 TCFModuleName moduleName = KModule1(); |
|
184 TInt ret = iRootServerSuite->RootSess().GetModuleInfo(moduleName, info); |
|
185 INFO_PRINTF3(_L("GetModuleInfo for %S returned %d"), &moduleName, ret); |
|
186 |
|
187 if(KErrNone != ret) |
|
188 { |
|
189 SetTestStepResult(EFail); return TestStepResult(); |
|
190 } |
|
191 |
|
192 Log(_L("Filename %S, State %d, NumSubmodules %d"), |
|
193 &info.iParams.iDll, info.iParams.iState, info.iParams.iNumSubModules); |
|
194 |
|
195 if (startParams.iParams.iFilename != info.iParams.iDll || |
|
196 ERunning != info.iParams.iState || |
|
197 3 != info.iParams.iNumSubModules) |
|
198 { |
|
199 SetTestStepResult(EFail); |
|
200 return TestStepResult(); |
|
201 } |
|
202 |
|
203 // now ask for info about a non-existent module |
|
204 INFO_PRINTF1(_L("04 Getting module information for non-existent module")); |
|
205 |
|
206 moduleName = KModule2; |
|
207 ret = iRootServerSuite->RootSess().GetModuleInfo(moduleName, info); |
|
208 INFO_PRINTF3(_L("GetModuleInfo for %S returned %d"), &moduleName, ret); |
|
209 |
|
210 if(KErrRSModuleUnknown != ret) |
|
211 { |
|
212 SetTestStepResult(EFail); |
|
213 return TestStepResult(); |
|
214 } |
|
215 |
|
216 return TestStepResult(); |
|
217 } |
|
218 |
|
219 |
|
220 // Test step 3.6 - CancelLoadModule Before Thread Starts |
|
221 CRootServerTest3_6::CRootServerTest3_6(CTE_RootServerServer *aSuite) : CTestStepRootServer(aSuite) |
|
222 { |
|
223 // store the name of this test case |
|
224 SetTestStepName(_L("Test3.6")); |
|
225 } |
|
226 |
|
227 TVerdict CRootServerTest3_6::doTestStepL( void ) |
|
228 { |
|
229 SetTestStepResult(EPass); |
|
230 INFO_PRINTF1(_L("Test Purpose: CancelLoadModule Before Thread Starts")); |
|
231 |
|
232 // Create scheduler/active object framework |
|
233 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
234 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
235 |
|
236 TRSStartModuleParams startParams; |
|
237 TTestModuleIniData iniData; |
|
238 DefaultStartParams(startParams, iniData); |
|
239 startParams.iParams.iName = KModule1; |
|
240 iniData.iParams.iInitDelay = isRendezvousDelayTime; |
|
241 |
|
242 INFO_PRINTF2(_L("02 Loading module: %S"), &startParams.iParams.iName); |
|
243 asynchHandler->TryLoad(startParams, iniData); |
|
244 |
|
245 // User::After(5000000); |
|
246 |
|
247 INFO_PRINTF2(_L("03 Cancelling Loading module: %S"), &startParams.iParams.iName); |
|
248 iRootServerSuite->RootSess().CancelLoadCpm(startParams.iParams.iName); |
|
249 |
|
250 CActiveScheduler::Start(); |
|
251 |
|
252 INFO_PRINTF2(_L("LoadServer status was: <%d> "), asynchHandler->iStatus.Int()); |
|
253 |
|
254 if ((KErrCancel != asynchHandler->iStatus.Int()) && (KErrNone != asynchHandler->iStatus.Int())) |
|
255 { |
|
256 SetTestStepResult(EFail); |
|
257 } |
|
258 // Unload the CPM anyway in case we were too late to cancel the load. |
|
259 TRequestStatus status; |
|
260 iRootServerSuite->RootSess().UnloadCpm(status, startParams.iParams.iName, EImmediate); |
|
261 User::WaitForRequest(status); |
|
262 |
|
263 CleanupStack::PopAndDestroy(asynchHandler); |
|
264 CleanupStack::PopAndDestroy(scheduler); |
|
265 return TestStepResult(); |
|
266 } |
|
267 |
|
268 |
|
269 // Test step 3.7 - CancelLoadServer After Rendezvous |
|
270 CRootServerTest3_7::CRootServerTest3_7(CTE_RootServerServer *aSuite) : CTestStepRootServer(aSuite) |
|
271 { |
|
272 // store the name of this test case |
|
273 SetTestStepName(_L("Test3.7")); |
|
274 } |
|
275 |
|
276 TVerdict CRootServerTest3_7::doTestStepL( void ) |
|
277 { |
|
278 SetTestStepResult(EPass); |
|
279 INFO_PRINTF1(_L("Test Purpose: CancelLoadServer After Rendezvous")); |
|
280 |
|
281 // Create scheduler/active object framework |
|
282 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
283 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
284 |
|
285 TRSStartModuleParams startParams; |
|
286 TTestModuleIniData iniData; |
|
287 DefaultStartParams(startParams, iniData); |
|
288 startParams.iParams.iName = KModule1; |
|
289 INFO_PRINTF2(_L("02 Loading module: %S"), &startParams.iParams.iName); |
|
290 asynchHandler->TryLoad(startParams, iniData); |
|
291 |
|
292 // now wait for testserver to meet rendezvous before cancelling load (give it |
|
293 User::After(1000000); |
|
294 INFO_PRINTF2(_L("03 Cancelling Loading module: %S"), &startParams.iParams.iName); |
|
295 iRootServerSuite->RootSess().CancelLoadCpm(startParams.iParams.iName); |
|
296 |
|
297 CActiveScheduler::Start(); |
|
298 |
|
299 INFO_PRINTF2(_L("LoadServer status was: <%d> "), asynchHandler->iStatus.Int()); |
|
300 |
|
301 if (KErrNone != asynchHandler->iStatus.Int()) |
|
302 { |
|
303 SetTestStepResult(EFail); |
|
304 } |
|
305 |
|
306 CleanupStack::PopAndDestroy(asynchHandler); |
|
307 CleanupStack::PopAndDestroy(scheduler); |
|
308 |
|
309 return TestStepResult(); |
|
310 } |
|
311 |
|
312 // Test step 3.8 - Close Session with Pending LoadServer |
|
313 CRootServerTest3_8::CRootServerTest3_8(CTE_RootServerServer *aSuite) : CTestStepRootServer(aSuite) |
|
314 { |
|
315 // store the name of this test case |
|
316 SetTestStepName(_L("Test3.8")); |
|
317 } |
|
318 |
|
319 TVerdict CRootServerTest3_8::doTestStepL( void ) |
|
320 { |
|
321 SetTestStepResult(EPass); |
|
322 INFO_PRINTF1(_L("Test Purpose: Close Session with Pending LoadServer")); |
|
323 |
|
324 // Create scheduler/active object framework |
|
325 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
326 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
327 |
|
328 TRSStartModuleParams startParams; |
|
329 TTestModuleIniData iniData; |
|
330 DefaultStartParams(startParams, iniData); |
|
331 startParams.iParams.iName = KModule1; |
|
332 iniData.iParams.iInitDelay = isRendezvousDelayTime; |
|
333 |
|
334 INFO_PRINTF2(_L("02 Loading module: %S"), &startParams.iParams.iName); |
|
335 asynchHandler->TryLoad(startParams, iniData); |
|
336 |
|
337 INFO_PRINTF1(_L("03 Closing Session")); |
|
338 iRootServerSuite->RootSess().Close(); |
|
339 INFO_PRINTF1(_L("RRootServ.Close() completed")); |
|
340 |
|
341 CActiveScheduler::Start(); |
|
342 |
|
343 // note that if the session was closed before the module's thread started, |
|
344 // the handler should have been KErrCancelled |
|
345 INFO_PRINTF2(_L("LoadServer status was: <%d> "), asynchHandler->iStatus.Int()); |
|
346 if ((KErrCancel != asynchHandler->iStatus.Int()) && (KErrNone != asynchHandler->iStatus.Int())) |
|
347 { |
|
348 SetTestStepResult(EFail); |
|
349 } |
|
350 |
|
351 CleanupStack::PopAndDestroy(asynchHandler); |
|
352 CleanupStack::PopAndDestroy(scheduler); |
|
353 |
|
354 return TestStepResult(); |
|
355 } |
|
356 |
|
357 |
|
358 // Test step 3.9 - Module Exits Before Rendezvous |
|
359 CRootServerTest3_9::CRootServerTest3_9(CTE_RootServerServer *aSuite) : CTestStepRootServer(aSuite) |
|
360 { |
|
361 // store the name of this test case |
|
362 SetTestStepName(_L("Test3.9")); |
|
363 } |
|
364 |
|
365 TVerdict CRootServerTest3_9::doTestStepL( void ) |
|
366 { |
|
367 SetTestStepResult(EFail); |
|
368 INFO_PRINTF1(_L("Test Purpose: Module Exits Before Rendezvous")); |
|
369 |
|
370 // Create scheduler/active object framework |
|
371 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
372 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
373 |
|
374 TRSStartModuleParams startParams; |
|
375 TTestModuleIniData iniData; |
|
376 DefaultStartParams(startParams, iniData); |
|
377 startParams.iParams.iName = KModule1; |
|
378 iniData.iParams.iInitDelay = EXIT_BEFORE_RENDEZVOUS; |
|
379 |
|
380 INFO_PRINTF2(_L("03 Loading module: %S"), &startParams.iParams.iName); |
|
381 asynchHandler->TryLoad(startParams, iniData); |
|
382 |
|
383 CActiveScheduler::Start(); |
|
384 |
|
385 INFO_PRINTF2(_L("LoadServer status was: <%d>"), asynchHandler->iStatus.Int()); |
|
386 |
|
387 if (KErrNone != asynchHandler->iStatus.Int()) |
|
388 { |
|
389 SetTestStepResult(EPass); |
|
390 } |
|
391 |
|
392 CleanupStack::PopAndDestroy(asynchHandler); |
|
393 CleanupStack::PopAndDestroy(scheduler); |
|
394 |
|
395 return TestStepResult(); |
|
396 } |
|
397 |
|
398 // Test step 3.10 - Module Panics Before Meeting Rendezvous |
|
399 CRootServerTest3_10::CRootServerTest3_10(CTE_RootServerServer *aSuite) : CTestStepRootServer(aSuite) |
|
400 { |
|
401 // store the name of this test case |
|
402 SetTestStepName(_L("Test3.10")); |
|
403 } |
|
404 |
|
405 TVerdict CRootServerTest3_10::doTestStepL( void ) |
|
406 { |
|
407 SetTestStepResult(EFail); |
|
408 INFO_PRINTF1(_L("Test Purpose: Module Panics Before Meeting Rendezvous")); |
|
409 |
|
410 // Create scheduler/active object framework |
|
411 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
412 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
413 |
|
414 TRSStartModuleParams startParams; |
|
415 TTestModuleIniData iniData; |
|
416 DefaultStartParams(startParams, iniData); |
|
417 startParams.iParams.iName = KModule1; |
|
418 #ifdef SYMBIAN_C32ROOT_API_V3 |
|
419 startParams.iParams.iControlFlags = TRSStartModuleParamContainer::KCF_UnstableModule; |
|
420 #endif |
|
421 iniData.iParams.iInitDelay = PANIC_BEFORE_RENDEZVOUS; |
|
422 |
|
423 // make sure WINS doesn't stop at panic |
|
424 TBool jitDbg = User::JustInTime(); |
|
425 User::SetJustInTime(EFalse); |
|
426 INFO_PRINTF2(_L("03 Loading module: %S"), &startParams.iParams.iName); |
|
427 asynchHandler->TryLoad(startParams, iniData); |
|
428 |
|
429 CActiveScheduler::Start(); |
|
430 |
|
431 INFO_PRINTF2(_L("LoadServer status was: <%d> "), asynchHandler->iStatus.Int()); |
|
432 |
|
433 if (KErrNone != asynchHandler->iStatus.Int()) |
|
434 { |
|
435 SetTestStepResult(EPass); |
|
436 } |
|
437 |
|
438 // Restore enclosing JIT status |
|
439 User::SetJustInTime(jitDbg); |
|
440 |
|
441 CleanupStack::PopAndDestroy(asynchHandler); |
|
442 CleanupStack::PopAndDestroy(scheduler); |
|
443 |
|
444 return TestStepResult(); |
|
445 } |
|
446 |
|
447 // Test step 3.11 - Module Panics After Meeting Rendezvous |
|
448 CRootServerTest3_11::CRootServerTest3_11(CTE_RootServerServer *aSuite) : CTestStepRootServer(aSuite) |
|
449 { |
|
450 // store the name of this test case |
|
451 SetTestStepName(_L("Test3.11")); |
|
452 } |
|
453 |
|
454 TVerdict CRootServerTest3_11::doTestStepL( void ) |
|
455 { |
|
456 SetTestStepResult(EFail); |
|
457 INFO_PRINTF1(_L("Test Purpose: Module Panics After Meeting Rendezvous")); |
|
458 |
|
459 // Create scheduler/active object framework |
|
460 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
461 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
462 |
|
463 TRSStartModuleParams startParams; |
|
464 TTestModuleIniData iniData; |
|
465 DefaultStartParams(startParams, iniData); |
|
466 startParams.iParams.iName = KModule1; |
|
467 #ifdef SYMBIAN_C32ROOT_API_V3 |
|
468 startParams.iParams.iControlFlags = TRSStartModuleParamContainer::KCF_UnstableModule; |
|
469 #endif |
|
470 iniData.iParams.iInitDelay = PANIC_AFTER_RENDEZVOUS; |
|
471 |
|
472 // make sure WINS doesn't stop at panic |
|
473 TBool jitDbg = User::JustInTime(); |
|
474 User::SetJustInTime(EFalse); |
|
475 INFO_PRINTF2(_L("03 Loading module: %S"), &startParams.iParams.iName); |
|
476 asynchHandler->TryLoad(startParams, iniData); |
|
477 |
|
478 CActiveScheduler::Start(); |
|
479 |
|
480 INFO_PRINTF2(_L("LoadServer status was: <%d> "), asynchHandler->iStatus.Int()); |
|
481 |
|
482 if (KErrServerTerminated == asynchHandler->iStatus.Int()) |
|
483 { |
|
484 SetTestStepResult(EPass); |
|
485 } |
|
486 |
|
487 // Restore enclosing JIT status |
|
488 User::SetJustInTime(jitDbg); |
|
489 |
|
490 // destroy active scheduler |
|
491 CleanupStack::PopAndDestroy(asynchHandler); |
|
492 CleanupStack::PopAndDestroy(scheduler); |
|
493 |
|
494 return TestStepResult(); |
|
495 } |
|
496 |
|
497 |
|
498 // Test step 3.12 - Load 2 modules sharing the same heap |
|
499 CRootServerTest3_12::CRootServerTest3_12(CTE_RootServerServer *aSuite) : CTestStepRootServer(aSuite) |
|
500 { |
|
501 // store the name of this test case |
|
502 SetTestStepName(_L("Test3.12")); |
|
503 } |
|
504 |
|
505 TVerdict CRootServerTest3_12::doTestStepL( void ) |
|
506 { |
|
507 INFO_PRINTF1(_L("Test Purpose: Load 2 modules sharing the same heap")); |
|
508 |
|
509 SetTestStepResult(EPass); |
|
510 // Create scheduler/active object framework |
|
511 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
512 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
513 |
|
514 TRSStartModuleParams startParams; |
|
515 TTestModuleIniData iniData; |
|
516 DefaultStartParams(startParams, iniData); |
|
517 _LIT8(KShareModule1, "Test ModuleShare1"); |
|
518 _LIT8(KShareModule2, "Test ModuleShare2"); |
|
519 startParams.iParams.iName = KShareModule1; |
|
520 |
|
521 asynchHandler->TryLoad(startParams, iniData); |
|
522 CActiveScheduler::Start(); |
|
523 if (asynchHandler->iStatus != KErrNone) |
|
524 { |
|
525 INFO_PRINTF2(_L("LoadServer returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
526 User::Leave(asynchHandler->iStatus.Int()); |
|
527 } |
|
528 |
|
529 //*****************step 3************************ |
|
530 INFO_PRINTF1(_L("03 Load Test Module")); |
|
531 startParams.iParams.iName = KShareModule2; |
|
532 startParams.iParams.iHeapType = EShareHeap; |
|
533 startParams.iParams.iShareHeapWith = KShareModule1; |
|
534 |
|
535 asynchHandler->TryLoad(startParams, iniData); |
|
536 CActiveScheduler::Start(); |
|
537 |
|
538 if (asynchHandler->iStatus != KErrNone) |
|
539 { |
|
540 INFO_PRINTF2(_L("LoadServer returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
541 SetTestStepResult(EFail); |
|
542 } |
|
543 |
|
544 CleanupStack::PopAndDestroy(asynchHandler); |
|
545 CleanupStack::PopAndDestroy(scheduler); |
|
546 return TestStepResult(); |
|
547 } |
|
548 |
|
549 // Test step 3.13 - Load 2 modules with private heaps |
|
550 CRootServerTest3_13::CRootServerTest3_13(CTE_RootServerServer *aSuite) : CTestStepRootServer(aSuite) |
|
551 { |
|
552 // store the name of this test case |
|
553 SetTestStepName(_L("Test3.13")); |
|
554 } |
|
555 |
|
556 TVerdict CRootServerTest3_13::doTestStepL( void ) |
|
557 { |
|
558 INFO_PRINTF1(_L("Test Purpose: Load 2 modules with private heaps")); |
|
559 |
|
560 SetTestStepResult(EPass); |
|
561 // Create scheduler/active object framework |
|
562 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
563 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
564 |
|
565 TRSStartModuleParams startParams; |
|
566 TTestModuleIniData iniData; |
|
567 DefaultStartParams(startParams, iniData); |
|
568 startParams.iParams.iName = KModule1; |
|
569 startParams.iParams.iHeapType = ENewHeap; |
|
570 |
|
571 asynchHandler->TryLoad(startParams, iniData); |
|
572 CActiveScheduler::Start(); |
|
573 if (asynchHandler->iStatus != KErrNone) |
|
574 { |
|
575 INFO_PRINTF2(_L("LoadServer returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
576 User::Leave(asynchHandler->iStatus.Int()); |
|
577 } |
|
578 |
|
579 //*****************step 3************************ |
|
580 INFO_PRINTF1(_L("03 Load Test Module")); |
|
581 startParams.iParams.iName = KModule2; |
|
582 startParams.iParams.iHeapType = ENewHeap; |
|
583 |
|
584 asynchHandler->TryLoad(startParams, iniData); |
|
585 CActiveScheduler::Start(); |
|
586 |
|
587 if (asynchHandler->iStatus != KErrNone) |
|
588 { |
|
589 INFO_PRINTF2(_L("LoadServer returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
590 SetTestStepResult(EFail); |
|
591 } |
|
592 |
|
593 CleanupStack::PopAndDestroy(asynchHandler); |
|
594 CleanupStack::PopAndDestroy(scheduler); |
|
595 return TestStepResult(); |
|
596 } |
|
597 |
|
598 // Test step 3.14 - Load sluggish module |
|
599 CRootServerTest3_14::CRootServerTest3_14(CTE_RootServerServer *aSuite) : CTestStepRootServer(aSuite) |
|
600 { |
|
601 // store the name of this test case |
|
602 SetTestStepName(_L("Test3.14")); |
|
603 } |
|
604 |
|
605 TVerdict CRootServerTest3_14::doTestStepL( void ) |
|
606 { |
|
607 INFO_PRINTF1(_L("Test Purpose: Load sluggish module")); |
|
608 SetTestStepResult(EPass); |
|
609 // Create scheduler/active object framework |
|
610 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
611 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
612 |
|
613 TRSStartModuleParams startParams; |
|
614 TTestModuleIniData iniData; |
|
615 DefaultStartParams(startParams, iniData); |
|
616 startParams.iParams.iName = KModule1; |
|
617 iniData.iParams.iDiscoveryDelay = 500; |
|
618 iniData.iParams.iBindDelay = 1000; |
|
619 iniData.iParams.iUnbindDelay = 1000; |
|
620 iniData.iParams.iShutdownDelay = 1000; |
|
621 asynchHandler->TryLoad(startParams, iniData); |
|
622 |
|
623 CActiveScheduler::Start(); |
|
624 if (asynchHandler->iStatus != KErrNone) |
|
625 { |
|
626 INFO_PRINTF2(_L("LoadServer returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
627 SetTestStepResult(EFail); |
|
628 } |
|
629 |
|
630 CleanupStack::PopAndDestroy(asynchHandler); |
|
631 CleanupStack::PopAndDestroy(scheduler); |
|
632 return TestStepResult(); |
|
633 |
|
634 } |
|
635 |
|
636 // Test step 3.14 - Load dormant module |
|
637 CRootServerTest3_15::CRootServerTest3_15(CTE_RootServerServer *aSuite) : CTestStepRootServer(aSuite) |
|
638 { |
|
639 // store the name of this test case |
|
640 SetTestStepName(_L("Test3.15")); |
|
641 } |
|
642 |
|
643 TVerdict CRootServerTest3_15::doTestStepL( void ) |
|
644 { |
|
645 INFO_PRINTF1(_L("Test Purpose: Load Dormant module")); |
|
646 //*****************step 1*************************// |
|
647 SetTestStepResult(EFail); |
|
648 // Create scheduler/active object framework |
|
649 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
650 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
651 |
|
652 //*****************step 3************************ |
|
653 INFO_PRINTF1(_L("03 Load Dormant Module")); |
|
654 |
|
655 TRSStartModuleParams startParams; |
|
656 TTestModuleIniData iniData; |
|
657 DefaultStartParams(startParams, iniData); |
|
658 startParams.iParams.iName = KModule1; |
|
659 startParams.iParams.iHeapType = ENewHeap; // when zombie is killed memory will leak |
|
660 iniData.iParams.iDiscoveryDelay = 30000; |
|
661 |
|
662 asynchHandler->TryLoad(startParams, iniData); |
|
663 CActiveScheduler::Start(); |
|
664 if (asynchHandler->iStatus != KErrRSZombie) |
|
665 { |
|
666 INFO_PRINTF2(_L("LoadServer returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
667 SetTestStepResult(EFail); |
|
668 } |
|
669 else |
|
670 { |
|
671 //*****************step 4*********************** |
|
672 INFO_PRINTF1(_L("04 Unload Dormant Module")); |
|
673 asynchHandler->TryUnLoad(startParams.iParams.iName, EUnGraceful); |
|
674 CActiveScheduler::Start(); |
|
675 |
|
676 if (asynchHandler->iStatus != KErrNone) |
|
677 { |
|
678 INFO_PRINTF2(_L("Unload returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
679 SetTestStepResult(EInconclusive); |
|
680 } |
|
681 else |
|
682 SetTestStepResult(EPass); |
|
683 } |
|
684 |
|
685 CleanupStack::PopAndDestroy(asynchHandler); |
|
686 CleanupStack::PopAndDestroy(scheduler); |
|
687 return TestStepResult(); |
|
688 |
|
689 } |
|
690 |
|
691 // Test step 3.16 - Load test module and wait for death |
|
692 CRootServerTest3_16::CRootServerTest3_16(CTE_RootServerServer *aSuite) : CTestStepRootServer(aSuite) |
|
693 { |
|
694 // store the name of this test case |
|
695 SetTestStepName(_L("Test3.16")); |
|
696 } |
|
697 |
|
698 TVerdict CRootServerTest3_16::doTestStepL( void ) |
|
699 { |
|
700 INFO_PRINTF1(_L("Test Purpose: Load test module, wait for death and check heap")); |
|
701 //*****************step 1*************************// |
|
702 SetTestStepResult(EFail); |
|
703 // Create scheduler/active object framework |
|
704 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
705 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
706 |
|
707 //*****************step 3************************ |
|
708 INFO_PRINTF1(_L("03 Load Test Module")); |
|
709 |
|
710 TRSStartModuleParams startParams; |
|
711 TTestModuleIniData iniData; |
|
712 DefaultStartParams(startParams, iniData); |
|
713 startParams.iParams.iName = KModule1; |
|
714 #ifdef SYMBIAN_C32ROOT_API_V3 |
|
715 startParams.iParams.iControlFlags = TRSStartModuleParamContainer::KCF_UnstableModule; |
|
716 #endif |
|
717 iniData.iParams.iDeathDelay = 5000; |
|
718 |
|
719 asynchHandler->TryLoad(startParams, iniData); |
|
720 CActiveScheduler::Start(); |
|
721 if (asynchHandler->iStatus != KErrNone) |
|
722 { |
|
723 INFO_PRINTF2(_L("LoadServer returned error: <%d> "), asynchHandler->iStatus.Int()); |
|
724 SetTestStepResult(EInconclusive); |
|
725 } |
|
726 else |
|
727 { |
|
728 //*****************step 4*********************** |
|
729 INFO_PRINTF1(_L("04 Waiting for module to die")); |
|
730 |
|
731 User::After(6000000); |
|
732 |
|
733 TRSModuleInfo info; |
|
734 TInt ret = iRootServerSuite->RootSess().GetModuleInfo(KModule1(), info); |
|
735 INFO_PRINTF3(_L("GetModuleInfo for %S returned %d"), &KModule1(), ret); |
|
736 |
|
737 if(KErrRSModuleUnknown == ret) |
|
738 { |
|
739 SetTestStepResult(EPass); |
|
740 } |
|
741 } |
|
742 |
|
743 // uninstall and destroy active scheduler |
|
744 CleanupStack::PopAndDestroy(asynchHandler); |
|
745 CleanupStack::PopAndDestroy(scheduler); |
|
746 return TestStepResult(); |
|
747 |
|
748 } |
|
749 |
|
750 // Test step 3.17 - Load unknown module and cancel |
|
751 CRootServerTest3_17::CRootServerTest3_17(CTE_RootServerServer *aSuite) : CTestStepRootServer(aSuite) |
|
752 { |
|
753 // store the name of this test case |
|
754 SetTestStepName(_L("Test3.17")); |
|
755 } |
|
756 |
|
757 TVerdict CRootServerTest3_17::doTestStepL( void ) |
|
758 { |
|
759 SetTestStepResult(EPass); |
|
760 INFO_PRINTF1(_L("Test Purpose: Load unknown module and cancel")); |
|
761 |
|
762 // Create scheduler/active object framework |
|
763 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
764 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
765 |
|
766 TRSStartModuleParams startParams; |
|
767 TTestModuleIniData iniData; |
|
768 DefaultStartParams(startParams, iniData); |
|
769 startParams.iParams.iFilename = _L("unknown_module.cpm"); |
|
770 startParams.iParams.iName = KModule1; |
|
771 |
|
772 INFO_PRINTF2(_L("02 Loading module: %S"), &startParams.iParams.iName); |
|
773 asynchHandler->TryLoad(startParams, iniData); |
|
774 |
|
775 User::After(1000000); |
|
776 INFO_PRINTF2(_L("03 Cancelling Loading module: %S"), &startParams.iParams.iName); |
|
777 iRootServerSuite->RootSess().CancelLoadCpm(startParams.iParams.iName); |
|
778 |
|
779 CActiveScheduler::Start(); |
|
780 |
|
781 INFO_PRINTF2(_L("LoadServer status was: <%d> "), asynchHandler->iStatus.Int()); |
|
782 |
|
783 if (KErrNotFound != asynchHandler->iStatus.Int()) |
|
784 { |
|
785 SetTestStepResult(EFail); } |
|
786 |
|
787 CleanupStack::PopAndDestroy(asynchHandler); |
|
788 CleanupStack::PopAndDestroy(scheduler); |
|
789 return TestStepResult(); |
|
790 } |
|
791 |
|
792 |
|
793 // Test step 3.18 - UnLoad unknown module and cancel |
|
794 CRootServerTest3_18::CRootServerTest3_18(CTE_RootServerServer *aSuite) : CTestStepRootServer(aSuite) |
|
795 { |
|
796 // store the name of this test case |
|
797 SetTestStepName(_L("Test3.18")); |
|
798 } |
|
799 |
|
800 TVerdict CRootServerTest3_18::doTestStepL( void ) |
|
801 { |
|
802 SetTestStepResult(EPass); |
|
803 INFO_PRINTF1(_L("Test Purpose: UnLoad unknown module and cancel")); |
|
804 |
|
805 // Create scheduler/active object framework |
|
806 CSelfPopScheduler* scheduler = CSelfPopScheduler::CreateLC(); |
|
807 CTestAsynchHandler* asynchHandler = CTestAsynchHandler::NewLC(&iRootServerSuite->RootSess()); |
|
808 _LIT8(KUnknownModule, "unknown_module.cpm"); |
|
809 INFO_PRINTF2(_L("02 UnLoading module: %S"), &KUnknownModule()); |
|
810 asynchHandler->TryUnLoad(KUnknownModule(), EUnGraceful); |
|
811 |
|
812 User::After(1000000); |
|
813 INFO_PRINTF2(_L("03 Cancelling Unloading module: %S"), &KUnknownModule()); |
|
814 iRootServerSuite->RootSess().CancelUnloadCpm(KUnknownModule()); |
|
815 |
|
816 CActiveScheduler::Start(); |
|
817 |
|
818 INFO_PRINTF2(_L("UnLoadServer status was: <%d> "), asynchHandler->iStatus.Int()); |
|
819 |
|
820 if (KErrRSModuleNotLoaded != asynchHandler->iStatus.Int()) |
|
821 { |
|
822 SetTestStepResult(EFail); |
|
823 } |
|
824 |
|
825 CleanupStack::PopAndDestroy(asynchHandler); |
|
826 CleanupStack::PopAndDestroy(scheduler); |
|
827 return TestStepResult(); |
|
828 } |
|
829 |