|
1 // Copyright (c) 2010 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\resmanus\t_resmanusbtrace.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 #include <e32test.h> |
|
19 #include <e32hal.h> |
|
20 #include <d32btrace.h> |
|
21 #include <e32btrace.h> |
|
22 #include <e32svr.h> |
|
23 #include <hal.h> |
|
24 #include <u32hal.h> |
|
25 #include "d_resmanusbtraceconst.h" |
|
26 #include "d_resmanusbtrace.h" |
|
27 |
|
28 _LIT(KLddFileName, "D_RESMANUSBTRACE.LDD"); |
|
29 |
|
30 RLddTest1 ldd; |
|
31 GLDEF_D RTest test(_L("T_RESMANUSBTRACE")); |
|
32 |
|
33 TInt BTraceHeaderSize = 0; |
|
34 |
|
35 RBTrace Trace; |
|
36 TUint8* BufferPtr; |
|
37 TInt Count; |
|
38 TLogInfo LogInfo; |
|
39 |
|
40 CConsoleBase* console; |
|
41 |
|
42 class CTestTraceBase |
|
43 { |
|
44 public: |
|
45 CTestTraceBase(TUint8** aBufferPtrAddr, TInt aHeaderSize) : |
|
46 iBufferPtrAddr(aBufferPtrAddr), iHeaderSize(aHeaderSize) |
|
47 { |
|
48 iBuffer.Zero(); |
|
49 } |
|
50 void SkipHeader() |
|
51 { |
|
52 *iBufferPtrAddr += iHeaderSize; |
|
53 } |
|
54 TInt Compare() |
|
55 { |
|
56 TInt i = 0; |
|
57 TPtrC8 ptr2(*iBufferPtrAddr, iBuffer.Length()); |
|
58 TUint length = iBuffer.Length(); |
|
59 length = (length + 0x3) & (~0x3); |
|
60 |
|
61 for(i = 0; i < ptr2.Length(); i++) |
|
62 { |
|
63 test.Printf(_L("%02x "), ptr2.Ptr()[i]); |
|
64 } |
|
65 test.Printf(_L("\n")); |
|
66 for(i = 0; i < iBuffer.Length(); i++) |
|
67 { |
|
68 test.Printf(_L("%02x "), iBuffer.Ptr()[i]); |
|
69 } |
|
70 test.Printf(_L("\n")); |
|
71 |
|
72 *iBufferPtrAddr += length; |
|
73 return (iBuffer.Compare(ptr2)==0)?KErrNone:KErrCorrupt; |
|
74 } |
|
75 void AppendUInt(TUint aVal) |
|
76 { |
|
77 iBuffer.Append((TUint8*)&aVal, sizeof(TUint)); |
|
78 } |
|
79 void AppendInt(TInt aVal) |
|
80 { |
|
81 iBuffer.Append((TUint8*)&aVal, sizeof(TInt)); |
|
82 } |
|
83 void AppendDes(const TDesC8& aDesPtr) |
|
84 { |
|
85 iBuffer.Append(aDesPtr); |
|
86 } |
|
87 TUint8** iBufferPtrAddr; |
|
88 TBuf8<80> iBuffer; |
|
89 TInt iHeaderSize; |
|
90 }; |
|
91 |
|
92 class Test_PRM_US_OPEN_CHANNEL_START_TRACE : public CTestTraceBase |
|
93 { |
|
94 public: |
|
95 Test_PRM_US_OPEN_CHANNEL_START_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
96 { |
|
97 AppendUInt(KClient); |
|
98 AppendUInt(KCLIENTNAME.iTypeLength); |
|
99 AppendDes(KCLIENTNAME); |
|
100 } |
|
101 }; |
|
102 |
|
103 class Test_PRM_US_OPEN_CHANNEL_END_TRACE : public CTestTraceBase |
|
104 { |
|
105 public: |
|
106 Test_PRM_US_OPEN_CHANNEL_END_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
107 { |
|
108 AppendUInt((TUint)KClientHandle); |
|
109 AppendUInt(KCLIENTNAME.iTypeLength); |
|
110 AppendDes(KCLIENTNAME); |
|
111 } |
|
112 }; |
|
113 |
|
114 class Test_PRM_US_REGISTER_CLIENT_START_TRACE : public CTestTraceBase |
|
115 { |
|
116 public: |
|
117 Test_PRM_US_REGISTER_CLIENT_START_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
118 { |
|
119 AppendUInt(KClientHandle); |
|
120 TUint32 stateRes32 = ((KStatsRes1&0xFF) << 16) | ((KStatsRes2&0xFF) << 8) | ((KStatsRes3&0xFF)); |
|
121 AppendUInt(stateRes32); |
|
122 AppendUInt(KCLIENTNAME.iTypeLength); |
|
123 AppendDes(KCLIENTNAME); |
|
124 } |
|
125 }; |
|
126 |
|
127 class Test_PRM_US_REGISTER_CLIENT_END_TRACE : public CTestTraceBase |
|
128 { |
|
129 public: |
|
130 Test_PRM_US_REGISTER_CLIENT_END_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
131 { |
|
132 AppendUInt(KClientHandle); |
|
133 AppendInt(KRetVal); |
|
134 } |
|
135 }; |
|
136 |
|
137 class Test_PRM_US_DEREGISTER_CLIENT_START_TRACE : public CTestTraceBase |
|
138 { |
|
139 public: |
|
140 Test_PRM_US_DEREGISTER_CLIENT_START_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
141 { |
|
142 AppendUInt(KClientHandle); |
|
143 AppendUInt(KCLIENTNAME.iTypeLength); |
|
144 AppendDes(KCLIENTNAME); |
|
145 } |
|
146 }; |
|
147 |
|
148 class Test_PRM_US_DEREGISTER_CLIENT_END_TRACE : public CTestTraceBase |
|
149 { |
|
150 public: |
|
151 Test_PRM_US_DEREGISTER_CLIENT_END_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
152 { |
|
153 AppendUInt(KClientHandle); |
|
154 } |
|
155 }; |
|
156 |
|
157 class Test_PRM_US_GET_RESOURCE_STATE_START_TRACE : public CTestTraceBase |
|
158 { |
|
159 public: |
|
160 Test_PRM_US_GET_RESOURCE_STATE_START_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
161 { |
|
162 AppendUInt(KResourceId); |
|
163 AppendUInt(KClientHandle); |
|
164 AppendUInt(KCLIENTNAME.iTypeLength); |
|
165 AppendDes(KCLIENTNAME); |
|
166 } |
|
167 }; |
|
168 |
|
169 class Test_PRM_US_GET_RESOURCE_STATE_END_TRACE : public CTestTraceBase |
|
170 { |
|
171 public: |
|
172 Test_PRM_US_GET_RESOURCE_STATE_END_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
173 { |
|
174 AppendUInt(KResourceId); |
|
175 AppendUInt(KLevel); |
|
176 AppendUInt(KClient); |
|
177 AppendUInt(KResult); |
|
178 } |
|
179 }; |
|
180 |
|
181 class Test_PRM_US_SET_RESOURCE_STATE_START_TRACE : public CTestTraceBase |
|
182 { |
|
183 public: |
|
184 Test_PRM_US_SET_RESOURCE_STATE_START_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
185 { |
|
186 AppendUInt(KResourceId); |
|
187 AppendUInt(KLevel); |
|
188 AppendUInt(KClientHandle); |
|
189 AppendUInt(KCLIENTNAME.iTypeLength); |
|
190 AppendDes(KCLIENTNAME); |
|
191 } |
|
192 }; |
|
193 |
|
194 class Test_PRM_US_SET_RESOURCE_STATE_END_TRACE : public CTestTraceBase |
|
195 { |
|
196 public: |
|
197 Test_PRM_US_SET_RESOURCE_STATE_END_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
198 { |
|
199 AppendUInt(KResourceId); |
|
200 AppendUInt(KLevel); |
|
201 AppendUInt(KClient); |
|
202 AppendUInt(KResult); |
|
203 } |
|
204 }; |
|
205 |
|
206 class Test_PRM_US_CANCEL_GET_RESOURCE_STATE_START_TRACE : public CTestTraceBase |
|
207 { |
|
208 public: |
|
209 Test_PRM_US_CANCEL_GET_RESOURCE_STATE_START_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
210 { |
|
211 AppendUInt(KResourceId); |
|
212 AppendUInt(KClientHandle); |
|
213 AppendUInt(KCLIENTNAME.iTypeLength); |
|
214 AppendDes(KCLIENTNAME); |
|
215 } |
|
216 }; |
|
217 |
|
218 class Test_PRM_US_CANCEL_GET_RESOURCE_STATE_END_TRACE : public CTestTraceBase |
|
219 { |
|
220 public: |
|
221 Test_PRM_US_CANCEL_GET_RESOURCE_STATE_END_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
222 { |
|
223 AppendUInt(KResourceId); |
|
224 AppendUInt(KClientHandle); |
|
225 AppendUInt(KCLIENTNAME.iTypeLength); |
|
226 AppendDes(KCLIENTNAME); |
|
227 } |
|
228 }; |
|
229 |
|
230 class Test_PRM_US_CANCEL_SET_RESOURCE_STATE_START_TRACE : public CTestTraceBase |
|
231 { |
|
232 public: |
|
233 Test_PRM_US_CANCEL_SET_RESOURCE_STATE_START_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
234 { |
|
235 AppendUInt(KResourceId); |
|
236 AppendUInt(KClientHandle); |
|
237 AppendUInt(KCLIENTNAME.iTypeLength); |
|
238 AppendDes(KCLIENTNAME); |
|
239 } |
|
240 }; |
|
241 |
|
242 class Test_PRM_US_CANCEL_SET_RESOURCE_STATE_END_TRACE : public CTestTraceBase |
|
243 { |
|
244 public: |
|
245 Test_PRM_US_CANCEL_SET_RESOURCE_STATE_END_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
246 { |
|
247 AppendUInt(KResourceId); |
|
248 AppendUInt(KClientHandle); |
|
249 AppendUInt(KCLIENTNAME.iTypeLength); |
|
250 AppendDes(KCLIENTNAME); |
|
251 } |
|
252 }; |
|
253 |
|
254 class Test_PRM_REGISTER_RESOURCE_TRACE : public CTestTraceBase |
|
255 { |
|
256 public: |
|
257 Test_PRM_REGISTER_RESOURCE_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
258 { |
|
259 AppendUInt(KResCount+1); |
|
260 AppendUInt((TUint)(LogInfo.iPR)); |
|
261 AppendInt(KMinLevel); |
|
262 AppendUInt(KMaxLevel); |
|
263 AppendUInt(KDefaultLevel); |
|
264 AppendUInt(KRESOURCENAME.iTypeLength); |
|
265 AppendDes(KRESOURCENAME); |
|
266 } |
|
267 }; |
|
268 |
|
269 class Test_PRM_CLIENT_REGISTER_TRACE : public CTestTraceBase |
|
270 { |
|
271 public: |
|
272 Test_PRM_CLIENT_REGISTER_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
273 { |
|
274 AppendUInt(KClientId); |
|
275 AppendUInt((TUint)LogInfo.iPC); |
|
276 AppendUInt(KCLIENTNAME.iTypeLength); |
|
277 AppendDes(KCLIENTNAME); |
|
278 } |
|
279 }; |
|
280 class Test_PRM_CLIENT_DEREGISTER_TRACE : public CTestTraceBase |
|
281 { |
|
282 public: |
|
283 Test_PRM_CLIENT_DEREGISTER_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
284 { |
|
285 AppendUInt(KClientId); |
|
286 AppendUInt((TUint)LogInfo.iPC); |
|
287 AppendUInt(KCLIENTNAME.iTypeLength); |
|
288 AppendDes(KCLIENTNAME); |
|
289 } |
|
290 }; |
|
291 |
|
292 class Test_PRM_CLIENT_CHANGE_STATE_START_TRACE : public CTestTraceBase |
|
293 { |
|
294 public: |
|
295 Test_PRM_CLIENT_CHANGE_STATE_START_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
296 { |
|
297 AppendUInt(KClientId); |
|
298 AppendUInt(KResourceId); |
|
299 AppendUInt(KLevel); |
|
300 AppendUInt(KCLIENTNAME.iTypeLength); |
|
301 AppendDes(KCLIENTNAME); |
|
302 AppendUInt(KRESOURCENAME.iTypeLength); |
|
303 AppendDes(KRESOURCENAME); |
|
304 } |
|
305 }; |
|
306 |
|
307 class Test_PRM_CLIENT_CHANGE_STATE_END_TRACE : public CTestTraceBase |
|
308 { |
|
309 public: |
|
310 Test_PRM_CLIENT_CHANGE_STATE_END_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
311 { |
|
312 AppendUInt(KClientId); |
|
313 AppendUInt(KResourceId); |
|
314 AppendInt(KRetVal); |
|
315 AppendUInt(KLevel); |
|
316 AppendUInt(KCLIENTNAME.iTypeLength); |
|
317 AppendDes(KCLIENTNAME); |
|
318 AppendUInt(KRESOURCENAME.iTypeLength); |
|
319 AppendDes(KRESOURCENAME); |
|
320 } |
|
321 }; |
|
322 |
|
323 class Test_PRM_POSTNOTIFICATION_REGISTER_TRACE : public CTestTraceBase |
|
324 { |
|
325 public: |
|
326 Test_PRM_POSTNOTIFICATION_REGISTER_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
327 { |
|
328 AppendUInt(KClientId); |
|
329 AppendUInt(KResourceId); |
|
330 AppendUInt((TUint)(LogInfo.iPCallback)); |
|
331 AppendInt(KRetVal); |
|
332 } |
|
333 }; |
|
334 |
|
335 class Test_PRM_POSTNOTIFICATION_DEREGISTER_TRACE : public CTestTraceBase |
|
336 { |
|
337 public: |
|
338 Test_PRM_POSTNOTIFICATION_DEREGISTER_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
339 { |
|
340 AppendUInt(KClientId); |
|
341 AppendUInt(KResourceId); |
|
342 AppendUInt((TUint)(LogInfo.iPCallback)); |
|
343 AppendInt(KRetVal); |
|
344 } |
|
345 }; |
|
346 |
|
347 class Test_PRM_POSTNOTIFICATION_SENT_TRACE : public CTestTraceBase |
|
348 { |
|
349 public: |
|
350 Test_PRM_POSTNOTIFICATION_SENT_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
351 { |
|
352 AppendUInt(KClientId); |
|
353 AppendUInt(KResourceId); |
|
354 } |
|
355 }; |
|
356 |
|
357 class Test_PRM_CALLBACK_COMPLETION_TRACE : public CTestTraceBase |
|
358 { |
|
359 public: |
|
360 Test_PRM_CALLBACK_COMPLETION_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
361 { |
|
362 AppendUInt(KClientId); |
|
363 AppendUInt(KResourceId); |
|
364 } |
|
365 }; |
|
366 |
|
367 class Test_PRM_MEMORY_USAGE_TRACE : public CTestTraceBase |
|
368 { |
|
369 public: |
|
370 Test_PRM_MEMORY_USAGE_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
371 { |
|
372 AppendUInt(KSize); |
|
373 } |
|
374 }; |
|
375 |
|
376 class Test_PRM_PSL_RESOURCE_GET_STATE_START_TRACE : public CTestTraceBase |
|
377 { |
|
378 public: |
|
379 Test_PRM_PSL_RESOURCE_GET_STATE_START_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
380 { |
|
381 AppendUInt(KClientId); |
|
382 AppendUInt(KResourceId); |
|
383 AppendUInt(KCLIENTNAME.iTypeLength); |
|
384 AppendDes(KCLIENTNAME); |
|
385 } |
|
386 }; |
|
387 |
|
388 class Test_PRM_RESOURCE_GET_STATE_START_TRACE : public CTestTraceBase |
|
389 { |
|
390 public: |
|
391 Test_PRM_RESOURCE_GET_STATE_START_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
392 { |
|
393 AppendUInt(KClientId); |
|
394 AppendUInt(KResourceId); |
|
395 AppendUInt(KCLIENTNAME.iTypeLength); |
|
396 AppendDes(KCLIENTNAME); |
|
397 AppendUInt(KRESOURCENAME.iTypeLength); |
|
398 AppendDes(KRESOURCENAME); |
|
399 } |
|
400 }; |
|
401 |
|
402 class Test_PRM_PSL_RESOURCE_GET_STATE_END_TRACE : public CTestTraceBase |
|
403 { |
|
404 public: |
|
405 Test_PRM_PSL_RESOURCE_GET_STATE_END_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
406 { |
|
407 AppendUInt(KClientId); |
|
408 AppendUInt(KResourceId); |
|
409 AppendUInt(KLevel); |
|
410 AppendInt(KRetVal); |
|
411 AppendUInt(KCLIENTNAME.iTypeLength); |
|
412 AppendDes(KCLIENTNAME); |
|
413 } |
|
414 }; |
|
415 |
|
416 class Test_PRM_RESOURCE_GET_STATE_END_TRACE : public CTestTraceBase |
|
417 { |
|
418 public: |
|
419 Test_PRM_RESOURCE_GET_STATE_END_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
420 { |
|
421 AppendUInt(KClientId); |
|
422 AppendUInt(KResourceId); |
|
423 AppendUInt(KLevel); |
|
424 AppendInt(KRetVal); |
|
425 AppendUInt(KCLIENTNAME.iTypeLength); |
|
426 AppendDes(KCLIENTNAME); |
|
427 AppendUInt(KRESOURCENAME.iTypeLength); |
|
428 AppendDes(KRESOURCENAME); |
|
429 } |
|
430 }; |
|
431 |
|
432 class Test_PRM_RESOURCE_CANCEL_LONGLATENCY_OPERATION_TRACE : public CTestTraceBase |
|
433 { |
|
434 public: |
|
435 Test_PRM_RESOURCE_CANCEL_LONGLATENCY_OPERATION_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
436 { |
|
437 AppendUInt(KClientId); |
|
438 AppendUInt(KResourceId); |
|
439 AppendInt(KRetVal); |
|
440 AppendUInt(KCLIENTNAME.iTypeLength); |
|
441 AppendDes(KCLIENTNAME); |
|
442 AppendUInt(KRESOURCENAME.iTypeLength); |
|
443 AppendDes(KRESOURCENAME); |
|
444 } |
|
445 }; |
|
446 |
|
447 class Test_PRM_PSL_RESOURCE_CHANGE_STATE_START_TRACE : public CTestTraceBase |
|
448 { |
|
449 public: |
|
450 Test_PRM_PSL_RESOURCE_CHANGE_STATE_START_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
451 { |
|
452 AppendUInt(KClientId); |
|
453 AppendUInt(KResourceId); |
|
454 AppendUInt(KLevel); |
|
455 AppendUInt(KLevel); |
|
456 AppendUInt(KCLIENTNAME.iTypeLength); |
|
457 AppendDes(KCLIENTNAME); |
|
458 } |
|
459 }; |
|
460 |
|
461 class Test_PRM_PSL_RESOURCE_CHANGE_STATE_END_TRACE : public CTestTraceBase |
|
462 { |
|
463 public: |
|
464 Test_PRM_PSL_RESOURCE_CHANGE_STATE_END_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
465 { |
|
466 AppendUInt(KClientId); |
|
467 AppendUInt(KResourceId); |
|
468 AppendUInt(KLevel); |
|
469 AppendUInt(KLevel); |
|
470 AppendInt(KRetVal); |
|
471 AppendUInt(KCLIENTNAME.iTypeLength); |
|
472 AppendDes(KCLIENTNAME); |
|
473 } |
|
474 }; |
|
475 |
|
476 class Test_PRM_PSL_RESOURCE_CREATE_TRACE : public CTestTraceBase |
|
477 { |
|
478 public: |
|
479 Test_PRM_PSL_RESOURCE_CREATE_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
480 { |
|
481 AppendInt(KMinLevel); |
|
482 AppendInt(KMaxLevel); |
|
483 AppendInt(KDefaultLevel); |
|
484 AppendUInt(KFlags); |
|
485 AppendUInt(KCLIENTNAME.iTypeLength); |
|
486 AppendDes(KCLIENTNAME); |
|
487 } |
|
488 }; |
|
489 |
|
490 class Test_PRM_BOOTING_TRACE : public CTestTraceBase |
|
491 { |
|
492 public: |
|
493 Test_PRM_BOOTING_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
494 { |
|
495 AppendInt(KErrNoMemory); |
|
496 } |
|
497 }; |
|
498 |
|
499 class Test_PRM_REGISTER_STATIC_RESOURCE_WITH_DEPENDENCY_TRACE : public CTestTraceBase |
|
500 { |
|
501 public: |
|
502 Test_PRM_REGISTER_STATIC_RESOURCE_WITH_DEPENDENCY_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
503 { |
|
504 AppendUInt(KResourceId); |
|
505 AppendUInt((TUint)(LogInfo.iPR)); |
|
506 AppendInt(KMinLevel); |
|
507 AppendInt(KMaxLevel); |
|
508 AppendInt(KDefaultLevel); |
|
509 AppendUInt(KRESOURCENAME.iTypeLength); |
|
510 AppendDes(KRESOURCENAME); |
|
511 } |
|
512 }; |
|
513 |
|
514 class Test_PRM_REGISTER_DYNAMIC_RESOURCE_TRACE : public CTestTraceBase |
|
515 { |
|
516 public: |
|
517 Test_PRM_REGISTER_DYNAMIC_RESOURCE_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
518 { |
|
519 AppendUInt(KClientId); |
|
520 AppendUInt(KResourceId); |
|
521 AppendUInt((TUint)(LogInfo.iPR)); |
|
522 AppendUInt(KCLIENTNAME.iTypeLength); |
|
523 AppendDes(KCLIENTNAME); |
|
524 AppendUInt(KRESOURCENAME.iTypeLength); |
|
525 AppendDes(KRESOURCENAME); |
|
526 } |
|
527 }; |
|
528 |
|
529 class Test_PRM_DEREGISTER_DYNAMIC_RESOURCE_TRACE : public CTestTraceBase |
|
530 { |
|
531 public: |
|
532 Test_PRM_DEREGISTER_DYNAMIC_RESOURCE_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
533 { |
|
534 AppendUInt(KClientId); |
|
535 AppendUInt(KResourceId); |
|
536 AppendUInt((TUint)(LogInfo.iPR)); |
|
537 AppendUInt(KLevel); |
|
538 AppendUInt(KCLIENTNAME.iTypeLength); |
|
539 AppendDes(KCLIENTNAME); |
|
540 AppendUInt(KRESOURCENAME.iTypeLength); |
|
541 AppendDes(KRESOURCENAME); |
|
542 } |
|
543 }; |
|
544 |
|
545 class Test_PRM_REGISTER_RESOURCE_DEPENDENCY_TRACE : public CTestTraceBase |
|
546 { |
|
547 public: |
|
548 Test_PRM_REGISTER_RESOURCE_DEPENDENCY_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
549 { |
|
550 AppendUInt(KClientId); |
|
551 AppendUInt(KResourceId); |
|
552 AppendUInt(KResourceId); |
|
553 AppendUInt((TUint)(LogInfo.iPR)); |
|
554 AppendUInt((TUint)(LogInfo.iPR)); |
|
555 AppendUInt(KCLIENTNAME.iTypeLength); |
|
556 AppendDes(KCLIENTNAME); |
|
557 AppendUInt(KRESOURCENAME.iTypeLength); |
|
558 AppendDes(KRESOURCENAME); |
|
559 AppendUInt(KRESOURCENAME.iTypeLength); |
|
560 AppendDes(KRESOURCENAME); |
|
561 } |
|
562 }; |
|
563 |
|
564 class Test_PRM_DEREGISTER_RESOURCE_DEPENDENCY_TRACE : public CTestTraceBase |
|
565 { |
|
566 public: |
|
567 Test_PRM_DEREGISTER_RESOURCE_DEPENDENCY_TRACE() : CTestTraceBase(&BufferPtr, BTraceHeaderSize) |
|
568 { |
|
569 AppendUInt(KClientId); |
|
570 AppendUInt(KResourceId); |
|
571 AppendUInt(KResourceId); |
|
572 AppendUInt((TUint)(LogInfo.iPR)); |
|
573 AppendUInt((TUint)(LogInfo.iPR)); |
|
574 AppendUInt(KCLIENTNAME.iTypeLength); |
|
575 AppendDes(KCLIENTNAME); |
|
576 AppendUInt(KRESOURCENAME.iTypeLength); |
|
577 AppendDes(KRESOURCENAME); |
|
578 AppendUInt(KRESOURCENAME.iTypeLength); |
|
579 AppendDes(KRESOURCENAME); |
|
580 } |
|
581 }; |
|
582 |
|
583 void TestMacro() |
|
584 { |
|
585 const TInt numCpus = UserSvr::HalFunction(EHalGroupKernel, EKernelHalNumLogicalCpus, 0, 0); |
|
586 if(numCpus>1) |
|
587 { |
|
588 BTraceHeaderSize = 20; |
|
589 } |
|
590 else |
|
591 { |
|
592 BTraceHeaderSize = 12; |
|
593 } |
|
594 |
|
595 Test_PRM_US_OPEN_CHANNEL_START_TRACE testPRM_US_OPEN_CHANNEL_START_TRACE; //0 |
|
596 Test_PRM_US_OPEN_CHANNEL_END_TRACE testPRM_US_OPEN_CHANNEL_END_TRACE; //1 |
|
597 Test_PRM_US_REGISTER_CLIENT_START_TRACE testPRM_US_REGISTER_CLIENT_START_TRACE; //2 |
|
598 Test_PRM_US_REGISTER_CLIENT_END_TRACE testPRM_US_REGISTER_CLIENT_END_TRACE; //3 |
|
599 Test_PRM_US_DEREGISTER_CLIENT_START_TRACE testPRM_US_DEREGISTER_CLIENT_START_TRACE; //4 |
|
600 Test_PRM_US_DEREGISTER_CLIENT_END_TRACE testPRM_US_DEREGISTER_CLIENT_END_TRACE; //5 |
|
601 Test_PRM_US_GET_RESOURCE_STATE_START_TRACE testPRM_US_GET_RESOURCE_STATE_START_TRACE; //6 |
|
602 Test_PRM_US_GET_RESOURCE_STATE_END_TRACE testPRM_US_GET_RESOURCE_STATE_END_TRACE; //7 |
|
603 Test_PRM_US_SET_RESOURCE_STATE_START_TRACE testPRM_US_SET_RESOURCE_STATE_START_TRACE; //8 |
|
604 Test_PRM_US_SET_RESOURCE_STATE_END_TRACE testPRM_US_SET_RESOURCE_STATE_END_TRACE; //9 |
|
605 Test_PRM_US_CANCEL_GET_RESOURCE_STATE_START_TRACE testPRM_US_CANCEL_GET_RESOURCE_STATE_START_TRACE; //10 |
|
606 Test_PRM_US_CANCEL_GET_RESOURCE_STATE_END_TRACE testPRM_US_CANCEL_GET_RESOURCE_STATE_END_TRACE; //11 |
|
607 Test_PRM_US_CANCEL_SET_RESOURCE_STATE_START_TRACE testPRM_US_CANCEL_SET_RESOURCE_STATE_START_TRACE; //12 |
|
608 Test_PRM_US_CANCEL_SET_RESOURCE_STATE_END_TRACE testPRM_US_CANCEL_SET_RESOURCE_STATE_END_TRACE; //13 |
|
609 Test_PRM_REGISTER_RESOURCE_TRACE testPRM_REGISTER_RESOURCE_TRACE; //14 |
|
610 Test_PRM_CLIENT_REGISTER_TRACE testPRM_CLIENT_REGISTER_TRACE; //15 |
|
611 Test_PRM_CLIENT_DEREGISTER_TRACE testPRM_CLIENT_DEREGISTER_TRACE; //16 |
|
612 Test_PRM_CLIENT_CHANGE_STATE_START_TRACE testPRM_CLIENT_CHANGE_STATE_START_TRACE; //17 |
|
613 Test_PRM_CLIENT_CHANGE_STATE_END_TRACE testPRM_CLIENT_CHANGE_STATE_END_TRACE; //18 |
|
614 Test_PRM_POSTNOTIFICATION_REGISTER_TRACE testPRM_POSTNOTIFICATION_REGISTER_TRACE; //19 |
|
615 Test_PRM_POSTNOTIFICATION_DEREGISTER_TRACE testPRM_POSTNOTIFICATION_DEREGISTER_TRACE; //20 |
|
616 Test_PRM_POSTNOTIFICATION_SENT_TRACE testPRM_POSTNOTIFICATION_SENT_TRACE; //21 |
|
617 Test_PRM_CALLBACK_COMPLETION_TRACE testPRM_CALLBACK_COMPLETION_TRACE; //22 |
|
618 Test_PRM_MEMORY_USAGE_TRACE testPRM_MEMORY_USAGE_TRACE; //23 |
|
619 Test_PRM_PSL_RESOURCE_GET_STATE_START_TRACE testPRM_PSL_RESOURCE_GET_STATE_START_TRACE; //24 |
|
620 Test_PRM_RESOURCE_GET_STATE_START_TRACE testPRM_RESOURCE_GET_STATE_START_TRACE; //25 |
|
621 Test_PRM_PSL_RESOURCE_GET_STATE_END_TRACE testPRM_PSL_RESOURCE_GET_STATE_END_TRACE; //26 |
|
622 Test_PRM_RESOURCE_GET_STATE_END_TRACE testPRM_RESOURCE_GET_STATE_END_TRACE; //27 |
|
623 Test_PRM_RESOURCE_CANCEL_LONGLATENCY_OPERATION_TRACE testPRM_RESOURCE_CANCEL_LONGLATENCY_OPERATION_TRACE; //28 |
|
624 Test_PRM_PSL_RESOURCE_CHANGE_STATE_START_TRACE testPRM_PSL_RESOURCE_CHANGE_STATE_START_TRACE; //29 |
|
625 Test_PRM_PSL_RESOURCE_CHANGE_STATE_END_TRACE testPRM_PSL_RESOURCE_CHANGE_STATE_END_TRACE; //30 |
|
626 Test_PRM_PSL_RESOURCE_CREATE_TRACE testPRM_PSL_RESOURCE_CREATE_TRACE; //31 |
|
627 Test_PRM_BOOTING_TRACE testPRM_BOOTING_TRACE; //32 |
|
628 Test_PRM_REGISTER_STATIC_RESOURCE_WITH_DEPENDENCY_TRACE testPRM_REGISTER_STATIC_RESOURCE_WITH_DEPENDENCY_TRACE; //33 |
|
629 Test_PRM_REGISTER_DYNAMIC_RESOURCE_TRACE testPRM_REGISTER_DYNAMIC_RESOURCE_TRACE; //34 |
|
630 Test_PRM_DEREGISTER_DYNAMIC_RESOURCE_TRACE testPRM_DEREGISTER_DYNAMIC_RESOURCE_TRACE; //35 |
|
631 Test_PRM_REGISTER_RESOURCE_DEPENDENCY_TRACE testPRM_REGISTER_RESOURCE_DEPENDENCY_TRACE; //36 |
|
632 Test_PRM_DEREGISTER_RESOURCE_DEPENDENCY_TRACE testPRM_DEREGISTER_RESOURCE_DEPENDENCY_TRACE; //37 |
|
633 |
|
634 // const TInt KNumTest = 38; |
|
635 CTestTraceBase* TestArray[] = |
|
636 { |
|
637 &testPRM_US_OPEN_CHANNEL_START_TRACE, |
|
638 &testPRM_US_OPEN_CHANNEL_END_TRACE, |
|
639 &testPRM_US_REGISTER_CLIENT_START_TRACE, |
|
640 &testPRM_US_REGISTER_CLIENT_END_TRACE, |
|
641 &testPRM_US_DEREGISTER_CLIENT_START_TRACE, |
|
642 &testPRM_US_DEREGISTER_CLIENT_END_TRACE, |
|
643 &testPRM_US_GET_RESOURCE_STATE_START_TRACE, |
|
644 &testPRM_US_GET_RESOURCE_STATE_END_TRACE, |
|
645 &testPRM_US_SET_RESOURCE_STATE_START_TRACE, |
|
646 &testPRM_US_SET_RESOURCE_STATE_END_TRACE, |
|
647 &testPRM_US_CANCEL_GET_RESOURCE_STATE_START_TRACE, |
|
648 &testPRM_US_CANCEL_GET_RESOURCE_STATE_END_TRACE, |
|
649 &testPRM_US_CANCEL_SET_RESOURCE_STATE_START_TRACE, |
|
650 &testPRM_US_CANCEL_SET_RESOURCE_STATE_END_TRACE, |
|
651 &testPRM_REGISTER_RESOURCE_TRACE, |
|
652 &testPRM_CLIENT_REGISTER_TRACE, |
|
653 &testPRM_CLIENT_DEREGISTER_TRACE, |
|
654 &testPRM_CLIENT_CHANGE_STATE_START_TRACE, |
|
655 &testPRM_CLIENT_CHANGE_STATE_END_TRACE, |
|
656 &testPRM_POSTNOTIFICATION_REGISTER_TRACE, |
|
657 &testPRM_POSTNOTIFICATION_DEREGISTER_TRACE, |
|
658 &testPRM_POSTNOTIFICATION_SENT_TRACE, |
|
659 &testPRM_CALLBACK_COMPLETION_TRACE, |
|
660 &testPRM_MEMORY_USAGE_TRACE, |
|
661 &testPRM_PSL_RESOURCE_GET_STATE_START_TRACE, |
|
662 &testPRM_RESOURCE_GET_STATE_START_TRACE, |
|
663 &testPRM_PSL_RESOURCE_GET_STATE_END_TRACE, |
|
664 &testPRM_RESOURCE_GET_STATE_END_TRACE, |
|
665 &testPRM_RESOURCE_CANCEL_LONGLATENCY_OPERATION_TRACE, |
|
666 &testPRM_PSL_RESOURCE_CHANGE_STATE_START_TRACE, |
|
667 &testPRM_PSL_RESOURCE_CHANGE_STATE_END_TRACE, |
|
668 &testPRM_PSL_RESOURCE_CREATE_TRACE, |
|
669 &testPRM_BOOTING_TRACE, |
|
670 &testPRM_REGISTER_STATIC_RESOURCE_WITH_DEPENDENCY_TRACE, |
|
671 &testPRM_REGISTER_DYNAMIC_RESOURCE_TRACE, |
|
672 &testPRM_DEREGISTER_DYNAMIC_RESOURCE_TRACE, |
|
673 &testPRM_REGISTER_RESOURCE_DEPENDENCY_TRACE, |
|
674 &testPRM_DEREGISTER_RESOURCE_DEPENDENCY_TRACE |
|
675 }; |
|
676 |
|
677 TInt r = KErrNone; |
|
678 |
|
679 for(TUint i = 0; i < sizeof(TestArray)/sizeof(CTestTraceBase*); i++) |
|
680 { |
|
681 TestArray[i]->SkipHeader(); |
|
682 test.Printf(_L("\n\nTest number %d\n\n"), i); |
|
683 r = TestArray[i]->Compare(); |
|
684 test(r==KErrNone); |
|
685 } |
|
686 |
|
687 } |
|
688 |
|
689 void DoTests() |
|
690 { |
|
691 TInt r = KErrNone; |
|
692 |
|
693 test.Printf(_L("Loading logical device \n")); |
|
694 r=User::LoadLogicalDevice(KLddFileName); |
|
695 test(r == KErrNone); |
|
696 |
|
697 test.Printf(_L("Opening of logical device\n")); |
|
698 r = ldd.Open(); |
|
699 test(r == KErrNone); |
|
700 |
|
701 Trace.Open(); |
|
702 TInt OrgBufSize = Trace.BufferSize(); |
|
703 if(OrgBufSize<1024) |
|
704 Trace.ResizeBuffer(1024); |
|
705 |
|
706 Trace.Empty(); |
|
707 Trace.SetMode(RBTrace::EEnable); |
|
708 |
|
709 Trace.SetFilter(BTrace::EResourceManagerUs, ETrue); |
|
710 Trace.SetFilter(BTrace::EResourceManager, ETrue); |
|
711 |
|
712 test.Printf(_L("Test Cat 19 is enabled")); |
|
713 test(Trace.Filter(19)); |
|
714 test.Printf(_L("Test Cat 20 is enabled")); |
|
715 test(Trace.Filter(20)); |
|
716 |
|
717 test.Printf(_L("Send log\n")); |
|
718 r = ldd.SendLog(&LogInfo); |
|
719 test(r == KErrNone); |
|
720 |
|
721 Trace.GetData(BufferPtr); |
|
722 |
|
723 TestMacro(); |
|
724 |
|
725 Trace.DataUsed(); |
|
726 |
|
727 Trace.SetFilter(BTrace::EResourceManagerUs, EFalse); |
|
728 Trace.SetFilter(BTrace::EResourceManager, EFalse); |
|
729 |
|
730 if(OrgBufSize<1024) |
|
731 Trace.ResizeBuffer(1024); |
|
732 |
|
733 Trace.Close(); |
|
734 |
|
735 test.Printf(_L("\nClosing the channel\n")); |
|
736 ldd.Close(); |
|
737 |
|
738 test.Printf(_L("Freeing logical device\n")); |
|
739 r = User::FreeLogicalDevice(KLddFileName);; |
|
740 test(r==KErrNone); |
|
741 |
|
742 |
|
743 } |
|
744 |
|
745 GLDEF_C TInt E32Main() |
|
746 { |
|
747 test.Start(_L("T_RESMANUSBTRACE")); |
|
748 console = test.Console(); |
|
749 DoTests(); |
|
750 test.End(); |
|
751 test.Close(); |
|
752 |
|
753 return(KErrNone); |
|
754 } |