|
1 /** |
|
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file CFlashDataSourceWrapper.h |
|
22 @internalTechnology |
|
23 @prototype |
|
24 */ |
|
25 |
|
26 #ifndef __CFLASHDATASOURCEWRAPPER_H__ |
|
27 #define __CFLASHDATASOURCEWRAPPER_H__ |
|
28 |
|
29 #include <datawrapper.h> |
|
30 #include <rm_debug_api.h> |
|
31 #include <scmdatatypes.h> |
|
32 #include <scmbytestreamutil.h> |
|
33 |
|
34 #include "flashdatasource.h" |
|
35 |
|
36 using namespace Debug; |
|
37 |
|
38 /** |
|
39 This is the version of the security server that we have developed our code against |
|
40 and it comes from the interface definition of the DSS at the time of compilation. |
|
41 */ |
|
42 const TVersion securityServerVersion( |
|
43 KDebugServMajorVersionNumber, |
|
44 KDebugServMinorVersionNumber, |
|
45 KDebugServPatchVersionNumber ); |
|
46 |
|
47 const TInt CRASH_ID = 1; |
|
48 |
|
49 const TUint KMaxCacheSize = 32; |
|
50 /** |
|
51 * This class is responsible for testing our CFlashDataSource class |
|
52 */ |
|
53 class CFlashDataSourceWrapper : public CDataWrapper |
|
54 { |
|
55 |
|
56 public: |
|
57 |
|
58 ~CFlashDataSourceWrapper(); |
|
59 |
|
60 static CFlashDataSourceWrapper* NewL(); |
|
61 |
|
62 virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex); |
|
63 virtual TAny* GetObject() { return iObject; } |
|
64 virtual void SetObjectL(TAny* aObject); |
|
65 |
|
66 protected: |
|
67 void ConstructL(); |
|
68 |
|
69 private: |
|
70 |
|
71 /** Constructor */ |
|
72 CFlashDataSourceWrapper(); |
|
73 |
|
74 /** Tests CFlashDataSource::NewL */ |
|
75 void DoCmdCrashFlashDataSource_NewL_TestL(); |
|
76 |
|
77 /** Tests CFlashDataSource::ReadCrashLog |
|
78 * Ensures the crash Log can be read correctly into our flash buffer |
|
79 */ |
|
80 void DoCmd_ReadCrashLog_L(); |
|
81 |
|
82 /** Tests CFlashDataSource::GetFlashBuffer |
|
83 * Ensures that the flash buffer is correctly returned by getter |
|
84 */ |
|
85 void DoCmd_GetFlashBuffer_L(); |
|
86 |
|
87 /** Tests CFlashDataSource::ProcessCrashHeader |
|
88 * Ensures we can correctly process the crash header |
|
89 */ |
|
90 void DoCmd_ProcessCrashHeader1_L(); |
|
91 |
|
92 /** Tests CFlashDataSource::ProcessCrashHeader |
|
93 * Ensures we can recognise a corrupt header |
|
94 */ |
|
95 void DoCmd_ProcessCrashHeader2_L(); |
|
96 |
|
97 /** Tests CFlashDataSource::GetProcessListL |
|
98 * Writes known process list to flash and makes sure we can get it back |
|
99 */ |
|
100 void DoCmd_GetProcessListL1_Test_L(); |
|
101 |
|
102 /** Tests CFlashDataSource::GetProcessListL |
|
103 * Ensure we recognise corrupt process list |
|
104 */ |
|
105 void DoCmd_GetProcessListL2_Test_L(); |
|
106 |
|
107 /** Tests CFlashDataSource::GetThreadList |
|
108 * Writes known system wide thread list to flash and makes sure we can get it back |
|
109 */ |
|
110 void DoCmd_GetThreadListL1_Test_L(); |
|
111 |
|
112 /** Tests CFlashDataSource::GetThreadList |
|
113 * Ensure we recognise corrupt thread list |
|
114 */ |
|
115 void DoCmd_GetThreadListL2_Test_L(); |
|
116 |
|
117 /** Tests CFlashDataSource::GetThreadList |
|
118 * Looks at a process specific thread list |
|
119 */ |
|
120 void DoCmd_GetThreadListL3_Test_L(); |
|
121 |
|
122 /** Tests CFlashDataSource::ReadRegistersL |
|
123 * Writes known registers to flash and ensures the correct ones are returned |
|
124 */ |
|
125 void DoCmd_ReadRegistersL1_Test_L(); |
|
126 |
|
127 /** Tests CFlashDataSource::ReadMemoryL |
|
128 * Writes known memory to flash and ensures the correct ones are returned |
|
129 */ |
|
130 void DoCmd_ReadMemoryL1_Test_L(); |
|
131 |
|
132 /** Negative tests for read memory |
|
133 * Ensures we cant read memory we havent dumped |
|
134 */ |
|
135 void DoCmd_ReadMemoryL2_Test_L(); |
|
136 |
|
137 /** Tests CFlashDataSource::GetCodeSegmentsL |
|
138 * Writes known code segments to flash and ensures we can get them back |
|
139 */ |
|
140 void DoCmd_GetCodeSegmentsL1_Test_L(); |
|
141 |
|
142 /** Tests CFlashDataSource::GetCodeSegmentsL |
|
143 * Ensure we recognise corrupt data |
|
144 */ |
|
145 void DoCmd_GetCodeSegmentsL2_Test_L(); |
|
146 |
|
147 /** |
|
148 * Tests CFlashDataSource::GetCodeSegmentsL |
|
149 * Ensure we do not recieve duplicate segments back |
|
150 * even when we write duplicates to flash |
|
151 */ |
|
152 void DoCmd_GetCodeSegmentsL3_Test_L(); |
|
153 |
|
154 /** Tests CFlashDataSource::ReadTraceBufferL |
|
155 * Ensure we can read back the correct test data |
|
156 */ |
|
157 void DoCmd_ReadTraceBufferL1_Test_L(); |
|
158 |
|
159 /** Tests data checksums */ |
|
160 void DoCmd_CalculateChecksum_TestL(); |
|
161 |
|
162 /** Tests we can get back the correct trace size */ |
|
163 void DoCmd_TraceDataSizeL_TestL(); |
|
164 |
|
165 /** Tests we can handle the size not being found */ |
|
166 void DoCmd_TraceDataSizeNotFoundL_TestL(); |
|
167 |
|
168 /** Tests we can read trace with an offset */ |
|
169 void DoCmd_ReadTraceBufferL2_Test_L(); |
|
170 |
|
171 void PrepareTestL(); |
|
172 |
|
173 private: |
|
174 |
|
175 /** Object to be tested */ |
|
176 CFlashDataSource* iObject; |
|
177 |
|
178 /** Handle to debug security server */ |
|
179 RSecuritySvrSession iSecSess; |
|
180 |
|
181 /** These are our crash headers */ |
|
182 TCrashInfoHeader iInfHdr; |
|
183 TCrashOffsetsHeader iOffsetsHdr; |
|
184 TRegisterSet iContextHdr; |
|
185 |
|
186 }; |
|
187 #endif // __CFLASHDATASOURCEWRAPPER_H__ |