|
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 the License "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 * CMDLINEHANDLERTEST.CPP |
|
16 * Unittest cases for command line handler file. |
|
17 * Note : Tested by passing different images. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 /** |
|
23 @file |
|
24 @internalComponent |
|
25 @released |
|
26 */ |
|
27 #include <cppunit/config/SourcePrefix.h> |
|
28 #include "imagecheckertest.h" |
|
29 |
|
30 CPPUNIT_TEST_SUITE_REGISTRATION( CTestImageChecker ); |
|
31 |
|
32 #include "depchecker.h" |
|
33 #include "exceptionreporter.h" |
|
34 |
|
35 |
|
36 /** |
|
37 Test the imagechecker output(cmdline) by provinding any image. |
|
38 Note: Refer the code coverage output for percentage of check. |
|
39 Pass the valid image.(rofs.img). |
|
40 |
|
41 @internalComponent |
|
42 @released |
|
43 */ |
|
44 void CTestImageChecker::TestForRofsImageOutput() |
|
45 { |
|
46 int status = 0; |
|
47 CmdLineHandler* cmdInput; |
|
48 ImgCheckManager* imgCheckerPtr; |
|
49 |
|
50 try |
|
51 { |
|
52 char* argvect[] = { "imgchecker", "--verbose", "-s=dep", "S:/GT0415/cppunit/imgcheck_unittest/imgs/rofs1.img" }; |
|
53 cmdInput = new CmdLineHandler(); |
|
54 ReturnType val = cmdInput->ProcessCommandLine(4,argvect); |
|
55 if(val == ESuccess) |
|
56 { |
|
57 imgCheckerPtr = new ImgCheckManager(cmdInput); |
|
58 imgCheckerPtr->CreateObjects(); |
|
59 imgCheckerPtr->Execute(); |
|
60 imgCheckerPtr->FillReporterData(); |
|
61 imgCheckerPtr->GenerateReport(); |
|
62 } |
|
63 } |
|
64 catch(ExceptionReporter& aExceptionReport) |
|
65 { |
|
66 aExceptionReport.Report(); |
|
67 status = 0; |
|
68 } |
|
69 DELETE(cmdInput); |
|
70 DELETE(imgCheckerPtr); |
|
71 delete cmdInput; |
|
72 } |
|
73 |
|
74 |
|
75 /** |
|
76 Test the imagechecker output(xml) by provinding any image. |
|
77 Note: Refer the code coverage output for percentage of check. |
|
78 Pass the valid image.(rofs.img). |
|
79 |
|
80 @internalComponent |
|
81 @released |
|
82 */ |
|
83 void CTestImageChecker::TestForRomRofsImageOutputXml() |
|
84 { |
|
85 int status = 0; |
|
86 CmdLineHandler* cmdInput; |
|
87 ImgCheckManager* imgCheckerPtr; |
|
88 try |
|
89 { |
|
90 char* argvect[] = { "imgchecker", "-q", "-x", "S:/GT0415/cppunit/imgcheck_unittest/imgs/rom.img", "S:/GT0415/cppunit/imgcheck_unittest/imgs/rofs1.img" }; |
|
91 cmdInput = new CmdLineHandler(); |
|
92 ReturnType val = cmdInput->ProcessCommandLine(5,argvect); |
|
93 if(val == ESuccess) |
|
94 { |
|
95 imgCheckerPtr = new ImgCheckManager(cmdInput); |
|
96 imgCheckerPtr->CreateObjects(); |
|
97 imgCheckerPtr->Execute(); |
|
98 imgCheckerPtr->FillReporterData(); |
|
99 imgCheckerPtr->GenerateReport(); |
|
100 } |
|
101 } |
|
102 catch(ExceptionReporter& aExceptionReport) |
|
103 { |
|
104 aExceptionReport.Report(); |
|
105 status = 0; |
|
106 } |
|
107 |
|
108 DELETE(cmdInput); |
|
109 DELETE(imgCheckerPtr); |
|
110 delete cmdInput; |
|
111 } |
|
112 |
|
113 |
|
114 /** |
|
115 Test the imagechecker output(xml) by provinding any image. |
|
116 Note: Refer the code coverage output for percentage of check. |
|
117 Pass the valid image.(rofs.img). |
|
118 |
|
119 @internalComponent |
|
120 @released |
|
121 */ |
|
122 void CTestImageChecker::TestForRomRofsImageOutputALL() |
|
123 { |
|
124 int status = 0; |
|
125 CmdLineHandler* cmdInput; |
|
126 ImgCheckManager* imgCheckerPtr; |
|
127 try |
|
128 { |
|
129 char* argvect[] = { "imgchecker", "-o=S:\\GT0415\\cppunit\\imgcheck_unittest\\imgs\\test", "-x", "--all","-s=vid", "--sid", "S:/GT0415/cppunit/imgcheck_unittest/imgs/rom.img", "S:/GT0415/cppunit/imgcheck_unittest/imgs/rofs1.img" }; |
|
130 cmdInput = new CmdLineHandler(); |
|
131 ReturnType val = cmdInput->ProcessCommandLine(8,argvect); |
|
132 if(val == ESuccess) |
|
133 { |
|
134 imgCheckerPtr = new ImgCheckManager(cmdInput); |
|
135 imgCheckerPtr->CreateObjects(); |
|
136 imgCheckerPtr->Execute(); |
|
137 imgCheckerPtr->FillReporterData(); |
|
138 imgCheckerPtr->GenerateReport(); |
|
139 } |
|
140 } |
|
141 catch(ExceptionReporter& aExceptionReport) |
|
142 { |
|
143 aExceptionReport.Report(); |
|
144 status = 0; |
|
145 } |
|
146 |
|
147 DELETE(cmdInput); |
|
148 DELETE(imgCheckerPtr); |
|
149 delete cmdInput; |
|
150 } |
|
151 |
|
152 /** |
|
153 Test the imagechecker output(xml) by provinding any image. |
|
154 Note: Refer the code coverage output for percentage of check. |
|
155 Pass the valid image.(rofs.img). |
|
156 |
|
157 @internalComponent |
|
158 @released |
|
159 */ |
|
160 void CTestImageChecker::TestForRomRofsImageOutputwithVIDVAL() |
|
161 { |
|
162 int status = 0; |
|
163 CmdLineHandler* cmdInput; |
|
164 ImgCheckManager* imgCheckerPtr; |
|
165 try |
|
166 { |
|
167 char* argvect[] = { "imgchecker", "-v", "-o=S:/GT0415/cppunit/imgcheck_unittest/imgs/test2", "-x", "-a","--vidlist=0x70000001", "--vid", "S:/GT0415/cppunit/imgcheck_unittest/imgs/rom.img", "S:/GT0415/cppunit/imgcheck_unittest/imgs/rofs1.img" }; |
|
168 cmdInput = new CmdLineHandler(); |
|
169 ReturnType val = cmdInput->ProcessCommandLine(9,argvect); |
|
170 if(val == ESuccess) |
|
171 { |
|
172 imgCheckerPtr = new ImgCheckManager(cmdInput); |
|
173 imgCheckerPtr->CreateObjects(); |
|
174 imgCheckerPtr->Execute(); |
|
175 imgCheckerPtr->FillReporterData(); |
|
176 imgCheckerPtr->GenerateReport(); |
|
177 } |
|
178 } |
|
179 catch(ExceptionReporter& aExceptionReport) |
|
180 { |
|
181 aExceptionReport.Report(); |
|
182 status = 0; |
|
183 } |
|
184 |
|
185 DELETE(cmdInput); |
|
186 DELETE(imgCheckerPtr); |
|
187 delete cmdInput; |
|
188 } |
|
189 |
|
190 /** |
|
191 Test the imagechecker output(xml) by provinding any image. |
|
192 Note: Refer the code coverage output for percentage of check. |
|
193 Pass the valid image.(rofs.img). |
|
194 |
|
195 @internalComponent |
|
196 @released |
|
197 */ |
|
198 void CTestImageChecker::TestForRomRofsImageOutputwithDepSuppressed() |
|
199 { |
|
200 int status = 0; |
|
201 CmdLineHandler* cmdInput; |
|
202 ImgCheckManager* imgCheckerPtr; |
|
203 try |
|
204 { |
|
205 char* argvect[] = { "imgchecker", "-o=test", "-x", "-a","--vidlist=0X700EF001", "--vid", "--sid", "--suppress=dep", "S:/GT0415/cppunit/imgcheck_unittest/imgs/rom.img", "S:/GT0415/cppunit/imgcheck_unittest/imgs/rofs1.img" }; |
|
206 cmdInput = new CmdLineHandler(); |
|
207 ReturnType val = cmdInput->ProcessCommandLine(10,argvect); |
|
208 if(val == ESuccess) |
|
209 { |
|
210 imgCheckerPtr = new ImgCheckManager(cmdInput); |
|
211 imgCheckerPtr->CreateObjects(); |
|
212 imgCheckerPtr->Execute(); |
|
213 imgCheckerPtr->FillReporterData(); |
|
214 imgCheckerPtr->GenerateReport(); |
|
215 } |
|
216 } |
|
217 catch(ExceptionReporter& aExceptionReport) |
|
218 { |
|
219 aExceptionReport.Report(); |
|
220 status = 0; |
|
221 } |
|
222 |
|
223 DELETE(cmdInput); |
|
224 DELETE(imgCheckerPtr); |
|
225 delete cmdInput; |
|
226 } |
|
227 |
|
228 /** |
|
229 Test the imagechecker output(xml) by provinding any image. |
|
230 Note: Refer the code coverage output for percentage of check. |
|
231 Pass the valid image.(rofs.img). |
|
232 |
|
233 @internalComponent |
|
234 @released |
|
235 */ |
|
236 void CTestImageChecker::TestForExtnRomRofsImageOutput() |
|
237 { |
|
238 int status = 0; |
|
239 CmdLineHandler* cmdInput; |
|
240 ImgCheckManager* imgCheckerPtr; |
|
241 try |
|
242 { |
|
243 char* argvect[] = { "imgchecker", "-o=test", "-x", "-a","--vidlist=0x70000001", "--vid", "--sid", "-s=vid", "S:/GT0415/cppunit/imgcheck_unittest/imgs/extrom.img", "S:/GT0415/cppunit/imgcheck_unittest/imgs/extrom1.img", "S:/GT0415/cppunit/imgcheck_unittest/imgs/extrofs.img", "S:/GT0415/cppunit/imgcheck_unittest/imgs/extrofs1.img" }; |
|
244 cmdInput = new CmdLineHandler(); |
|
245 ReturnType val = cmdInput->ProcessCommandLine(12,argvect); |
|
246 if(val == ESuccess) |
|
247 { |
|
248 imgCheckerPtr = new ImgCheckManager(cmdInput); |
|
249 imgCheckerPtr->CreateObjects(); |
|
250 imgCheckerPtr->Execute(); |
|
251 imgCheckerPtr->FillReporterData(); |
|
252 imgCheckerPtr->GenerateReport(); |
|
253 } |
|
254 } |
|
255 catch(ExceptionReporter& aExceptionReport) |
|
256 { |
|
257 aExceptionReport.Report(); |
|
258 status = 0; |
|
259 } |
|
260 |
|
261 DELETE(cmdInput); |
|
262 DELETE(imgCheckerPtr); |
|
263 delete cmdInput; |
|
264 } |
|
265 |
|
266 /** |
|
267 Test the imagechecker output(xml) by provinding any image. |
|
268 Note: Refer the code coverage output for percentage of check. |
|
269 Pass the valid image.(rofs.img). |
|
270 |
|
271 @internalComponent |
|
272 @released |
|
273 */ |
|
274 void CTestImageChecker::TestForInvalidImageOutput() |
|
275 { |
|
276 int status = 0; |
|
277 CmdLineHandler* cmdInput; |
|
278 ImgCheckManager* imgCheckerPtr; |
|
279 try |
|
280 { |
|
281 char* argvect[] = { "imgchecker", "S:/GT0415/cppunit/imgcheck_unittest/imgs/invalid.img" }; |
|
282 cmdInput = new CmdLineHandler(); |
|
283 ReturnType val = cmdInput->ProcessCommandLine(2,argvect); |
|
284 if(val == ESuccess) |
|
285 { |
|
286 imgCheckerPtr = new ImgCheckManager(cmdInput); |
|
287 imgCheckerPtr->CreateObjects(); |
|
288 imgCheckerPtr->Execute(); |
|
289 imgCheckerPtr->FillReporterData(); |
|
290 imgCheckerPtr->GenerateReport(); |
|
291 } |
|
292 } |
|
293 catch(ExceptionReporter& aExceptionReport) |
|
294 { |
|
295 aExceptionReport.Report(); |
|
296 status = 0; |
|
297 } |
|
298 |
|
299 DELETE(cmdInput); |
|
300 DELETE(imgCheckerPtr); |
|
301 delete cmdInput; |
|
302 } |
|
303 |
|
304 /** |
|
305 Test the imagechecker output(xml) by provinding any image. |
|
306 Note: Refer the code coverage output for percentage of check. |
|
307 Pass the valid image.(rofs.img). |
|
308 |
|
309 @internalComponent |
|
310 @released |
|
311 */ |
|
312 void CTestImageChecker::TestForHiddenRomRofsImageOutput() |
|
313 { |
|
314 int status = 0; |
|
315 CmdLineHandler* cmdInput; |
|
316 ImgCheckManager* imgCheckerPtr; |
|
317 try |
|
318 { |
|
319 char* argvect[] = { "imgchecker", "-x", "-a", "S:/GT0415/cppunit/imgcheck_unittest/imgs/hideexe_staticdll_rofs1.img", "S:/GT0415/cppunit/imgcheck_unittest/imgs/hideexe_staticdll_rom.img", "S:/GT0415/cppunit/imgcheck_unittest/imgs/hideexe_staticdll_rofs.img", "S:/GT0415/cppunit/imgcheck_unittest/imgs/hideexe_staticdll_rofs1.img" }; |
|
320 cmdInput = new CmdLineHandler(); |
|
321 ReturnType val = cmdInput->ProcessCommandLine(7,argvect); |
|
322 if(val == ESuccess) |
|
323 { |
|
324 imgCheckerPtr = new ImgCheckManager(cmdInput); |
|
325 imgCheckerPtr->CreateObjects(); |
|
326 imgCheckerPtr->Execute(); |
|
327 imgCheckerPtr->FillReporterData(); |
|
328 imgCheckerPtr->GenerateReport(); |
|
329 } |
|
330 } |
|
331 catch(ExceptionReporter& aExceptionReport) |
|
332 { |
|
333 aExceptionReport.Report(); |
|
334 status = 0; |
|
335 } |
|
336 |
|
337 DELETE(cmdInput); |
|
338 DELETE(imgCheckerPtr); |
|
339 ExceptionImplementation::DeleteInstance(); |
|
340 } |
|
341 |
|
342 /** |
|
343 Test the imagechecker output(xml) by provinding any image. |
|
344 Note: Refer the code coverage output for percentage of check. |
|
345 Pass the valid image.(rofs.img). |
|
346 |
|
347 @internalComponent |
|
348 @released |
|
349 */ |
|
350 void CTestImageChecker::TestForRofsImagewithMissingDeps() |
|
351 { |
|
352 int status = 0; |
|
353 CmdLineHandler* cmdInput; |
|
354 ImgCheckManager* imgCheckerPtr; |
|
355 try |
|
356 { |
|
357 char* argvect[] = { "imgchecker", "-x", "--dep", "--verbose", "S:/GT0415/cppunit/imgcheck_unittest/imgs/missingdll_rofs1.img" }; |
|
358 cmdInput = new CmdLineHandler(); |
|
359 ReturnType val = cmdInput->ProcessCommandLine(5,argvect); |
|
360 if(val == ESuccess) |
|
361 { |
|
362 imgCheckerPtr = new ImgCheckManager(cmdInput); |
|
363 imgCheckerPtr->CreateObjects(); |
|
364 imgCheckerPtr->Execute(); |
|
365 imgCheckerPtr->FillReporterData(); |
|
366 imgCheckerPtr->GenerateReport(); |
|
367 } |
|
368 } |
|
369 catch(ExceptionReporter& aExceptionReport) |
|
370 { |
|
371 aExceptionReport.Report(); |
|
372 status = 0; |
|
373 } |
|
374 |
|
375 DELETE(cmdInput); |
|
376 DELETE(imgCheckerPtr); |
|
377 } |
|
378 |
|
379 |
|
380 /** |
|
381 Test the imagechecker output(xml) by provinding any image. |
|
382 Note: Refer the code coverage output for percentage of check. |
|
383 Pass the valid image.(rofs.img). |
|
384 |
|
385 @internalComponent |
|
386 @released |
|
387 */ |
|
388 void CTestImageChecker::TestForHiddenDLLRomRofsImageOutput() |
|
389 { |
|
390 int status = 0; |
|
391 CmdLineHandler* cmdInput; |
|
392 ImgCheckManager* imgCheckerPtr; |
|
393 try |
|
394 { |
|
395 char* argvect[] = { "imgchecker", "-x", "--dep", "-v", "S:/GT0415/cppunit/imgcheck_unittest/imgs/hidedll-rom.img" }; |
|
396 cmdInput = new CmdLineHandler(); |
|
397 ReturnType val = cmdInput->ProcessCommandLine(5,argvect); |
|
398 if(val == ESuccess) |
|
399 { |
|
400 imgCheckerPtr = new ImgCheckManager(cmdInput); |
|
401 imgCheckerPtr->CreateObjects(); |
|
402 imgCheckerPtr->Execute(); |
|
403 imgCheckerPtr->FillReporterData(); |
|
404 imgCheckerPtr->GenerateReport(); |
|
405 } |
|
406 } |
|
407 catch(ExceptionReporter& aExceptionReport) |
|
408 { |
|
409 aExceptionReport.Report(); |
|
410 status = 0; |
|
411 } |
|
412 |
|
413 DELETE(cmdInput); |
|
414 DELETE(imgCheckerPtr); |
|
415 } |
|
416 |
|
417 /** |
|
418 Test the imagechecker output(xml) by provinding any image. |
|
419 Note: Refer the code coverage output for percentage of check. |
|
420 Pass the valid image.(rofs.img). |
|
421 |
|
422 @internalComponent |
|
423 @released |
|
424 */ |
|
425 void CTestImageChecker::TestForRomImagewithSIDALLOutput() |
|
426 { |
|
427 int status = 0; |
|
428 CmdLineHandler* cmdInput; |
|
429 ImgCheckManager* imgCheckerPtr; |
|
430 try |
|
431 { |
|
432 char* argvect[] = { "imgchecker", "-x", "-q", "--sidall", "S:/GT0415/cppunit/imgcheck_unittest/imgs/rofs1.img" }; |
|
433 cmdInput = new CmdLineHandler(); |
|
434 ReturnType val = cmdInput->ProcessCommandLine(5,argvect); |
|
435 if(val == ESuccess) |
|
436 { |
|
437 imgCheckerPtr = new ImgCheckManager(cmdInput); |
|
438 imgCheckerPtr->CreateObjects(); |
|
439 imgCheckerPtr->Execute(); |
|
440 imgCheckerPtr->FillReporterData(); |
|
441 imgCheckerPtr->GenerateReport(); |
|
442 } |
|
443 } |
|
444 catch(ExceptionReporter& aExceptionReport) |
|
445 { |
|
446 aExceptionReport.Report(); |
|
447 status = 0; |
|
448 } |
|
449 |
|
450 DELETE(cmdInput); |
|
451 DELETE(imgCheckerPtr); |
|
452 } |