imgtools/imgcheck/imagechekunittest/testcode/e32inputnochecktest.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 "e32inputnochecktest.h"
       
    21 
       
    22 CPPUNIT_TEST_SUITE_REGISTRATION( CTestE32InputNoCheck );
       
    23 
       
    24 #include "depchecker.h"
       
    25 #include "exceptionreporter.h"
       
    26 
       
    27 
       
    28 /**
       
    29 Test the E32 Input results by provinding  directory with valid E32executables and check for the DBG flag to be false by default.
       
    30 Note: Refer the code coverage output for percentage of check.
       
    31 
       
    32 @internalComponent
       
    33 @released
       
    34 */
       
    35 void CTestE32InputNoCheck::TestForRofsImageOutputforE32inputDbg()
       
    36 {
       
    37 	int status = 0;
       
    38 	CmdLineHandler* cmdInput;
       
    39 	ImgCheckManager* imgCheckerPtr;
       
    40 
       
    41 	try
       
    42 	{
       
    43 		char* argvect[] = { "imgchecker", "--dbg", "--e32input", "S:/GT0415/cppunit/imgcheck_unittest/imgs/executables" };
       
    44 		cmdInput = new CmdLineHandler();
       
    45 		ReturnType val = cmdInput->ProcessCommandLine(4,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 	delete cmdInput;
       
    63 }
       
    64 
       
    65 /**
       
    66 Test the E32 Input results by provinding  directory with valid E32executables and check for the DBG flag to be true
       
    67 Note: Refer the code coverage output for percentage of check.
       
    68 
       
    69 @internalComponent
       
    70 @released
       
    71 */
       
    72 void CTestE32InputNoCheck::TestForRofsImageOutputforE32inputDbgTrue()
       
    73 {
       
    74 	int status = 0;
       
    75 	CmdLineHandler* cmdInput;
       
    76 	ImgCheckManager* imgCheckerPtr;
       
    77 
       
    78 	try
       
    79 	{
       
    80 		char* argvect[] = { "imgchecker", "--dbg=true", "--e32input", "S:/GT0415/cppunit/imgcheck_unittest/imgs/executables", "-x" };
       
    81 		cmdInput = new CmdLineHandler();
       
    82 		ReturnType val = cmdInput->ProcessCommandLine(5,argvect);
       
    83 		if(val == ESuccess)
       
    84 		{
       
    85 			imgCheckerPtr = new ImgCheckManager(cmdInput);
       
    86 			imgCheckerPtr->CreateObjects();
       
    87 			imgCheckerPtr->Execute();
       
    88             imgCheckerPtr->FillReporterData();
       
    89             imgCheckerPtr->GenerateReport();
       
    90 		}
       
    91 	}
       
    92 	catch(ExceptionReporter& aExceptionReport)
       
    93 	{
       
    94 		aExceptionReport.Report();
       
    95 		status = 0;
       
    96 	}
       
    97 	DELETE(cmdInput);
       
    98 	DELETE(imgCheckerPtr);
       
    99 	delete cmdInput;
       
   100 }
       
   101 
       
   102 /**
       
   103 Test the E32 Input results by provinding  directory with valid E32executables and check for the DBG flag to be true along with VID check
       
   104 Note: Refer the code coverage output for percentage of check.
       
   105 
       
   106 @internalComponent
       
   107 @released
       
   108 */
       
   109 void CTestE32InputNoCheck::TestForRofsImageOutputforE32inputDbgTrueandVID()
       
   110 {
       
   111 	int status = 0;
       
   112 	CmdLineHandler* cmdInput;
       
   113 	ImgCheckManager* imgCheckerPtr;
       
   114 
       
   115 	try
       
   116 	{
       
   117 		char* argvect[] = { "imgchecker", "--dbg=true", "--vid", "--all", "--e32input", "S:/GT0415/cppunit/imgcheck_unittest/imgs/executables" };
       
   118 		cmdInput = new CmdLineHandler();
       
   119 		ReturnType val = cmdInput->ProcessCommandLine(6,argvect);
       
   120 		if(val == ESuccess)
       
   121 		{
       
   122 			imgCheckerPtr = new ImgCheckManager(cmdInput);
       
   123 			imgCheckerPtr->CreateObjects();
       
   124 			imgCheckerPtr->Execute();
       
   125             imgCheckerPtr->FillReporterData();
       
   126             imgCheckerPtr->GenerateReport();
       
   127 		}
       
   128 	}
       
   129 	catch(ExceptionReporter& aExceptionReport)
       
   130 	{
       
   131 		aExceptionReport.Report();
       
   132 		status = 0;
       
   133 	}
       
   134 	DELETE(cmdInput);
       
   135 	DELETE(imgCheckerPtr);
       
   136 	delete cmdInput;
       
   137 }
       
   138 
       
   139 /**
       
   140 Test the E32 Input results by provinding  directory with valid E32executables and check for the DBG flag to be true along with VID & SID check
       
   141 Note: Refer the code coverage output for percentage of check.
       
   142 
       
   143 @internalComponent
       
   144 @released
       
   145 */
       
   146 void CTestE32InputNoCheck::TestForRofsImageOutputforE32inputDbgTrueandVIDSID()
       
   147 {
       
   148 	int status = 0;
       
   149 	CmdLineHandler* cmdInput;
       
   150 	ImgCheckManager* imgCheckerPtr;
       
   151 
       
   152 	try
       
   153 	{
       
   154 		char* argvect[] = { "imgchecker", "--dbg=true", "--vid", "--all", "--sid", "--sidall", "--e32input", "S:/GT0415/cppunit/imgcheck_unittest/imgs/executables" };
       
   155 		cmdInput = new CmdLineHandler();
       
   156 		ReturnType val = cmdInput->ProcessCommandLine(8,argvect);
       
   157 		if(val == ESuccess)
       
   158 		{
       
   159 			imgCheckerPtr = new ImgCheckManager(cmdInput);
       
   160 			imgCheckerPtr->CreateObjects();
       
   161 			imgCheckerPtr->Execute();
       
   162             imgCheckerPtr->FillReporterData();
       
   163             imgCheckerPtr->GenerateReport();
       
   164 		}
       
   165 	}
       
   166 	catch(ExceptionReporter& aExceptionReport)
       
   167 	{
       
   168 		aExceptionReport.Report();
       
   169 		status = 0;
       
   170 	}
       
   171 	DELETE(cmdInput);
       
   172 	DELETE(imgCheckerPtr);
       
   173 	delete cmdInput;
       
   174 }
       
   175 
       
   176 /**
       
   177 Test the E32 Input results by provinding  directory with valid E32executables and check for the DBG flag to be true along with VID & SID ALL checks
       
   178 Note: Refer the code coverage output for percentage of check.
       
   179 
       
   180 @internalComponent
       
   181 @released
       
   182 */
       
   183 void CTestE32InputNoCheck::TestForRofsImageOutputforE32inputandNoCheck()
       
   184 {
       
   185 	int status = 0;
       
   186 	CmdLineHandler* cmdInput;
       
   187 	ImgCheckManager* imgCheckerPtr;
       
   188 
       
   189 	try
       
   190 	{
       
   191 		char* argvect[] = { "imgchecker", "--dbg=true", "--vid", "--all", "--sid", "--sidall", "--e32input", "S:/GT0415/cppunit/imgcheck_unittest/imgs/executables", "-n" };
       
   192 		cmdInput = new CmdLineHandler();
       
   193 		ReturnType val = cmdInput->ProcessCommandLine(9,argvect);
       
   194 		if(val == ESuccess)
       
   195 		{
       
   196 			imgCheckerPtr = new ImgCheckManager(cmdInput);
       
   197 			imgCheckerPtr->CreateObjects();
       
   198 			imgCheckerPtr->Execute();
       
   199             imgCheckerPtr->FillReporterData();
       
   200             imgCheckerPtr->GenerateReport();
       
   201 		}
       
   202 	}
       
   203 	catch(ExceptionReporter& aExceptionReport)
       
   204 	{
       
   205 		aExceptionReport.Report();
       
   206 		status = 0;
       
   207 	}
       
   208 	DELETE(cmdInput);
       
   209 	DELETE(imgCheckerPtr);
       
   210 	delete cmdInput;
       
   211 }
       
   212 
       
   213 /**
       
   214 Test the E32 Input results by provinding  directory with valid E32executables and check for the DBG flag to be true along with VID, DEP, SID ALL checks
       
   215 Note: Refer the code coverage output for percentage of check.
       
   216 
       
   217 @internalComponent
       
   218 @released
       
   219 */
       
   220 void CTestE32InputNoCheck::TestForRofsImageOutputforE32inputandNoCheckforAll()
       
   221 {
       
   222 	int status = 0;
       
   223 	CmdLineHandler* cmdInput;
       
   224 	ImgCheckManager* imgCheckerPtr;
       
   225 
       
   226 	try
       
   227 	{
       
   228 		char* argvect[] = { "imgchecker", "--dbg=true", "--vid", "--all", "--sid", "--sidall", "--e32input", "S:/GT0415/cppunit/imgcheck_unittest/imgs/executables", "-n" ,"--dep" };
       
   229 		cmdInput = new CmdLineHandler();
       
   230 		ReturnType val = cmdInput->ProcessCommandLine(10,argvect);
       
   231 		if(val == ESuccess)
       
   232 		{
       
   233 			imgCheckerPtr = new ImgCheckManager(cmdInput);
       
   234 			imgCheckerPtr->CreateObjects();
       
   235 			imgCheckerPtr->Execute();
       
   236             imgCheckerPtr->FillReporterData();
       
   237             imgCheckerPtr->GenerateReport();
       
   238 		}
       
   239 	}
       
   240 	catch(ExceptionReporter& aExceptionReport)
       
   241 	{
       
   242 		aExceptionReport.Report();
       
   243 		status = 0;
       
   244 	}
       
   245 	DELETE(cmdInput);
       
   246 	DELETE(imgCheckerPtr);
       
   247 	delete cmdInput;
       
   248 }
       
   249 
       
   250 
       
   251 /**
       
   252 Test the E32 Input results by provinding  directory with valid E32executables and check for the DBG flag to be true along with VID, SID, DEP with Nocheck
       
   253 Note: Refer the code coverage output for percentage of check.
       
   254 
       
   255 @internalComponent
       
   256 @released
       
   257 */
       
   258 void CTestE32InputNoCheck::TestForRofsImageOutputforE32inputandNoCheckforAll1()
       
   259 {
       
   260 	int status = 0;
       
   261 	CmdLineHandler* cmdInput;
       
   262 	ImgCheckManager* imgCheckerPtr;
       
   263 
       
   264 	try
       
   265 	{
       
   266 		char* argvect[] = { "imgchecker", "--dbg=true", "--vid", "--sid", "--sidall", "--e32input", "S:/GT0415/cppunit/imgcheck_unittest/imgs/executables", "--nocheck" ,"--dep" };
       
   267 		cmdInput = new CmdLineHandler();
       
   268 		ReturnType val = cmdInput->ProcessCommandLine(9,argvect);
       
   269 		if(val == ESuccess)
       
   270 		{
       
   271 			imgCheckerPtr = new ImgCheckManager(cmdInput);
       
   272 			imgCheckerPtr->CreateObjects();
       
   273 			imgCheckerPtr->Execute();
       
   274             imgCheckerPtr->FillReporterData();
       
   275             imgCheckerPtr->GenerateReport();
       
   276 		}
       
   277 	}
       
   278 	catch(ExceptionReporter& aExceptionReport)
       
   279 	{
       
   280 		aExceptionReport.Report();
       
   281 		status = 0;
       
   282 	}
       
   283 	DELETE(cmdInput);
       
   284 	DELETE(imgCheckerPtr);
       
   285 	delete cmdInput;
       
   286 }
       
   287 
       
   288 /**
       
   289 Test the SID and SIDALL wby providing alias image .
       
   290 Note: Refer the code coverage output for percentage of check.
       
   291 
       
   292 @internalComponent
       
   293 @released
       
   294 */
       
   295 void CTestE32InputNoCheck::TestForRofsImageOutputforSIDAlias()
       
   296 {
       
   297 	int status = 0;
       
   298 	CmdLineHandler* cmdInput;
       
   299 	ImgCheckManager* imgCheckerPtr;
       
   300 
       
   301 	try
       
   302 	{
       
   303 		char* argvect[] = { "imgchecker", "--sid", "--sidall","-a",   "S:/GT0415/cppunit/imgcheck_unittest/imgs/rofseg.img"};
       
   304 		cmdInput = new CmdLineHandler();
       
   305 		ReturnType val = cmdInput->ProcessCommandLine(5,argvect);
       
   306 		if(val == ESuccess)
       
   307 		{
       
   308 			imgCheckerPtr = new ImgCheckManager(cmdInput);
       
   309 			imgCheckerPtr->CreateObjects();
       
   310 			imgCheckerPtr->Execute();
       
   311             imgCheckerPtr->FillReporterData();
       
   312             imgCheckerPtr->GenerateReport();
       
   313 		}
       
   314 	}
       
   315 	catch(ExceptionReporter& aExceptionReport)
       
   316 	{
       
   317 		aExceptionReport.Report();
       
   318 		status = 0;
       
   319 	}
       
   320 	DELETE(cmdInput);
       
   321 	DELETE(imgCheckerPtr);
       
   322 	delete cmdInput;
       
   323 }
       
   324 
       
   325 /**
       
   326 Test E32 File for DBG flag to be true in verbose mode
       
   327 Note: Refer the code coverage output for percentage of check.
       
   328 
       
   329 @internalComponent
       
   330 @released
       
   331 */
       
   332 void CTestE32InputNoCheck::TestE32fileDbgFlag()
       
   333 {
       
   334 	int status = 0;
       
   335 	CmdLineHandler* cmdInput;
       
   336 	ImgCheckManager* imgCheckerPtr;
       
   337 
       
   338 	try
       
   339 	{
       
   340 		char* argvect[] = { "imgchecker", "--e32input", "--dbg=true", "-a",   "S:/GT0415/cppunit/imgcheck_unittest/imgs/executables/HelloWorld.exe", "--verbose"};
       
   341 		cmdInput = new CmdLineHandler();
       
   342 		ReturnType val = cmdInput->ProcessCommandLine(6,argvect);
       
   343 		if(val == ESuccess)
       
   344 		{
       
   345 			imgCheckerPtr = new ImgCheckManager(cmdInput);
       
   346 			imgCheckerPtr->CreateObjects();
       
   347 			imgCheckerPtr->Execute();
       
   348             imgCheckerPtr->FillReporterData();
       
   349             imgCheckerPtr->GenerateReport();
       
   350 		}
       
   351 	}
       
   352 	catch(ExceptionReporter& aExceptionReport)
       
   353 	{
       
   354 		aExceptionReport.Report();
       
   355 		status = 0;
       
   356 	}
       
   357 	DELETE(cmdInput);
       
   358 	DELETE(imgCheckerPtr);
       
   359 	delete cmdInput;
       
   360 }
       
   361 
       
   362 /**
       
   363 Test the E32 input with an empty folder as an input
       
   364 Note: Refer the code coverage output for percentage of check.
       
   365 
       
   366 @internalComponent
       
   367 @released
       
   368 */
       
   369 void CTestE32InputNoCheck::TestEmptyDirectory()
       
   370 {
       
   371 	int status = 0;
       
   372 	CmdLineHandler* cmdInput;
       
   373 	ImgCheckManager* imgCheckerPtr;
       
   374 
       
   375 	try
       
   376 	{
       
   377 		char* argvect[] = { "imgchecker", "--e32input", "--dbg=true", "-a",   "S:/GT0415/cppunit/imgcheck_unittest/imgs/empty"};
       
   378 		cmdInput = new CmdLineHandler();
       
   379 		ReturnType val = cmdInput->ProcessCommandLine(5,argvect);
       
   380 		if(val == ESuccess)
       
   381 		{
       
   382 			imgCheckerPtr = new ImgCheckManager(cmdInput);
       
   383 			imgCheckerPtr->CreateObjects();
       
   384 			imgCheckerPtr->Execute();
       
   385             imgCheckerPtr->FillReporterData();
       
   386             imgCheckerPtr->GenerateReport();
       
   387 		}
       
   388 	}
       
   389 	catch(ExceptionReporter& aExceptionReport)
       
   390 	{
       
   391 		aExceptionReport.Report();
       
   392 		status = 0;
       
   393 	}
       
   394 	DELETE(cmdInput);
       
   395 	DELETE(imgCheckerPtr);
       
   396 	delete cmdInput;
       
   397 }
       
   398 
       
   399 /**
       
   400 Test E32 input with a valid directory for ALL DBG checks
       
   401 Note: Refer the code coverage output for percentage of check.
       
   402 
       
   403 @internalComponent
       
   404 @released
       
   405 */
       
   406 void CTestE32InputNoCheck::TestDirectoryforALL()
       
   407 {
       
   408 	int status = 0;
       
   409 	CmdLineHandler* cmdInput;
       
   410 	ImgCheckManager* imgCheckerPtr;
       
   411 
       
   412 	try
       
   413 	{
       
   414 		char* argvect[] = { "imgchecker", "--e32input", "--dbg=true", "-a",   "S:/GT0415/cppunit/imgcheck_unittest/imgs/executables"};
       
   415 		cmdInput = new CmdLineHandler();
       
   416 		ReturnType val = cmdInput->ProcessCommandLine(5,argvect);
       
   417 		if(val == ESuccess)
       
   418 		{
       
   419 			imgCheckerPtr = new ImgCheckManager(cmdInput);
       
   420 			imgCheckerPtr->CreateObjects();
       
   421 			imgCheckerPtr->Execute();
       
   422             imgCheckerPtr->FillReporterData();
       
   423             imgCheckerPtr->GenerateReport();
       
   424 		}
       
   425 	}
       
   426 	catch(ExceptionReporter& aExceptionReport)
       
   427 	{
       
   428 		aExceptionReport.Report();
       
   429 		status = 0;
       
   430 	}
       
   431 	DELETE(cmdInput);
       
   432 	DELETE(imgCheckerPtr);
       
   433 	delete cmdInput;
       
   434 }
       
   435 
       
   436 
       
   437 /**
       
   438 Test with invalid e32 input for DBG flag cehck.
       
   439 Note: Refer the code coverage output for percentage of check.
       
   440 
       
   441 @internalComponent
       
   442 @released
       
   443 */
       
   444 void CTestE32InputNoCheck::TestForInValidE32Input()
       
   445 {
       
   446 	int status = 0;
       
   447 	CmdLineHandler* cmdInput;
       
   448 	ImgCheckManager* imgCheckerPtr;
       
   449 
       
   450 	try
       
   451 	{
       
   452 		char* argvect[] = { "imgchecker", "--e32input", "--dbg=true",    "S:/GT0415/cppunit/imgcheck_unittest/imgs/input/imgcheck.log"};
       
   453 		cmdInput = new CmdLineHandler();
       
   454 		ReturnType val = cmdInput->ProcessCommandLine(4,argvect);
       
   455 		if(val == ESuccess)
       
   456 		{
       
   457 			imgCheckerPtr = new ImgCheckManager(cmdInput);
       
   458 			imgCheckerPtr->CreateObjects();
       
   459 			imgCheckerPtr->Execute();
       
   460             imgCheckerPtr->FillReporterData();
       
   461             imgCheckerPtr->GenerateReport();
       
   462 		}
       
   463 	}
       
   464 	catch(ExceptionReporter& aExceptionReport)
       
   465 	{
       
   466 		aExceptionReport.Report();
       
   467 		status = 0;
       
   468 	}
       
   469 	DELETE(cmdInput);
       
   470 	DELETE(imgCheckerPtr);
       
   471 	delete cmdInput;
       
   472 }
       
   473