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