traceservices/tracefw/integ_test/ulogger/TEF/te_ulogger/src/te_uloggerapiteststep.cpp
changeset 0 08ec8eefde2f
child 23 26645d81f48d
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 2005-2009 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 "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 // Example CTestStep derived implementation
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file te_uloggerapiteststep.cpp
       
    20  @internalTechnology
       
    21 */
       
    22 #include "te_uloggerapiteststep.h"
       
    23 #include "te_uloggermclsuitedefs.h"
       
    24 
       
    25 
       
    26 using namespace Ulogger;
       
    27 
       
    28 /*******************************************************************************/
       
    29 /*********************************Primary Filter Test***************************/
       
    30 /*******************************************************************************/
       
    31 
       
    32 CULoggerAPIPrimTestStep::~CULoggerAPIPrimTestStep()
       
    33 /**
       
    34  * Destructor
       
    35  */
       
    36 	{
       
    37 	}
       
    38 
       
    39 CULoggerAPIPrimTestStep::CULoggerAPIPrimTestStep()
       
    40 /**
       
    41  * Constructor
       
    42  */
       
    43 	{
       
    44 	SetTestStepName(KULoggerAPIPrimTestStep);
       
    45 	}
       
    46 
       
    47 TVerdict CULoggerAPIPrimTestStep::doTestStepPreambleL()
       
    48 /**
       
    49  * @return - TVerdict code
       
    50  * Override of base class virtual
       
    51  */
       
    52 	{
       
    53 	INFO_PRINTF1(_L("Testing ULogger API/uloggerclient.h setting Primary filter functionality, for negative testing edit source"));
       
    54 	SetTestStepResult(EPass);
       
    55 	return TestStepResult();
       
    56 	}
       
    57 
       
    58 
       
    59 TVerdict CULoggerAPIPrimTestStep::doTestStepL()
       
    60 /**
       
    61  * @return - TVerdict code
       
    62  * Override of base class pure virtual
       
    63  * Our implementation only logger.GetS called if the base class doTestStepPreambleL() did
       
    64  * not leave. That being the case, the current test Result value will be EPass.
       
    65  */
       
    66 	{
       
    67 	  if (TestStepResult()==EPass)
       
    68 		{
       
    69 		//  ************** Delete the Block, the block start ****************
       
    70 	
       
    71 		TInt Result=0;
       
    72 		RULogger logger;
       
    73 		CArrayFixFlat<TUint8> *setfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
    74 		setfilter->AppendL(UTracePrimary);
       
    75 		CArrayFixFlat<TUint8> *getfilter = new (ELeave)CArrayFixFlat<TUint8>(1);				
       
    76 		CArrayFixFlat<TUint8> *removefilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
    77 		removefilter->AppendL(setfilter->At(0));	
       
    78 
       
    79 		/**************First set primary filter*************/
       
    80 
       
    81 		Result=logger.Connect();
       
    82 		INFO_PRINTF2(_L("connect err %d"), Result);
       
    83 		CClearConfig configIni;
       
    84 		configIni.Clear(logger);
       
    85 		INFO_PRINTF2(_L("connect err %d"), Result);
       
    86 		Result=logger.SetPrimaryFiltersEnabled(*setfilter,ETrue);
       
    87 		
       
    88 		if(Result==KErrNone)
       
    89 			INFO_PRINTF2(_L("Primary filter has been set with single filter, %d, check log"), setfilter->At(0));
       
    90 		else
       
    91 			INFO_PRINTF2(_L("Primary filter was not set, error returned, %d"), Result);
       
    92 	
       
    93 		/**************Now get the primary filter set above************/
       
    94 	
       
    95 		logger.GetPrimaryFiltersEnabled(*getfilter);
       
    96 		INFO_PRINTF1(_L("Get Primary filter returns the following filters"));
       
    97 		for(TInt i=0;i!=getfilter->Count();i++)
       
    98 		{
       
    99 			INFO_PRINTF2(_L("get filter returns %d "),getfilter->At(i));
       
   100 		}
       
   101 		if(getfilter->At(0)==setfilter->At(0))
       
   102 		{
       
   103 			Result=0;
       
   104 			INFO_PRINTF1(_L("Get primary filter successful"));	
       
   105 		}
       
   106 		else
       
   107 		{
       
   108 			INFO_PRINTF1(_L("Get primary filter failed"));
       
   109 			Result=1;
       
   110 		}
       
   111 		getfilter->Reset();
       
   112 		/*****************Now remove the above set filter***************/
       
   113 
       
   114 		if(Result==0)
       
   115 		{
       
   116 			Result=logger.SetPrimaryFiltersEnabled(*removefilter, EFalse);
       
   117 			INFO_PRINTF2(_L("Remove Primary filters single filter, 0 if succesful: %d"), Result);
       
   118 			logger.GetPrimaryFiltersEnabled(*getfilter);
       
   119 			if(getfilter->Count()==0&&Result==KErrNone)
       
   120 			{
       
   121 				INFO_PRINTF1(_L("Remove primary filter successful"));
       
   122 				Result=0;
       
   123 			}
       
   124 			else
       
   125 			{
       
   126 				if(Result!=0)
       
   127 					INFO_PRINTF1(_L("Remove primary filter failed, as filter has not been set in the config file"));
       
   128 				else
       
   129 					INFO_PRINTF1(_L("Remove primary filter failed, as able to pass same filter option to RemovePrimaryFilter"));
       
   130 				Result=1;
       
   131 			}
       
   132 		}
       
   133 		getfilter->Reset();
       
   134 		
       
   135 		/****Now if the above steps have passed proceed to testing multiple filters***/
       
   136 
       
   137 		if(Result==1)
       
   138 			SetTestStepResult(EFail);
       
   139 		else
       
   140 		{
       
   141 			CArrayFixFlat<TUint8> *setfilters = new (ELeave)CArrayFixFlat<TUint8>(10);
       
   142 			CArrayFixFlat<TUint8> *getfilters = new (ELeave)CArrayFixFlat<TUint8>(10);
       
   143 			for(TInt i=0;i!=MaxNumberOfPrimaryFilters;i++)
       
   144 			{
       
   145 				setfilters->AppendL((TUint8)(i));
       
   146 			}
       
   147 		
       
   148 			/**************First set  multiple primary filter*************/
       
   149 
       
   150 			Result=logger.SetPrimaryFiltersEnabled(*setfilters,ETrue);
       
   151 			if(Result==KErrNone)
       
   152 				INFO_PRINTF1(_L("Primary filter has been set with multiple filters,from 0 to 255"));
       
   153 			else
       
   154 				INFO_PRINTF2(_L("Multiple primary filters have not been set succesfully, error code %d"), Result);
       
   155 		
       
   156 			/**************Now get the primary filter set above************/
       
   157 			logger.Connect();
       
   158 			logger.GetPrimaryFiltersEnabled(*getfilters);
       
   159 			if(getfilters->Count()==setfilters->Count())
       
   160 				INFO_PRINTF1(_L("setfilter and getfilter have the same count"));
       
   161 			else
       
   162 			{
       
   163 				INFO_PRINTF1(_L("setfilter and getfilter have different counts"));
       
   164 				INFO_PRINTF2(_L("setfilter has %d"), setfilters->Count());
       
   165 				INFO_PRINTF2(_L("getfilter has %d"), getfilters->Count());
       
   166 				Result=1;
       
   167 			}
       
   168 			if(Result==0)
       
   169 			{
       
   170 				for(TInt i=0;i!=getfilters->Count() && Result==0;i++)
       
   171 				{
       
   172 					for(TInt j=0;j!=setfilters->Count() && Result!=0;j++)
       
   173 					{
       
   174 						if(getfilters->At(i)==setfilters->At(j))
       
   175 							Result=0;
       
   176 						else
       
   177 							Result=1;
       
   178 					}
       
   179 				}
       
   180 			}
       
   181 			if(Result==0)
       
   182 				INFO_PRINTF1(_L("Get multiple primary filters successful"));
       
   183 			else
       
   184 				INFO_PRINTF1(_L("Get multiple primary filters failed"));
       
   185 			INFO_PRINTF1(_L("Get Primary filters returns multiple filters"));
       
   186 		//	for(int i=0;i!=MaxNumberOfPrimaryFilters;i++)
       
   187 		//		INFO_PRINTF2(_L(" %d"), getfilters->operator[](i));	//uncomment to verify get filters test correct
       
   188 			getfilters->Reset();
       
   189 			
       
   190 			/*****************Given this is successful, now remove the above set filter***************/
       
   191 	
       
   192 			if(Result==0)
       
   193 			{
       
   194 				logger.Connect();
       
   195 				logger.SetPrimaryFiltersEnabled(*removefilter, EFalse);
       
   196 			//	getfilter.Append(removefilter);
       
   197 			//	logger.SetPrimaryFilter(getfilter);//uncomment these to negative test the test suite
       
   198 				logger.GetPrimaryFiltersEnabled(*getfilters);
       
   199 				for(TInt i=0; i!=getfilters->Count() && Result==0;i++)
       
   200 				{
       
   201 					if(getfilters->At(i)==removefilter->At(0))
       
   202 					{
       
   203 						INFO_PRINTF1(_L("Remove primary filter in multiple test failed"));
       
   204 						Result=1;
       
   205 					}
       
   206 					else
       
   207 						Result=0;
       
   208 				}
       
   209 				if(Result==0)
       
   210 					INFO_PRINTF1(_L("Remove primary filter in multiple test successful"));
       
   211 				else
       
   212 					INFO_PRINTF1(_L("Remove primary filter in multiple test failed"));
       
   213 			}
       
   214 			INFO_PRINTF1(_L("Now, given that the above tests have passed, negative test the primary filter options"));
       
   215 			INFO_PRINTF1(_L("First reset the removed filter, then proceed"));
       
   216 			setfilter->At(0)=removefilter->At(0);
       
   217 			logger.SetPrimaryFiltersEnabled(*setfilter,ETrue);
       
   218 			if(Result==0)
       
   219 			{
       
   220 				INFO_PRINTF1(_L("Removed filter has been reset"));
       
   221 			
       
   222 				/************Now try to set a primary filter value greater than that allowed***/
       
   223 			
       
   224 				setfilter->At(0)=((TPrimaryFilter)(MaxNumberOfPrimaryFilters));
       
   225 				INFO_PRINTF2(_L("setfilter is %d"), setfilter->At(0));
       
   226 				TInt r=logger.SetPrimaryFiltersEnabled(*setfilter,ETrue);
       
   227 				if((r==KErrNone)&&(setfilter->At(0)==MaxNumberOfPrimaryFilters-256))
       
   228 				{
       
   229 					INFO_PRINTF3(_L("Primary filter has been set with filter %d,corresponding to the passed value %d, this is allowed as duplicate! Passed"), setfilter->At(0),MaxNumberOfPrimaryFilters );
       
   230 					Result=0;
       
   231 				}
       
   232 				else if((r==KErrNone)&&(setfilter->At(0)!=MaxNumberOfPrimaryFilters-256))
       
   233 				{
       
   234 					INFO_PRINTF3(_L("Primary filter has been set with filter %d,corresponding to the passed value %d, this is not allowed as not duplicate! Failed"), setfilter->At(0),MaxNumberOfPrimaryFilters );
       
   235 					Result=1;
       
   236 				}
       
   237 				else
       
   238 				{
       
   239 					INFO_PRINTF3(_L("Primary filter has not been set with filter %d, corresponding to the passed value %d. Passed"), setfilter->At(0), MaxNumberOfPrimaryFilters);
       
   240 					Result=0;
       
   241 				}
       
   242 				
       
   243 				/************Now try to set more primary filter values greater than available***/
       
   244 
       
   245 				{   
       
   246 					INFO_PRINTF1(_L("Now try to set more filter than available using a duplicate"));
       
   247 					if(Result==0)
       
   248 					{
       
   249 						setfilter->At(0)=((TPrimaryFilter)(MaxNumberOfPrimaryFilters-1));
       
   250 						Result=logger.SetPrimaryFiltersEnabled(*setfilter,ETrue);
       
   251 						if((Result==KErrNone)&&(setfilter->At(0)!=MaxNumberOfPrimaryFilters-1))
       
   252 						{
       
   253 							INFO_PRINTF1(_L("More primary filters than available can be set. Failed"));
       
   254 							Result=1;
       
   255 						}
       
   256 						else
       
   257 						{
       
   258 							INFO_PRINTF1(_L("More primary filters than available cannot be set OR the filter being set is a duplicate. Passed"));
       
   259 							Result=0;
       
   260 						}
       
   261 					}
       
   262 				}
       
   263 			}
       
   264 			if(Result==1)
       
   265 				SetTestStepResult(EFail);
       
   266 			else
       
   267 				SetTestStepResult(EPass);
       
   268 			if(setfilters)
       
   269 			{
       
   270 				delete setfilters;
       
   271 				setfilters=NULL;
       
   272 			}
       
   273 			setfilter->Reset();
       
   274 			if(getfilters)
       
   275 			{
       
   276 				delete getfilters;
       
   277 				getfilters=NULL;
       
   278 			}
       
   279 		}
       
   280 		
       
   281 		//  **************   Block end ****************
       
   282 	
       
   283 		configIni.Clear(logger);
       
   284 		logger.Close();
       
   285 		if(setfilter)
       
   286 			delete setfilter;
       
   287 		if(getfilter)
       
   288 			delete getfilter;
       
   289 		}
       
   290 	  return TestStepResult();
       
   291 	}
       
   292 
       
   293 
       
   294 
       
   295 TVerdict CULoggerAPIPrimTestStep::doTestStepPostambleL()
       
   296 /**
       
   297  * @return - TVerdict code
       
   298  * Override of base class virtual
       
   299  */
       
   300 	{
       
   301 	INFO_PRINTF1(_L("Completed Primary Filter test"));
       
   302 	return TestStepResult();
       
   303 	}
       
   304 
       
   305 
       
   306 
       
   307 /*******************************************************************************/
       
   308 /*********************************Secondary Filter Test***************************/
       
   309 /*******************************************************************************/
       
   310 
       
   311 
       
   312 CULoggerAPISecondTestStep::~CULoggerAPISecondTestStep()
       
   313 /**
       
   314  * Destructor
       
   315  */
       
   316 	{
       
   317 	}
       
   318 
       
   319 CULoggerAPISecondTestStep::CULoggerAPISecondTestStep()
       
   320 /**
       
   321  * Constructor
       
   322  */
       
   323 	{
       
   324 	SetTestStepName(KULoggerAPISecondTestStep);
       
   325 	}
       
   326 
       
   327 TVerdict CULoggerAPISecondTestStep::doTestStepPreambleL()
       
   328 /** * @return - TVerdict code
       
   329  * Override of base class virtual
       
   330  */
       
   331 	{
       
   332 	INFO_PRINTF1(_L("Testing ULogger API/uloggerclient.h setting Secondary filter functionality, for negative testing edit source"));
       
   333 	SetTestStepResult(EPass);
       
   334 	return TestStepResult();
       
   335 	}
       
   336 
       
   337 
       
   338 TVerdict CULoggerAPISecondTestStep::doTestStepL()
       
   339 /**
       
   340  * @return - TVerdict code
       
   341  * Override of base class pure virtual
       
   342  * Our implementation only logger.GetS called if the base class doTestStepPreambleL() did
       
   343  * not leave. That being the case, the current test Result value will be EPass.
       
   344  */
       
   345 	{
       
   346 	  if (TestStepResult()==EPass)
       
   347 		{
       
   348 		//  ************** Delete the Block, the block start ****************
       
   349 
       
   350 			TInt Result=0;
       
   351 			RULogger logger;
       
   352 			RArray<TUint32> setfilter;
       
   353 			setfilter.Append((TUint32) UTraceSecondary);
       
   354 			RArray<TUint32> dupfilter;
       
   355 			RArray<TUint32> getfilter;				
       
   356 			RArray<TUint32> removefilter;
       
   357 			removefilter.Append(setfilter[0]);
       
   358 		//	removefilter=32; //uncomment to negative test the remove filter option		
       
   359 
       
   360 			/**************First set Secondary filter*************/		
       
   361 
       
   362 			logger.Connect();
       
   363 			CClearConfig configIni;
       
   364 			configIni.Clear(logger);
       
   365 			Result = logger.SetSecondaryFiltersEnabled(setfilter,ETrue);
       
   366 			INFO_PRINTF2(_L("Secondary filter has been set with single filter, %d, check log"), setfilter[0]);
       
   367 			INFO_PRINTF2(_L("code: %d"), Result);
       
   368 			
       
   369 	
       
   370 			/**************Now get the Secondary filter set above************/	
       
   371 
       
   372 			Result = logger.GetSecondaryFiltersEnabled(getfilter);	
       
   373 			INFO_PRINTF1(_L("Get Secondary filter returns the following filters"));
       
   374 			INFO_PRINTF2(_L("code: %d"), Result);
       
   375 			for(TInt i=0;i!=getfilter.Count();i++)
       
   376 			{
       
   377 				INFO_PRINTF2(_L("%d "),getfilter[i]);
       
   378 			}
       
   379 			if(getfilter[0]==setfilter[0])
       
   380 			{
       
   381 				Result=0;
       
   382 				INFO_PRINTF1(_L("Get Secondary filter successful"));	
       
   383 			}
       
   384 			else
       
   385 			{
       
   386 				INFO_PRINTF1(_L("Get Secondary filter failed"));
       
   387 				Result=1;
       
   388 			}
       
   389 			for(TInt i=0;i!=getfilter.Count();)//i++)
       
   390 			{
       
   391 				getfilter.Remove(0);
       
   392 			}		
       
   393 
       
   394 			/*****************Now remove the above set filter***************/	
       
   395 
       
   396 			if(Result==0)
       
   397 			{
       
   398 				Result=logger.SetSecondaryFiltersEnabled(removefilter, EFalse);
       
   399 				INFO_PRINTF2(_L("Remove Secondary filters single filter, 0 if succesful, -1 if failed: %d"), Result);//logger.RemoveSingleSecondary);
       
   400 				logger.GetSecondaryFiltersEnabled(getfilter);
       
   401 				if(getfilter.Count()==0)
       
   402 				{
       
   403 					INFO_PRINTF1(_L("Remove Secondary filter successful"));
       
   404 					Result=0;
       
   405 				}
       
   406 				else
       
   407 				{
       
   408 					if(Result!=0)
       
   409 						INFO_PRINTF1(_L("Remove Secondary filter failed, as filter has not been set in the config file"));
       
   410 					else
       
   411 						INFO_PRINTF1(_L("Remove Secondary filter failed, as able to pass same filter option to RemoveSecondaryFilter"));
       
   412 					Result=1;
       
   413 				}
       
   414 			}
       
   415 			
       
   416 			/****Now if the above steps have passed proceed to testing multiple filters***/		
       
   417 
       
   418 			if(Result==1)
       
   419 				SetTestStepResult(EFail);
       
   420 			else
       
   421 			{
       
   422 				RArray<TUint32> setfilters;
       
   423 				RArray<TUint32> getfilters;
       
   424 				INFO_PRINTF2(_L("maxsecondary %d"),MaxNumberOfSecondaryFilters);
       
   425 				for(TInt i=0;i<MaxNumberOfSecondaryFilters;i++)
       
   426 				{
       
   427 					setfilters.Append((TUint32)(i));
       
   428 				}	
       
   429 				INFO_PRINTF1(_L("initialising values for multiple secondary filters ok, now set the filters etc"));
       
   430 		
       
   431 				/**************First set  multiple Secondary filter*************/		
       
   432 
       
   433 				Result=logger.SetSecondaryFiltersEnabled(setfilters,ETrue);
       
   434 				if(Result==KErrNone)
       
   435 				INFO_PRINTF2(_L("Secondary filter has been set with multiple filters,from 0 to %d"), MaxNumberOfSecondaryFilters);
       
   436 				else
       
   437 					INFO_PRINTF2(_L("Multiple secondary filters have not been set succesfully, error code %d"), Result);
       
   438 			
       
   439 				/**************Now get the Secondary filter set above************/
       
   440 			
       
   441 				INFO_PRINTF2(_L("before get, getfilter has %d"), getfilters.Count());
       
   442 				logger.GetSecondaryFiltersEnabled(getfilters);
       
   443 				if(getfilters.Count()==setfilters.Count())
       
   444 				{
       
   445 					INFO_PRINTF1(_L("setfilter and getfilter have the same count"));
       
   446 					INFO_PRINTF2(_L("setfilter has %d"), setfilters.Count());
       
   447 					INFO_PRINTF2(_L("getfilter has %d"), getfilters.Count());
       
   448 				}
       
   449 				else
       
   450 				{
       
   451 					INFO_PRINTF1(_L("setfilter and getfilter have different counts"));
       
   452 					Result=1;
       
   453 						INFO_PRINTF2(_L("setfilter has %d"), setfilters.Count());
       
   454 						INFO_PRINTF2(_L("getfilter has %d"), getfilters.Count());
       
   455 				}
       
   456 				for(TInt i=0;i!=getfilters.Count() && Result==0;i++)
       
   457 				{
       
   458 					for(TInt j=0;j!=getfilters.Count() && Result!=0;j++)
       
   459 					{
       
   460 						if(getfilters[i]==setfilters[j])
       
   461 							Result=0;
       
   462 						else
       
   463 							Result=1;
       
   464 					}
       
   465 				}
       
   466 				if(Result==0)
       
   467 					INFO_PRINTF1(_L("Get multiple Secondary filters successful"));
       
   468 				else
       
   469 					INFO_PRINTF1(_L("Get multiple Secondary filters failed"));
       
   470 				INFO_PRINTF1(_L("Get Secondary filters returns multiple filters"));
       
   471 			//	for(int i=0;i!=getfilters.Count();i++)//MaxNumberOfSecondaryFilters;i++)
       
   472 			//		INFO_PRINTF2(_L(" %d"), getfilters[i]);	//uncomment to verify get filters test correct - WARNING-loadsa data if use true maximum for secondary filters-will break TEF!!
       
   473 				for(TInt i=0;i<getfilters.Count();)//i++)
       
   474 				{
       
   475 					getfilters.Remove(0);
       
   476 				}
       
   477 			
       
   478 				/*****************Given this is successful, now remove the above set filter***************/
       
   479 		
       
   480 				if(Result==0)
       
   481 				{
       
   482 					logger.SetSecondaryFiltersEnabled(removefilter, EFalse);
       
   483 				//	getfilter.Append(removefilter);
       
   484 				//	logger.SetSecondaryFilter(getfilter);//uncomment these to negative test the test suite
       
   485 					logger.GetSecondaryFiltersEnabled(getfilters);
       
   486 					for(TInt i=0; i!=getfilters.Count() && Result==0;i++)
       
   487 					{
       
   488 						if(getfilters[i]==removefilter[0])
       
   489 						{
       
   490 							INFO_PRINTF1(_L("Remove Secondary filter in multiple test failed"));
       
   491 							Result=1;
       
   492 						}
       
   493 						else
       
   494 							Result=0;
       
   495 					}
       
   496 					if(Result==0)
       
   497 						INFO_PRINTF1(_L("Remove Secondary filter in multiple test successful"));
       
   498 					else
       
   499 					INFO_PRINTF1(_L("Remove Secondary filter in multiple test failed"));
       
   500 				}
       
   501 				INFO_PRINTF1(_L("Now, given that the above tests have passed, negative test the secondary filter options"));
       
   502 				INFO_PRINTF1(_L("First reset the removed filter, then proceed"));
       
   503 				setfilter[0]=removefilter[0];
       
   504 				logger.SetSecondaryFiltersEnabled(setfilter,ETrue);
       
   505 				if(Result==0)
       
   506 				{
       
   507 					INFO_PRINTF1(_L("Removed filter has been reset"));
       
   508 				
       
   509 					/************Now try to set a secondary filter value greater than that allowed***/
       
   510 			
       
   511 					setfilter[0]=((TSecondaryFilter)(MaxNumberOfSecondaryFilters-1));
       
   512 					INFO_PRINTF2(_L("setfilter is %d"), setfilter[0]);
       
   513 					TInt r= logger.SetSecondaryFiltersEnabled(setfilter,ETrue);
       
   514 					if((r==KErrNone)&&(setfilter[0]==MaxNumberOfSecondaryFilters-1))
       
   515 					{
       
   516 						INFO_PRINTF3(_L("Secondary filter has been set with filter %d,corresponding to the passed value %d, this is allowed as is duplicate. Passed"), setfilter[0],MaxNumberOfSecondaryFilters-1 );
       
   517 						Result=0;
       
   518 					}
       
   519 					if((r==KErrNone)&&(setfilter[0]!=MaxNumberOfSecondaryFilters-1))
       
   520 					{
       
   521 						INFO_PRINTF3(_L("Secondary filter has been set with filter %d,corresponding to the passed value %d, this is not allowed. Failed"), setfilter[0],MaxNumberOfSecondaryFilters-1 );
       
   522 						Result=1;
       
   523 					}
       
   524 					else
       
   525 					
       
   526 					{
       
   527 						INFO_PRINTF3(_L("Secondary filter has not been set with filter %d, corresponding to the passed value %d , this is as expected as otherwise duplicate. Passed"), setfilter[0], MaxNumberOfSecondaryFilters-1);
       
   528 						Result=0;
       
   529 					}
       
   530 					/************Now try to set more secodndary filter values greater than available***/
       
   531 					
       
   532 					INFO_PRINTF1(_L("Now try to set more filter than available"));
       
   533 					if(Result==0)
       
   534 					{
       
   535 						setfilter[0]=((TSecondaryFilter)(MaxNumberOfSecondaryFilters+3));
       
   536 						Result=logger.SetSecondaryFiltersEnabled(setfilter,ETrue);
       
   537 						if(Result==KErrNone)
       
   538 						{
       
   539 							INFO_PRINTF1(_L("More secondary filters than available can be set. Failed"));
       
   540 							Result=1;
       
   541 						}
       
   542 						else
       
   543 						{
       
   544 							INFO_PRINTF1(_L("More secondary filters than available cannot be set. Passed"));
       
   545 							Result=0;
       
   546 						}
       
   547 					}		
       
   548 				}
       
   549 				INFO_PRINTF1(_L("Now call clear config to check removing multiple second filters performance"));
       
   550 				configIni.Clear(logger);
       
   551 				INFO_PRINTF1(_L("after clear config- multiple second filters performance"));
       
   552 		
       
   553 				if(Result==1)
       
   554 					SetTestStepResult(EFail);
       
   555 				else
       
   556 					SetTestStepResult(EPass);		
       
   557 			}
       
   558 			logger.Close();
       
   559 			//  **************   Block end ****************
       
   560 		}
       
   561 	  return TestStepResult();
       
   562 	}
       
   563 
       
   564 
       
   565 
       
   566 TVerdict CULoggerAPISecondTestStep::doTestStepPostambleL()
       
   567 /**
       
   568  * @return - TVerdict code
       
   569  * Override of base class virtual
       
   570  */
       
   571 	{
       
   572 	INFO_PRINTF1(_L("Completed Secondary Filter test"));
       
   573 	return TestStepResult();
       
   574 	}
       
   575 
       
   576 
       
   577 /*******************************************************************************/
       
   578 /*********************************Logging Start/Stop Test***********************/
       
   579 /*******************************************************************************/
       
   580 
       
   581 CULoggerAPILoggingTestStep::~CULoggerAPILoggingTestStep()
       
   582 /**
       
   583  * Destructor
       
   584  */
       
   585 	{
       
   586 	}
       
   587 
       
   588 CULoggerAPILoggingTestStep::CULoggerAPILoggingTestStep()
       
   589 /**
       
   590  * Constructor
       
   591  */
       
   592 	{
       
   593 	// **MUST** call SetTestStepName in the constructor as the controlling
       
   594 	// framework uses the test step name immediately following construction to set
       
   595 	// up the step's unique logging ID.
       
   596 	SetTestStepName(KULoggerAPILoggingTestStep);
       
   597 	}
       
   598 
       
   599 TVerdict CULoggerAPILoggingTestStep::doTestStepPreambleL()
       
   600 /**
       
   601  * @return - TVerdict code
       
   602  * Override of base class virtual
       
   603  */
       
   604 	{
       
   605 	INFO_PRINTF1(_L("Testing ULogger API/uloggerclient.h logging with user side tracing functionality"));
       
   606  
       
   607  	if(NumberOfUTraceMacros!=18)
       
   608 		{
       
   609 			INFO_PRINTF1(_L("WARNING! Number of available UTrace Macros is not the same as accounted for in calls to UTrace!! Update ULoggerAPITest.cpp, (logging test step) accordingly!"));	
       
   610 			SetTestStepResult(EFail);
       
   611 		}
       
   612 	else	
       
   613 		SetTestStepResult(EPass);
       
   614 	return TestStepResult();
       
   615 	}
       
   616 
       
   617 
       
   618 TVerdict CULoggerAPILoggingTestStep::doTestStepL()
       
   619 /**
       
   620  * @return - TVerdict code
       
   621  * Override of base class pure virtual
       
   622  * Our implementation only logger.GetS called if the base class doTestStepPreambleL() did
       
   623  * not leave. That being the case, the current test Result value will be EPass.
       
   624  */
       
   625 	{
       
   626 	
       
   627 	  if (TestStepResult()==EPass)
       
   628 		{
       
   629 		//  ************** Delete the Block, the block start ****************
       
   630 
       
   631 			INFO_PRINTF1(_L("About to test ulogger start with one primary and one secondary"));  //Block start
       
   632 			TInt Result=0;
       
   633 			RULogger logger;
       
   634 			logger.Connect();
       
   635 #ifdef SysStartTest
       
   636 			TInt SysStartResult=logger.Start();
       
   637 			if(SysStartResult!=KErrInUse)
       
   638 				INFO_PRINTF2(_L("Logger start returning incorrect error code of %d when already started by SysStart, should be KErrInUse (-14)"), SysStartResult);
       
   639 			logger.Stop();
       
   640 #endif	
       
   641 #ifndef SysStartTest
       
   642 			CClearConfig configIni;
       
   643 			configIni.Clear(logger);
       
   644 #endif
       
   645 			CArrayFixFlat<TUint8> *setprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
   646 			setprimfilter->AppendL(UTracePrimary);
       
   647 			RArray<TUint32> setsecondfilter;
       
   648 			setsecondfilter.Append((TUint32) UTraceSecondary);
       
   649 			logger.SetPrimaryFiltersEnabled(*setprimfilter,ETrue);
       
   650 			logger.SetSecondaryFiltersEnabled(setsecondfilter,ETrue);
       
   651 			INFO_PRINTF1(_L("about to set file as output plugin"));
       
   652 			//NB: this of course assumes that the plugin functionality works which is tested more rigorously in the plugin test step
       
   653 #ifndef SysStartTest
       
   654 		
       
   655 			if(Result==0)	
       
   656 			{
       
   657 				INFO_PRINTF1(_L("file set as output plugin ok"));
       
   658 				_LIT8(KTextmedia,"uloggerfileplugin");
       
   659 				TPtrC8 mediaptr(KTextmedia);
       
   660 				Result=logger.ActivateOutputPlugin(mediaptr);
       
   661 				INFO_PRINTF1(_L("file set as active output plugin ok"));
       
   662 				_LIT(KTextsetting, "output_path");
       
   663 				_LIT(KTextvalue, "C:\\logs\\ULoggerLoggingTest.log");
       
   664 				TPluginConfiguration pluginConfig;
       
   665 				pluginConfig.SetKey(KTextsetting);
       
   666 				pluginConfig.SetValue(KTextvalue);
       
   667 				Result=logger.SetPluginConfigurations(mediaptr, pluginConfig);
       
   668 				if(Result==0)
       
   669 					INFO_PRINTF1(_L("output plugin settings set ok"));
       
   670 				else
       
   671 					INFO_PRINTF2(_L("setting output plugin settings failed with err %d"), Result);
       
   672 			}
       
   673 			else
       
   674 				INFO_PRINTF2(_L("add file as output plugin failed with err %d"), Result);
       
   675 #endif		
       
   676 			if(Result==0)
       
   677 			{
       
   678 			/************** Start Logging to File****************/
       
   679 
       
   680 			Result=logger.Start();
       
   681 			INFO_PRINTF2(_L("ulogger start returns error %d"), Result);
       
   682 			INFO_PRINTF1(_L("now step over some UTrace statements"));
       
   683 			int tracetag =0;
       
   684 			TBool ret=1;
       
   685 			CUTraces Testtracer;
       
   686 			INFO_PRINTF1(_L("******Testing NONSTATIC Trace Object Methods******"));
       
   687 			/*Comment out this line to switch off tracing as a negative test*/
       
   688 			for(tracetag=0; tracetag!=NumberOfUTraceMacros&&ret;tracetag++)
       
   689 			{
       
   690 					ret = 0;
       
   691 					ret = Testtracer.DoTheTrace(tracetag);
       
   692 					INFO_PRINTF3(_L("UTrace macro %d has trace size %d"), tracetag, Testtracer.SizeOfTrace(tracetag));
       
   693 			}
       
   694 			bool UTraceStatus=0;	
       
   695 #ifdef SYMBIAN_TRACE_ENABLE 
       
   696 	UTraceStatus = 1;
       
   697 		INFO_PRINTF1(_L("UTRACING HAS BEEN ENABLED!"));
       
   698 #else
       
   699 		UTraceStatus = 0;
       
   700 		INFO_PRINTF1(_L("UTRACING HAS BEEN DISABLED! All Log files should be empty/not exist"));
       
   701 #endif
       
   702 			if((ret&&UTraceStatus)||(!ret&&!UTraceStatus))
       
   703 			{
       
   704 				Result=0;
       
   705 				INFO_PRINTF1(_L("UTracing carried out succesfully"));
       
   706 				if(ret==1) 
       
   707 					INFO_PRINTF1(_L("logfile should contain appropriate tracing"));
       
   708 				else
       
   709 					INFO_PRINTF1(_L("logfile should be empty of trace statements"));
       
   710 			}
       
   711 			else
       
   712 			{
       
   713 				Result=1;
       
   714 				INFO_PRINTF2(_L("UTracing Failed on UTrace macro %d"), tracetag);
       
   715 			}
       
   716 			
       
   717 			/*************Now test the set method************************/
       
   718 			
       
   719 			INFO_PRINTF1(_L("******Testing NONSTATIC Trace Set Methods******"));
       
   720 			TUTrace TestTraceObject(UTracePrimary, UTraceSecondary, schema, context, pc);
       
   721 			for(tracetag=0; tracetag!=NumberOfUTraceMacros&&ret;tracetag++)
       
   722 			{
       
   723 				ret = 0;
       
   724 				ret = Testtracer.DoTheSetTrace(tracetag, TestTraceObject);
       
   725 				INFO_PRINTF3(_L("UTrace set macro %d has trace size %d"), tracetag, Testtracer.SizeOfTrace(tracetag));
       
   726 			}
       
   727 			if((ret&&UTraceStatus)||(!ret&&!UTraceStatus))
       
   728 			{
       
   729 				Result=0;
       
   730 				INFO_PRINTF1(_L("UTracing carried out succesfully for set method"));
       
   731 				if(ret==1) 
       
   732 					INFO_PRINTF1(_L("logfile should contain appropriate tracing"));
       
   733 				else
       
   734 					INFO_PRINTF1(_L("logfile should be empty of trace statements"));
       
   735 			}
       
   736 		
       
   737 			else
       
   738 			{
       
   739 				Result=1;
       
   740 				INFO_PRINTF2(_L("UTracing Failed on UTrace macro %d for set method "), tracetag);
       
   741 			}
       
   742 			
       
   743 				/*************Now test the static method************************/
       
   744 				
       
   745 			INFO_PRINTF1(_L("******Testing STATIC Trace Methods******"));
       
   746 
       
   747 			
       
   748 			for(tracetag=0; tracetag!=NumberOfUTraceMacros&&ret;tracetag++)
       
   749 			{
       
   750 					ret = 0;
       
   751 					ret = Testtracer.DoTheStaticTrace(tracetag);
       
   752 					INFO_PRINTF3(_L("UTrace static macro %d has trace size %d"), tracetag, Testtracer.SizeOfTrace(tracetag));
       
   753 			}
       
   754 			if((ret&&UTraceStatus)||(!ret&&!UTraceStatus))
       
   755 			{
       
   756 				Result=0;
       
   757 				INFO_PRINTF1(_L("UTracing carried out succesfully for static method"));
       
   758 				if(ret==1) 
       
   759 					INFO_PRINTF1(_L("logfile should contain appropriate tracing"));
       
   760 				else
       
   761 					INFO_PRINTF1(_L("logfile should be empty of trace statements"));
       
   762 
       
   763 			}
       
   764 			
       
   765 		
       
   766 			else
       
   767 			{
       
   768 				Result=1;
       
   769 				INFO_PRINTF2(_L("UTracing Failed on UTrace macro  %d for static method"), tracetag);
       
   770 			}
       
   771 			
       
   772 			/************** Stop Logging to File****************/
       
   773 
       
   774 			Result=logger.Stop();
       
   775 			if(Result==0)
       
   776 			{
       
   777 				ret = Testtracer.DoTheTrace(0);
       
   778 				INFO_PRINTF1(_L("logfile should contain appropriate tracing without an extra UTrace(0) trace at the end, if it is present ULogger.Stop() has failed in functionality"));
       
   779 			}
       
   780 			else
       
   781 			{
       
   782 				INFO_PRINTF2(_L("Call to Ulogger.Stop() has failed with err %d"), Result);
       
   783 			}
       
   784 		}
       
   785 		else
       
   786 			INFO_PRINTF1(_L("adding file as output plugin failed"));
       
   787 		if(Result==0)
       
   788 				SetTestStepResult(EPass);
       
   789 		else
       
   790 				SetTestStepResult(EFail);
       
   791 		INFO_PRINTF1(_L("Simple logging to file has been tested - check output log"));
       
   792 	
       
   793 		/***************************negative test***********************/
       
   794 
       
   795 		if(TestStepResult()==EPass)	
       
   796 		{
       
   797 			INFO_PRINTF1(_L("Now do some negative logging testing."));
       
   798 			if(Result==KErrNone)
       
   799 			{
       
   800 				INFO_PRINTF1(_L("file set as output plugin ok"));
       
   801 				_LIT8(KTextmedia,"uloggerfileplugin");
       
   802 				TPtrC8 mediaptr(KTextmedia);
       
   803 				if(Result==0)
       
   804 				{	INFO_PRINTF1(_L("file set as active output plugin ok"));
       
   805 					_LIT(KTextsetting, "output_path");
       
   806 					_LIT(KnegTextvalue, "C:\\logs\\ULoggerNegativeLoggingTest.log");
       
   807 					TPluginConfiguration negPluginConfig;
       
   808 					negPluginConfig.SetKey(KTextsetting);
       
   809 					negPluginConfig.SetValue(KnegTextvalue);
       
   810 					Result=logger.SetPluginConfigurations(mediaptr, negPluginConfig);
       
   811 					if(Result==0)
       
   812 						INFO_PRINTF1(_L("output plugin settings set ok"));
       
   813 					else
       
   814 						INFO_PRINTF1(_L("setting output plugin settings failed"));	
       
   815 				}
       
   816 				else
       
   817 					INFO_PRINTF1(_L("file not set as active output plugin - failed"));
       
   818 				INFO_PRINTF1(_L("Log over traces with different filters set - there should only be one line in logfile corrseponding to the set filters."));
       
   819 				if(Result==0)
       
   820 				{
       
   821 					logger.Start();
       
   822 
       
   823 					/*****do the tracing**************/
       
   824 
       
   825 					bool ret = TUTrace::Trace(UTracePrimary, UTraceSecondary, schema, context, pc);
       
   826 					INFO_PRINTF2(_L("tracing ret %d"), ret);
       
   827 					ret = TUTrace::Trace((TPrimaryFilter)(UTracePrimary+1),(TSecondaryFilter)(UTraceSecondary+1), schema, context, pc);
       
   828 					INFO_PRINTF2(_L("tracing ret %d"), ret);
       
   829 	
       
   830 					/************** Stop Logging to File****************/
       
   831 
       
   832 					Result=logger.Stop();
       
   833 					if(Result!=0)
       
   834 					{
       
   835 					INFO_PRINTF2(_L("Call to Ulogger.Stop() has failed with err %d"), Result);
       
   836 					}					
       
   837 					INFO_PRINTF1(_L("Set some more filters and remove the original set in ulogger, then trace over the original types of traces - there should be no extra lines in logfile above"));
       
   838 					
       
   839 					/**************Now Change the filter settings********/
       
   840 					CArrayFixFlat<TUint8> *removeprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
   841 					removeprimfilter->AppendL(setprimfilter->At(0));
       
   842 					RArray<TUint32> removesecondfilter;
       
   843 					removesecondfilter.Append(setsecondfilter[0]);
       
   844 					Result=logger.SetPrimaryFiltersEnabled(*removeprimfilter, EFalse);
       
   845 					if(Result==0)
       
   846 					{
       
   847 						INFO_PRINTF1(_L("Call to removeprimary has passed"));
       
   848 					}
       
   849 					Result=logger.SetSecondaryFiltersEnabled(removesecondfilter, EFalse);
       
   850 					if(Result==0)
       
   851 					{
       
   852 						INFO_PRINTF1(_L("Call to removesecondary has passed"));
       
   853 					}
       
   854 					CArrayFixFlat<TUint8> *newsetprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
   855 					newsetprimfilter->AppendL((TUint8)(UTracePrimary+2));
       
   856 					RArray<TUint32> newsetsecondfilter;
       
   857 					newsetsecondfilter.Append((TUint32) (UTraceSecondary+2));
       
   858 					logger.SetPrimaryFiltersEnabled(*newsetprimfilter,ETrue);
       
   859 					logger.SetSecondaryFiltersEnabled(newsetsecondfilter,ETrue);
       
   860 					CUTraces Testtracer;
       
   861 					ret=1;	
       
   862 					logger.Start();
       
   863 					
       
   864 					/*****do the tracing**************/
       
   865 
       
   866 					/*Comment out this line to switch off tracing as a negative test*/
       
   867 					int tracetag=0;
       
   868 					for(tracetag=0; tracetag!=NumberOfUTraceMacros&&ret;tracetag++)
       
   869 					{
       
   870 						ret = 0;
       
   871 						ret = Testtracer.DoTheTrace(tracetag);
       
   872 						INFO_PRINTF3(_L("UTrace macro %d has trace size %d"), tracetag, Testtracer.SizeOfTrace(tracetag));
       
   873 					}
       
   874 					if(ret==1)
       
   875 					{
       
   876 						SetTestStepResult(EFail);
       
   877 						INFO_PRINTF1(_L("BTrace filters are not being reset with Start()/stop(), so logging over filters that have been unset is occuring. Fail"));
       
   878 					}
       
   879 				
       
   880 					ret = TUTrace::Trace((TPrimaryFilter)(UTracePrimary+2),(TSecondaryFilter)(UTraceSecondary+2), schema, context, pc);
       
   881 					INFO_PRINTF2(_L("tracing ret %d"), ret);
       
   882 										
       
   883 					/************** Stop Logging to File****************/
       
   884 
       
   885 					Result=logger.Stop();
       
   886 					if(Result!=0)
       
   887 					{
       
   888 					INFO_PRINTF2(_L("Call to Ulogger.Stop() has failed with err %d"), Result);
       
   889 					}
       
   890 					if(newsetprimfilter)
       
   891 					{
       
   892 						delete(newsetprimfilter);
       
   893 						newsetprimfilter=NULL;
       
   894 					}
       
   895 				}
       
   896 			}
       
   897 			else
       
   898 				INFO_PRINTF1(_L("Incorrect error code when trying to add file as a plug-in when it already exists"));
       
   899 			if(Result==0&&TestStepResult()==EPass)
       
   900 					SetTestStepResult(EPass);
       
   901 			else
       
   902 					SetTestStepResult(EFail);
       
   903 			INFO_PRINTF1(_L("Simple negative logging to file has been tested - check output log"));
       
   904 		}
       
   905 	
       
   906 		/***************************multiple type test***********************/
       
   907    		 // From negative test: primary has been set to UTracePrimary+2 and secondary to UTraceSecondary+2
       
   908 		if(TestStepResult()==EPass)	
       
   909 		{	
       
   910 			INFO_PRINTF1(_L("Now do some multiple type logging testing."));
       
   911 			//CClearConfig configIni;
       
   912 			//configIni.Clear(logger);
       
   913 		
       
   914 			if(Result==0)
       
   915 			{
       
   916 				INFO_PRINTF1(_L("file set as output plugin ok"));
       
   917 				_LIT8(KTextmedia,"uloggerfileplugin");
       
   918 				TPtrC8 mediaptr(KTextmedia);
       
   919 				if(Result==0)
       
   920 				{	INFO_PRINTF1(_L("file set as active output plugin ok"));
       
   921 					_LIT(KTextsetting, "output_path");
       
   922 					_LIT(KmultTextvalue, "C:\\logs\\ULoggerMultipleLoggingTest.log");
       
   923 					TPluginConfiguration pluginConfig;
       
   924 					pluginConfig.SetKey(KTextsetting);
       
   925 					pluginConfig.SetValue(KmultTextvalue);				
       
   926 					Result=logger.SetPluginConfigurations(mediaptr, pluginConfig);
       
   927 					if(Result==0)
       
   928 						INFO_PRINTF1(_L("output plugin settings set ok"));
       
   929 					else
       
   930 						INFO_PRINTF1(_L("setting output plugin settings failed"));	
       
   931 				}
       
   932 				else
       
   933 					INFO_PRINTF1(_L("file not set as active output plugin - failed"));
       
   934 				if(Result==0)
       
   935 				{
       
   936 					TInt i;
       
   937 					CArrayFixFlat<TUint8> *multsetprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
   938 					multsetprimfilter->AppendL(UTracePrimary);
       
   939 					RArray<TUint32> multsetsecondfilter;
       
   940 					multsetsecondfilter.Append((TUint32) (UTraceSecondary));
       
   941 					logger.SetPrimaryFiltersEnabled(*multsetprimfilter,ETrue);
       
   942 					TInt errCode = logger.SetSecondaryFiltersEnabled(multsetsecondfilter,ETrue);			
       
   943 					
       
   944 					if(errCode != KErrNone)
       
   945 						INFO_PRINTF2(_L("Setting secondary filters failed: %d"), errCode);
       
   946 					INFO_PRINTF1(_L("checking !!! secondary filters"));
       
   947 					for(i=0; i<multsetsecondfilter.Count(); ++i)
       
   948 						{
       
   949 						TBuf<16> buf;
       
   950 						buf.AppendFormat(_L("%d"), multsetsecondfilter[i]);
       
   951 						INFO_PRINTF1(buf);
       
   952 						}
       
   953 					
       
   954 					INFO_PRINTF1(_L("Now given the two sets of set filters, step over traces of each type, some with matching primary but not secondary and vice versa"));
       
   955 						
       
   956 					INFO_PRINTF1(_L("Primary Filetrs:"));
       
   957 					CArrayFixFlat<TUint8>* primFilters = new (ELeave) CArrayFixFlat<TUint8>(1);
       
   958 					CleanupStack::PushL(primFilters);
       
   959 					logger.GetPrimaryFiltersEnabled(*primFilters);
       
   960 					
       
   961 					for(i=0; i<primFilters->Count(); ++i)
       
   962 						{
       
   963 						TBuf<16> buf;
       
   964 						buf.AppendFormat(_L("%d "), primFilters->At(i));
       
   965 						INFO_PRINTF1(buf);
       
   966 						}
       
   967 					CleanupStack::PopAndDestroy(); //primFiletrs
       
   968 					
       
   969 					INFO_PRINTF1(_L("Secondary Filetrs:"));
       
   970 					RArray<TUint32> secFilters;
       
   971 					errCode = logger.GetSecondaryFiltersEnabled(secFilters);
       
   972 					if(errCode != KErrNone)
       
   973 						INFO_PRINTF2(_L("Getting secondary filters failed: %d"), errCode);
       
   974 					
       
   975 					for(i=0; i<secFilters.Count(); ++i)
       
   976 						{
       
   977 						TBuf<16> buf;
       
   978 						buf.AppendFormat(_L("%d"), secFilters[i]);
       
   979 						INFO_PRINTF1(buf);
       
   980 						}
       
   981 					secFilters.Close();
       
   982 					
       
   983 					INFO_PRINTF1(_L("Secondary Filetring is:"));
       
   984 					TBool secF = EFalse;
       
   985 					logger.GetSecondaryFilteringEnabled(secF);
       
   986 					if(secF)
       
   987 						INFO_PRINTF1(_L("ENABLED"));
       
   988 					else
       
   989 						INFO_PRINTF1(_L("DISABLED"));
       
   990 						
       
   991 					Result=logger.Start();
       
   992 					if(Result!=KErrNone)
       
   993 						INFO_PRINTF2(_L("ulogger server didn't start, with error %d"), Result);
       
   994 					
       
   995 					/*****do the tracing**************/
       
   996 			
       
   997 					bool ret = TUTrace::Trace(UTracePrimary,UTraceSecondary, schema, context, pc);
       
   998 					if(ret==0)
       
   999 					{
       
  1000 						SetTestStepResult(EFail);
       
  1001 						INFO_PRINTF1(_L("logging over filters that have been set (both sec and prim) is not occuring. Fail"));
       
  1002 					}
       
  1003 					ret = TUTrace::Trace((TPrimaryFilter)(UTracePrimary+1),(TSecondaryFilter)(UTraceSecondary+1), schema, context, pc);
       
  1004 					if(ret==1)
       
  1005 					{
       
  1006 						SetTestStepResult(EFail);
       
  1007 						INFO_PRINTF1(_L("logging over filters that have not been set is occuring. Fail"));
       
  1008 					}
       
  1009 					ret = TUTrace::Trace((TPrimaryFilter)(UTracePrimary),(TSecondaryFilter)(UTraceSecondary+2), schema, context, pc);
       
  1010 					if(ret==0)
       
  1011 					{
       
  1012 						SetTestStepResult(EFail);
       
  1013 						INFO_PRINTF1(_L("logging over filters that have been set (both sec+2 and prim) is not occuring. Fail"));
       
  1014 					}
       
  1015 					ret = TUTrace::Trace((TPrimaryFilter)(UTracePrimary+2),(TSecondaryFilter)(UTraceSecondary), schema, context, pc);
       
  1016 					if(ret==0)
       
  1017 					{
       
  1018 						SetTestStepResult(EFail);
       
  1019 						INFO_PRINTF1(_L("logging over filters that have been set (both sec and prim+2) is not occuring. Fail"));
       
  1020 					}
       
  1021 					ret = TUTrace::Trace((TPrimaryFilter)(UTracePrimary+2),(TSecondaryFilter)(UTraceSecondary+2), schema, context, pc);
       
  1022 					if(ret==0)
       
  1023 					{
       
  1024 						SetTestStepResult(EFail);
       
  1025 						INFO_PRINTF1(_L("logging over filters that have been set (both sec+2 and prim+2) is not occuring. Fail"));
       
  1026 					}
       
  1027 					
       
  1028 					INFO_PRINTF1(_L("checking UTracePrimary i UTraceSecondary"));
       
  1029 					TBuf<32> b;
       
  1030 					b.AppendFormat(_L("%d and %d"), UTracePrimary+2, UTraceSecondary+1);
       
  1031 					INFO_PRINTF1(b);
       
  1032 					
       
  1033 					ret = TUTrace::Trace((TPrimaryFilter)(UTracePrimary+2),(TSecondaryFilter)(UTraceSecondary+1), schema, context, pc);
       
  1034 					if(ret==1)
       
  1035 					{
       
  1036 						SetTestStepResult(EFail);
       
  1037 						INFO_PRINTF1(_L("logging over filters that have not been set (the sec) is occuring. Fail"));
       
  1038 					}
       
  1039 					ret = TUTrace::Trace((TPrimaryFilter)(UTracePrimary+1),(TSecondaryFilter)(UTraceSecondary), schema, context, pc);
       
  1040 					if(ret==1)
       
  1041 					{
       
  1042 						SetTestStepResult(EFail);
       
  1043 						INFO_PRINTF1(_L("logging over filters that have not been set (the prim) is occuring. Fail"));
       
  1044 					}
       
  1045 					ret = TUTrace::TracePrimary((TPrimaryFilter)(UTracePrimary+1), schema, context, pc);
       
  1046 					if(ret==1)
       
  1047 					{
       
  1048 						SetTestStepResult(EFail);
       
  1049 						INFO_PRINTF1(_L("fast logging over filters that have not been set (the prim) is occuring. Fail"));
       
  1050 					}
       
  1051 				
       
  1052 					/************** Stop Logging to File****************/
       
  1053 
       
  1054 					Result=logger.Stop();
       
  1055 					if(Result!=KErrNone)
       
  1056 					{
       
  1057 						INFO_PRINTF2(_L("Call to Ulogger.Stop() has failed with error %d"), Result);
       
  1058 					}					
       
  1059 					if(multsetprimfilter)
       
  1060 					{
       
  1061 						delete(multsetprimfilter);
       
  1062 						multsetprimfilter=NULL;
       
  1063 					}
       
  1064 				}		
       
  1065 			configIni.Clear(logger);
       
  1066 			}
       
  1067 			else
       
  1068 				INFO_PRINTF1(_L("adding file as output plugin failed"));
       
  1069 			if(Result==0&&TestStepResult()==EPass)
       
  1070 					SetTestStepResult(EPass);
       
  1071 			else
       
  1072 					SetTestStepResult(EFail);
       
  1073 			INFO_PRINTF1(_L("Multiple logging to file with user side tracing has been tested - check output log. It should contain four lines of tracing of type, (sec,prim), (sec+2, prim), (sec, prim+2), (sec+2, prim+2)"));
       
  1074 		}
       
  1075 		if(setprimfilter)
       
  1076 		{
       
  1077 			delete(setprimfilter);
       
  1078 			setprimfilter=NULL;
       
  1079 		}
       
  1080 		INFO_PRINTF1(_L("Now shutdown the ulogger server session"));
       
  1081 	    logger.Close();
       
  1082 #ifdef SysStartTest
       
  1083 		if(SysStartResult!=KErrInUse)
       
  1084 			SetTestStepResult(EFail);
       
  1085 #endif
       
  1086 		//  **************   Block end ****************
       
  1087 		}	
       
  1088 	  return TestStepResult();
       
  1089 	}
       
  1090 	
       
  1091 
       
  1092 
       
  1093 
       
  1094 TVerdict CULoggerAPILoggingTestStep::doTestStepPostambleL()
       
  1095 /**
       
  1096  * @return - TVerdict code
       
  1097  * Override of base class virtual
       
  1098  */
       
  1099 	{
       
  1100 	INFO_PRINTF1(_L("Completed Logging Test Step"));
       
  1101 	return TestStepResult();
       
  1102 	}
       
  1103 	
       
  1104 /*******************************************************************************/
       
  1105 /*********************************Kernel Side Logging Test**********************/
       
  1106 /*******************************************************************************/
       
  1107 
       
  1108 CULoggerAPIKernelTestStep::~CULoggerAPIKernelTestStep()
       
  1109 /**
       
  1110  * Destructor
       
  1111  */
       
  1112 	{
       
  1113 	}
       
  1114 
       
  1115 CULoggerAPIKernelTestStep::CULoggerAPIKernelTestStep()
       
  1116 /**
       
  1117  * Constructor
       
  1118  */
       
  1119 	{
       
  1120 	SetTestStepName(KULoggerAPIKernelTestStep);
       
  1121 	}
       
  1122 
       
  1123 TVerdict CULoggerAPIKernelTestStep::doTestStepPreambleL()
       
  1124 /**
       
  1125  * @return - TVerdict code
       
  1126  * Override of base class virtual
       
  1127  */
       
  1128 	{
       
  1129 	INFO_PRINTF1(_L("Testing ULogger API/uloggerclient.h logging with kernel side tracing functionality"));
       
  1130 	SetTestStepResult(EPass);
       
  1131 	return TestStepResult();
       
  1132 	}
       
  1133 
       
  1134 
       
  1135 TVerdict CULoggerAPIKernelTestStep::doTestStepL()
       
  1136 /**
       
  1137  * @return - TVerdict code
       
  1138  * Override of base class pure virtual
       
  1139  * Our implementation only logger.GetS called if the base class doTestStepPreambleL() did
       
  1140  * not leave. That being the case, the current test Result value will be EPass.
       
  1141  */
       
  1142 	{
       
  1143 #ifndef __WINSCW__
       
  1144 	  if (TestStepResult()==EPass)
       
  1145 		{
       
  1146 		//  ************** Delete the Block, the block start ****************
       
  1147 
       
  1148 			INFO_PRINTF1(_L("About to test ulogger start with one primary and one secondary, kernel side"));  //Block start
       
  1149 			TInt Result=0;
       
  1150 			CUKernelTraces TestKernelTracer;
       
  1151 			RULogger logger;
       
  1152 			logger.Connect();
       
  1153 			CClearConfig configIni;
       
  1154 			configIni.Clear(logger);
       
  1155 			CArrayFixFlat<TUint8> *setprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
  1156 			setprimfilter->AppendL(UTracePrimary);		
       
  1157 			RArray<TUint32> setsecondfilter;
       
  1158 			setsecondfilter.Append((TUint32) UTraceSecondary);
       
  1159 			logger.SetPrimaryFiltersEnabled(*setprimfilter,ETrue);
       
  1160 			logger.SetSecondaryFiltersEnabled(setsecondfilter,ETrue);
       
  1161 			INFO_PRINTF1(_L("about to set file as output plugin"));
       
  1162 			//NB: this of course assumes that the plugin functionality works which is tested more rigorously in the plugin test step
       
  1163 		
       
  1164 			if(Result==0)	
       
  1165 			{
       
  1166 				INFO_PRINTF1(_L("file set as output plugin ok"));
       
  1167 				_LIT8(KTextmedia,"uloggerfileplugin");
       
  1168 				TPtrC8 mediaptr(KTextmedia);
       
  1169 				Result=logger.ActivateOutputPlugin(mediaptr);
       
  1170 				if(Result==0||Result==-11)
       
  1171 				{	INFO_PRINTF1(_L("file set as active output plugin ok"));
       
  1172 					_LIT(KTextsetting, "output_path");
       
  1173 					_LIT(KTextvalue, "C:\\logs\\ULoggerKernelLoggingTest.log");
       
  1174 					TPluginConfiguration setPluginConfigs;
       
  1175 					setPluginConfigs.SetKey(KTextsetting);
       
  1176 					setPluginConfigs.SetValue(KTextvalue);
       
  1177 					Result=logger.SetPluginConfigurations(mediaptr, setPluginConfigs);
       
  1178 					if(Result==0)
       
  1179 						INFO_PRINTF1(_L("output plugin settings set ok"));
       
  1180 					else
       
  1181 						INFO_PRINTF1(_L("setting output plugin settings failed"));
       
  1182 				}
       
  1183 				else
       
  1184 					INFO_PRINTF1(_L("file not set as active output plugin - failed"));
       
  1185 			}
       
  1186 			else
       
  1187 				INFO_PRINTF1(_L("add file as output plugin failed"));
       
  1188 			TInt r = KErrNone;
       
  1189 			r=User::LoadLogicalDevice(_L("eusbc.ldd"));
       
  1190 			if(r == KErrAlreadyExists)
       
  1191 			r = KErrNone;
       
  1192 			RDevUsbcClient usbDevice;
       
  1193 			if(Result==0)
       
  1194 			{
       
  1195 				/************** Start Logging to File****************/
       
  1196 			
       
  1197 				logger.Start();
       
  1198 				INFO_PRINTF1(_L("now step over some UTrace statements"));
       
  1199 				INFO_PRINTF1(_L("Device driver loading............."));
       
  1200 				if (r == KErrNone)
       
  1201 				{
       
  1202 					INFO_PRINTF1(_L("Device driver loaded successfully!!!!!!!!!!!!!!!!!!"));
       
  1203 					r = usbDevice.Open(0);
       
  1204 					INFO_PRINTF2(_L("Device driver opening %d"), r);
       
  1205 					if(r == KErrNone)
       
  1206 					{
       
  1207 						r=TestKernelTracer.DoTheKernelTrace(0, usbDevice);
       
  1208 						if(r==KErrNone)
       
  1209 							INFO_PRINTF2(_L("EndpointZeroRequestError %d"), r);
       
  1210 						else
       
  1211 							INFO_PRINTF2(_L("EndpointZeroRequestError failed %d"), r);
       
  1212 					}
       
  1213 				else
       
  1214 						INFO_PRINTF1(_L("Device driver opening failed"));	
       
  1215 				}
       
  1216 				else
       
  1217 				INFO_PRINTF2(_L("Device Driver didn't load, %d"), r);
       
  1218 #ifdef SYMBIAN_TRACE_ENABLE
       
  1219 		INFO_PRINTF1(_L("UTRACING HAS BEEN ENABLED!"));
       
  1220 #else
       
  1221 		INFO_PRINTF1(_L("UTRACING HAS BEEN DISABLED! All Log files should be empty/not exist"));
       
  1222 #endif
       
  1223 				/************** Stop Logging to File****************/
       
  1224 	
       
  1225 				Result=logger.Stop();
       
  1226 				if(Result!=KErrNone)
       
  1227 					INFO_PRINTF2(_L("Call to Ulogger.Stop() has failed with err %d"), Result);
       
  1228 			}
       
  1229 			else
       
  1230 				INFO_PRINTF1(_L("adding file as output plugin failed"));
       
  1231 			if(Result==0)
       
  1232 					SetTestStepResult(EPass);
       
  1233 			else
       
  1234 					SetTestStepResult(EFail);
       
  1235 			INFO_PRINTF1(_L("Simple logging to file has been tested with kernel side tracing- check output log"));
       
  1236 		
       
  1237 			/***************************negative test***********************/
       
  1238 		
       
  1239 			if(TestStepResult()==EPass)	
       
  1240 			{
       
  1241 				INFO_PRINTF1(_L("Now do some negative logging testing."));
       
  1242 				if(Result==KErrNone)
       
  1243 				{
       
  1244 					INFO_PRINTF1(_L("file set as output plugin ok"));
       
  1245 					_LIT8(KTextmedia,"uloggerfileplugin");
       
  1246 					TPtrC8 mediaptr(KTextmedia);
       
  1247 					if(Result==0)
       
  1248 					{
       
  1249 						INFO_PRINTF1(_L("file set as active output plugin ok"));
       
  1250 						_LIT(KTextsetting, "output_path");
       
  1251 						_LIT(KnegTextvalue, "C:\\logs\\ULoggerKernelNegativeLoggingTest.log");
       
  1252 						TPluginConfiguration negSetPluginConfigs;
       
  1253 						negSetPluginConfigs.SetKey(KTextsetting);
       
  1254 						negSetPluginConfigs.SetValue(KnegTextvalue);
       
  1255 						Result=logger.SetPluginConfigurations(mediaptr, negSetPluginConfigs);
       
  1256 						if(Result==0)
       
  1257 							INFO_PRINTF1(_L("output plugin settings set ok"));
       
  1258 						else
       
  1259 							INFO_PRINTF1(_L("setting output plugin settings failed"));	
       
  1260 					}
       
  1261 					else
       
  1262 						INFO_PRINTF1(_L("file not set as active output plugin - failed"));
       
  1263 				
       
  1264 					/**************Now Change the filter settings********/
       
  1265 				
       
  1266 					CArrayFixFlat<TUint8> *removeprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
  1267 					removeprimfilter->AppendL(setprimfilter->At(0));
       
  1268 					RArray<TUint32> removesecondfilter;
       
  1269 					removesecondfilter.Append(setsecondfilter[0]);
       
  1270 					Result=logger.SetPrimaryFiltersEnabled(*removeprimfilter, EFalse);
       
  1271 					if(Result==0)
       
  1272 					{
       
  1273 						INFO_PRINTF1(_L("Call to removeprimary has passed"));
       
  1274 					}
       
  1275 					Result=logger.SetSecondaryFiltersEnabled(removesecondfilter, EFalse);
       
  1276 					if(Result==0)
       
  1277 					{
       
  1278 						INFO_PRINTF1(_L("Call to removesecondary has passed"));
       
  1279 					}
       
  1280 					CArrayFixFlat<TUint8> *newsetprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
  1281 					newsetprimfilter->AppendL((TUint8)(UTracePrimary+2));
       
  1282 					RArray<TUint32> newsetsecondfilter;
       
  1283 					newsetsecondfilter.Append((TUint32)(UTraceSecondary+2));
       
  1284 					logger.SetPrimaryFiltersEnabled(*newsetprimfilter,ETrue);
       
  1285 					logger.SetSecondaryFiltersEnabled(newsetsecondfilter,ETrue);
       
  1286 					if(Result==0)
       
  1287 					{
       
  1288 						logger.Start();
       
  1289 						INFO_PRINTF1(_L("now step over some UTrace statements"));
       
  1290 						r=TestKernelTracer.DoTheKernelTrace(0, usbDevice);
       
  1291 						if(r==KErrNone)
       
  1292 							INFO_PRINTF2(_L("EndpointZeroRequestError %d"), r);
       
  1293 						else
       
  1294 							INFO_PRINTF2(_L("EndpointZeroRequestError failed  %d"), r);
       
  1295 					}
       
  1296 					Result=logger.Stop();
       
  1297 					if(Result!=0)
       
  1298 					{
       
  1299 						INFO_PRINTF1(_L("Call to Ulogger.Stop() has failed"));
       
  1300 					}
       
  1301 					if(newsetprimfilter)
       
  1302 					{
       
  1303 						delete(newsetprimfilter);
       
  1304 						newsetprimfilter=NULL;
       
  1305 					}
       
  1306 				}
       
  1307 				else
       
  1308 					INFO_PRINTF1(_L("Incorrect error code when trying to add file as a plug-in when it already exists"));
       
  1309 				if(Result==0&&TestStepResult()==EPass)
       
  1310 						SetTestStepResult(EPass);
       
  1311 				else
       
  1312 						SetTestStepResult(EFail);
       
  1313 				INFO_PRINTF1(_L("Simple negative logging to file has been tested - check output log"));
       
  1314 		}
       
  1315 
       
  1316 		/***************************multiple type test***********************/
       
  1317 	   	 // From negative test: primary has been set to UTracePrimary+2 and secondary to UTraceSecondary+2
       
  1318 		if(TestStepResult()==EPass)	
       
  1319 		{
       
  1320 			INFO_PRINTF1(_L("Now do some multiple type logging testing."));
       
  1321 			if(Result==0)
       
  1322 			{
       
  1323 				INFO_PRINTF1(_L("file set as output plugin ok"));
       
  1324 				_LIT8(KTextmedia,"uloggerfileplugin");
       
  1325 				TPtrC8 mediaptr(KTextmedia);
       
  1326 				if(Result==0)
       
  1327 				{	INFO_PRINTF1(_L("file set as active output plugin ok"));
       
  1328 					_LIT(KTextsetting, "output_path");
       
  1329 					_LIT(KmultTextvalue, "C:\\logs\\ULoggerKernelMultipleLoggingTest.log");
       
  1330 					TPluginConfiguration setPluginConfigs;
       
  1331 					setPluginConfigs.SetKey(KTextsetting);
       
  1332 					setPluginConfigs.SetValue(KmultTextvalue);
       
  1333 					Result=logger.SetPluginConfigurations(mediaptr, setPluginConfigs);
       
  1334 					if(Result==0)
       
  1335 						INFO_PRINTF1(_L("output plugin settings set ok"));
       
  1336 					else
       
  1337 						INFO_PRINTF1(_L("setting output plugin settings failed"));	
       
  1338 				}
       
  1339 				else
       
  1340 					INFO_PRINTF1(_L("file not set as active output plugin - failed"));
       
  1341 				if(Result==0)
       
  1342 				{
       
  1343 				/******************reset filters and change call for multiple logging*****/
       
  1344 				
       
  1345 					CArrayFixFlat<TUint8> *multsetprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
  1346 					multsetprimfilter->AppendL(UTracePrimary);
       
  1347 					RArray<TUint32> multsetsecondfilter;
       
  1348 					multsetsecondfilter.Append((TUint32) (UTraceSecondary));
       
  1349 					logger.SetPrimaryFiltersEnabled(*multsetprimfilter,ETrue);
       
  1350 					logger.SetSecondaryFiltersEnabled(multsetsecondfilter,ETrue);
       
  1351 					INFO_PRINTF1(_L("Now given the two sets of set filters, step over traces of each type, some with matching primary but not secondary and vice versa"));
       
  1352 					Result=logger.Start();
       
  1353 					if(Result!=KErrNone)
       
  1354 						INFO_PRINTF2(_L("ulogger server didn't start, with error %d"), Result);
       
  1355 					/*****do the tracing**************/
       
  1356 					r=TestKernelTracer.DoTheKernelTrace(1, usbDevice);
       
  1357 					if(r!=KErrNone)
       
  1358 					{
       
  1359 						INFO_PRINTF2(_L("GetStringDescriptorLangId failed with error %d"), r);
       
  1360 					}
       
  1361 					Result=logger.Stop();
       
  1362 					if(Result!=KErrNone)
       
  1363 					{
       
  1364 						INFO_PRINTF2(_L("Call to Ulogger.Stop() has failed with error %d"), Result);
       
  1365 					}					
       
  1366 					if(multsetprimfilter)
       
  1367 					{
       
  1368 						delete(multsetprimfilter);
       
  1369 						multsetprimfilter=NULL;
       
  1370 					}
       
  1371 				}
       
  1372 			}
       
  1373 			else
       
  1374 				INFO_PRINTF1(_L("adding file as output plugin failed"));
       
  1375 			if(Result==0&&TestStepResult()==EPass)
       
  1376 					SetTestStepResult(EPass);
       
  1377 			else
       
  1378 					SetTestStepResult(EFail);
       
  1379 			INFO_PRINTF1(_L("Multiple logging to file with kernel side tracing has been tested - check output log. It should contain four lines of tracing of type, (sec,prim), (sec+2, prim), (sec, prim+2), (sec+2, prim+2)"));
       
  1380 			configIni.Clear(logger);
       
  1381 		}
       
  1382 		if(setprimfilter)
       
  1383 		{
       
  1384 			delete(setprimfilter);
       
  1385 			setprimfilter=NULL;
       
  1386 		}
       
  1387 		INFO_PRINTF1(_L("Now shutdown the ulogger server session"));
       
  1388 	    logger.Close();
       
  1389 		//  **************   Block end ****************
       
  1390 		}
       
  1391 #else
       
  1392 		INFO_PRINTF1(_L("Kernel tests not run on emulator"));
       
  1393 #endif
       
  1394 	  return TestStepResult();
       
  1395 	}
       
  1396 
       
  1397 
       
  1398 
       
  1399 TVerdict CULoggerAPIKernelTestStep::doTestStepPostambleL()
       
  1400 /**
       
  1401  * @return - TVerdict code
       
  1402  * Override of base class virtual
       
  1403  */
       
  1404 	{
       
  1405 	INFO_PRINTF1(_L("Please delete this line or modify it. I am in Test Step Postamble in Class CULoggerAPIKernelTestStep"));
       
  1406 	return TestStepResult();
       
  1407 	}
       
  1408 
       
  1409 
       
  1410 
       
  1411 
       
  1412 /*******************************************************************************/
       
  1413 /*********************************Printf Test***************************/
       
  1414 /*******************************************************************************/
       
  1415 
       
  1416 CULoggerAPIPrintfTestStep::~CULoggerAPIPrintfTestStep()
       
  1417 /**
       
  1418  * Destructor
       
  1419  */
       
  1420 	{
       
  1421 	}
       
  1422 
       
  1423 CULoggerAPIPrintfTestStep::CULoggerAPIPrintfTestStep()
       
  1424 /**
       
  1425  * Constructor
       
  1426  */
       
  1427 	{
       
  1428 	SetTestStepName(KULoggerAPIPrintfTestStep);
       
  1429 	}
       
  1430 
       
  1431 TVerdict CULoggerAPIPrintfTestStep::doTestStepPreambleL()
       
  1432 /**
       
  1433  * @return - TVerdict code
       
  1434  * Override of base class virtual
       
  1435  */
       
  1436 	{
       
  1437 		INFO_PRINTF1(_L("Testing ULogger API/uloggerclient.h logging with user side printf tracing functionality"));
       
  1438  		if(NumberOfPrintfMacros!=16)
       
  1439 		{
       
  1440 			INFO_PRINTF1(_L("WARNING! Number of available UTrace Printf Macros is not the same as accounted for in calls to UTrace!! Update ULoggerAPITest.cpp, (logging test step) accordingly!"));	
       
  1441 			SetTestStepResult(EFail);
       
  1442 		}
       
  1443 		else	
       
  1444 			SetTestStepResult(EPass);
       
  1445 		return TestStepResult();
       
  1446 	}
       
  1447 
       
  1448 
       
  1449 TVerdict CULoggerAPIPrintfTestStep::doTestStepL()
       
  1450 /**
       
  1451  * @return - TVerdict code
       
  1452  * Override of base class pure virtual
       
  1453  * Our implementation only logger.GetS called if the base class doTestStepPreambleL() did
       
  1454  * not leave. That being the case, the current test Result value will be EPass.
       
  1455  */
       
  1456 	{
       
  1457 	  if (TestStepResult()==EPass)
       
  1458 		{
       
  1459 		//  ************** Delete the Block, the block start ****************
       
  1460 			INFO_PRINTF1(_L("About to test ulogger printf tracing with one primary and one secondary"));  //Block start
       
  1461 			TInt Result=0;
       
  1462 			RULogger logger;
       
  1463 			logger.Connect();
       
  1464 			CClearConfig configIni;
       
  1465 			configIni.Clear(logger);
       
  1466 			CArrayFixFlat<TUint8> *setprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
  1467 			setprimfilter->AppendL(UTracePrimary);
       
  1468 			RArray<TUint32> setsecondfilter;
       
  1469 			setsecondfilter.Append((TUint32) UTraceSecondary);
       
  1470 			logger.SetPrimaryFiltersEnabled(*setprimfilter,ETrue);
       
  1471 			logger.SetSecondaryFiltersEnabled(setsecondfilter,ETrue);
       
  1472 			INFO_PRINTF1(_L("about to set file as output plugin"));
       
  1473 			//NB: this of course assumes that the plugin functionality works which is tested more rigorously in the plugin test step
       
  1474 		
       
  1475 			if(Result==0)	
       
  1476 			{
       
  1477 				INFO_PRINTF1(_L("file set as output plugin ok"));
       
  1478 				_LIT8(KTextmedia,"uloggerfileplugin");
       
  1479 				TPtrC8 mediaptr(KTextmedia);
       
  1480 				Result=logger.ActivateOutputPlugin(mediaptr);
       
  1481 				if(Result==0||Result==-11)
       
  1482 				{	INFO_PRINTF1(_L("file set as active output plugin ok"));
       
  1483 					_LIT(KTextsetting, "output_path");
       
  1484 					_LIT(KTextvalue, "C:\\logs\\ULoggerPrintfTest.log");
       
  1485 					TPluginConfiguration pluginConfig;
       
  1486 					pluginConfig.SetKey(KTextsetting);
       
  1487 					pluginConfig.SetValue(KTextvalue);
       
  1488 					Result=logger.SetPluginConfigurations(mediaptr, pluginConfig);
       
  1489 					if(Result==0)
       
  1490 						INFO_PRINTF1(_L("output plugin settings set ok"));
       
  1491 					else
       
  1492 						INFO_PRINTF1(_L("setting output plugin settings failed"));
       
  1493 				}
       
  1494 				else
       
  1495 					INFO_PRINTF1(_L("file not set as active output plugin - failed"));
       
  1496 			}
       
  1497 			else
       
  1498 				INFO_PRINTF1(_L("add file as output plugin failed"));
       
  1499 			if(Result==0)
       
  1500 			{
       
  1501 				/************** Start Logging to File****************/
       
  1502 				/************* Testing NONSTATIC printf methods**********************/
       
  1503 
       
  1504 				Result=logger.Start();
       
  1505 				INFO_PRINTF2(_L("ulogger start returns error %d"), Result);
       
  1506 				INFO_PRINTF1(_L("now step over some UTrace printf statements"));
       
  1507 				int tracetag =0;
       
  1508 				TBool ret=1;
       
  1509 				CUTraces Testtracer;
       
  1510 				INFO_PRINTF1(_L("******Testing NONSTATIC Trace Printf Methods******"));
       
  1511 		
       
  1512 				/*Comment out this line to switch off tracing as a negative test*/
       
  1513 		
       
  1514 				for(tracetag=0; tracetag!=NumberOfPrintfMacros&&ret;tracetag++)
       
  1515 				{
       
  1516 					ret = 0;
       
  1517 					ret = Testtracer.DoThePrintf(tracetag);
       
  1518 					INFO_PRINTF3(_L("UTrace printf macro %d has trace size %d - UPDATE!!!!"), tracetag, 0);
       
  1519 				}
       
  1520 				bool UTraceStatus=0;	
       
  1521 #ifdef SYMBIAN_TRACE_ENABLE
       
  1522 		UTraceStatus = 1;
       
  1523 		INFO_PRINTF1(_L("UTRACING HAS BEEN ENABLED!"));
       
  1524 #else
       
  1525 		UTraceStatus = 0;
       
  1526 		INFO_PRINTF1(_L("UTRACING HAS BEEN DISABLED! All Log files should be empty/not exist"));
       
  1527 #endif
       
  1528 				if((ret&&UTraceStatus)||(!ret&&!UTraceStatus))
       
  1529 				{
       
  1530 					Result=0;
       
  1531 					INFO_PRINTF1(_L("UTracing printfs carried out succesfully"));
       
  1532 					if(ret==1) 
       
  1533 						INFO_PRINTF1(_L("logfile should contain appropriate printf tracing"));
       
  1534 					else
       
  1535 						INFO_PRINTF1(_L("logfile should be empty of printf trace statements"));
       
  1536 				}
       
  1537 				else
       
  1538 				{
       
  1539 					Result=1;
       
  1540 					INFO_PRINTF2(_L("UTracing Failed on UTrace printf macro %d"), tracetag);
       
  1541 				}
       
  1542 			
       
  1543 				/************* Now Test STATIC printf methods**********************/
       
  1544 				
       
  1545 				INFO_PRINTF1(_L("******Testing STATIC Trace Printf Methods******"));
       
  1546 	
       
  1547 				/*Comment out this line to switch off tracing as a negative test*/
       
  1548 				for(tracetag=0; tracetag!=NumberOfPrintfMacros&&ret;tracetag++)
       
  1549 				{
       
  1550 					ret = 0;
       
  1551 					ret = Testtracer.DoTheStaticPrintf(tracetag);
       
  1552 					INFO_PRINTF3(_L("UTrace printf macro %d has trace size %d - UPDATE!!!!"), tracetag, 0);
       
  1553 				}
       
  1554 #ifdef SYMBIAN_TRACE_ENABLE
       
  1555 		UTraceStatus = 1;
       
  1556 		INFO_PRINTF1(_L("UTRACING HAS BEEN ENABLED!"));
       
  1557 #else
       
  1558 		UTraceStatus = 0;
       
  1559 		INFO_PRINTF1(_L("UTRACING HAS BEEN DISABLED! All Log files should be empty/not exist"));
       
  1560 #endif
       
  1561 				if((ret&&UTraceStatus)||(!ret&&!UTraceStatus))
       
  1562 				{
       
  1563 					Result=0;
       
  1564 					INFO_PRINTF1(_L("UTracing printfs carried out succesfully"));
       
  1565 					if(ret==1) 
       
  1566 						INFO_PRINTF1(_L("logfile should contain appropriate printf tracing"));
       
  1567 					else
       
  1568 						INFO_PRINTF1(_L("logfile should be empty of printf trace statements"));
       
  1569 				}
       
  1570 				else
       
  1571 				{
       
  1572 					Result=1;
       
  1573 					INFO_PRINTF2(_L("UTracing Failed on UTrace printf macro %d"), tracetag);
       
  1574 				}
       
  1575 			}
       
  1576 			SetTestStepResult(EPass);
       
  1577 		}
       
  1578 	  return TestStepResult();
       
  1579 	}
       
  1580 
       
  1581 
       
  1582 
       
  1583 TVerdict CULoggerAPIPrintfTestStep::doTestStepPostambleL()
       
  1584 /**
       
  1585  * @return - TVerdict code
       
  1586  * Override of base class virtual
       
  1587  */
       
  1588 	{
       
  1589 	INFO_PRINTF1(_L("completed user side printf logging tests"));
       
  1590 	
       
  1591 	return TestStepResult();
       
  1592 	}
       
  1593 
       
  1594 
       
  1595 
       
  1596 
       
  1597 
       
  1598 /******************************************************************************/
       
  1599 /*********************************Kernel Side Printf Test***************************/
       
  1600 /*******************************************************************************/
       
  1601 
       
  1602 CULoggerAPIKernelPrintfTestStep::~CULoggerAPIKernelPrintfTestStep()
       
  1603 /**
       
  1604  * Destructor
       
  1605  */
       
  1606 	{
       
  1607 	}
       
  1608 
       
  1609 CULoggerAPIKernelPrintfTestStep::CULoggerAPIKernelPrintfTestStep()
       
  1610 /**
       
  1611  * Constructor
       
  1612  */
       
  1613 	{
       
  1614 	SetTestStepName(KULoggerAPIKernelPrintfTestStep);
       
  1615 	}
       
  1616 
       
  1617 TVerdict CULoggerAPIKernelPrintfTestStep::doTestStepPreambleL()
       
  1618 /**
       
  1619  * @return - TVerdict code
       
  1620  * Override of base class virtual
       
  1621  */
       
  1622 	{
       
  1623 	INFO_PRINTF1(_L("Testing ULogger API/uloggerclient.h kernel side printf logging functionality"));
       
  1624 	return TestStepResult();
       
  1625 	}
       
  1626 
       
  1627 
       
  1628 TVerdict CULoggerAPIKernelPrintfTestStep::doTestStepL()
       
  1629 /**
       
  1630  * @return - TVerdict code
       
  1631  * Override of base class pure virtual
       
  1632  * Our implementation only logger.GetS called if the base class doTestStepPreambleL() did
       
  1633  * not leave. That being the case, the current test Result value will be EPass.
       
  1634  */
       
  1635 	{
       
  1636 #ifndef __WINSCW__
       
  1637 	  if (TestStepResult()==EPass)
       
  1638 		{
       
  1639 		//  ************** Delete the Block, the block start ****************
       
  1640 			INFO_PRINTF1(_L("About to test ulogger start with one primary and one secondary, kernel side printf logging"));  //Block start
       
  1641 			TInt Result=0;
       
  1642 			CUKernelTraces TestKernelTracer;
       
  1643 			RULogger logger;
       
  1644 			logger.Connect();
       
  1645 			CClearConfig configIni;
       
  1646 			configIni.Clear(logger);
       
  1647 			CArrayFixFlat<TUint8> *setprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
  1648 			setprimfilter->AppendL(UTracePrimary);
       
  1649 			RArray<TUint32> setsecondfilter;
       
  1650 			setsecondfilter.Append((TUint32) UTraceSecondary);	
       
  1651 			logger.SetPrimaryFiltersEnabled(*setprimfilter,ETrue);
       
  1652 			logger.SetSecondaryFiltersEnabled(setsecondfilter,ETrue);
       
  1653 			INFO_PRINTF1(_L("about to set file as output plugin"));
       
  1654 			//NB: this of course assumes that the plugin functionality works which is tested more rigorously in the plugin test step
       
  1655 		
       
  1656 			//Result=logger.AddOutputPlugin(KTextplugin);
       
  1657 			if(Result==0)	
       
  1658 			{
       
  1659 				INFO_PRINTF1(_L("file set as output plugin ok"));
       
  1660 				_LIT8(KTextmedia,"uloggerfileplugin");
       
  1661 				TPtrC8 mediaptr(KTextmedia);
       
  1662 				Result=logger.ActivateOutputPlugin(mediaptr);
       
  1663 				if(Result==0||Result==-11)
       
  1664 				{	INFO_PRINTF1(_L("file set as active output plugin ok"));
       
  1665 					_LIT(KTextsetting, "output_path");
       
  1666 					_LIT(KTextvalue, "C:\\logs\\ULoggerKernelPrintfTest.log");
       
  1667 					TPluginConfiguration setPluginConfigs;
       
  1668 					setPluginConfigs.SetKey(KTextsetting);
       
  1669 					setPluginConfigs.SetValue(KTextvalue);
       
  1670 					Result=logger.SetPluginConfigurations(mediaptr, setPluginConfigs);
       
  1671 					if(Result==0)
       
  1672 						INFO_PRINTF1(_L("output plugin settings set ok"));
       
  1673 					else
       
  1674 						INFO_PRINTF1(_L("setting output plugin settings failed"));
       
  1675 				}
       
  1676 				else
       
  1677 					INFO_PRINTF1(_L("file not set as active output plugin - failed"));
       
  1678 			}
       
  1679 			else
       
  1680 				INFO_PRINTF1(_L("add file as output plugin failed"));
       
  1681 			TInt r = KErrNone;
       
  1682 			r=User::LoadLogicalDevice(_L("eusbc.ldd"));
       
  1683 			if(r == KErrAlreadyExists)
       
  1684 			r = KErrNone;
       
  1685 			RDevUsbcClient usbDevice;
       
  1686 			if(Result==0)
       
  1687 			{
       
  1688 				/************** Start Logging to File****************/
       
  1689 		
       
  1690 				logger.Start();
       
  1691 				INFO_PRINTF1(_L("now step over some UTrace statements"));
       
  1692 				INFO_PRINTF1(_L("Device driver loading............."));
       
  1693 				if (r == KErrNone)
       
  1694 				{
       
  1695 					INFO_PRINTF1(_L("Device driver loaded successfully!!!!!!!!!!!!!!!!!!"));
       
  1696 					r = usbDevice.Open(0);
       
  1697 					INFO_PRINTF2(_L("Device driver opening %d"), r);
       
  1698 					if(r == KErrNone)
       
  1699 					{
       
  1700 						r = TestKernelTracer.DoTheKernelPrintf(0, usbDevice);
       
  1701 						if(r==KErrNone)
       
  1702 							INFO_PRINTF2(_L("SetStringDescriptor %d"), r);
       
  1703 						else
       
  1704 							INFO_PRINTF2(_L("SetStringDescriptor failed %d"), r);
       
  1705 					}
       
  1706 					else
       
  1707 						INFO_PRINTF1(_L("Device driver opening failed"));
       
  1708 				}
       
  1709 				else
       
  1710 					INFO_PRINTF2(_L("Device Driver didn't load, %d"), r);
       
  1711 #ifdef SYMBIAN_TRACE_ENABLE
       
  1712 		INFO_PRINTF1(_L("UTRACING HAS BEEN ENABLED!"));
       
  1713 #else
       
  1714 		INFO_PRINTF1(_L("UTRACING HAS BEEN DISABLED! All Log files should be empty/not exist"));
       
  1715 #endif
       
  1716 				/************** Stop Logging to File****************/
       
  1717 	
       
  1718 				Result=logger.Stop();
       
  1719 				if(Result!=KErrNone)
       
  1720 					INFO_PRINTF2(_L("Call to Ulogger.Stop() has failed with err %d"), Result);
       
  1721 			}
       
  1722 			else
       
  1723 				INFO_PRINTF1(_L("adding file as output plugin failed"));
       
  1724 			if(Result==0)
       
  1725 					SetTestStepResult(EPass);
       
  1726 			else
       
  1727 					SetTestStepResult(EFail);
       
  1728 			INFO_PRINTF1(_L("Simple printf logging to file has been tested with kernel side tracing- check output log"));	
       
  1729 
       
  1730 			/***************************negative test***********************/
       
  1731 	
       
  1732 			if(TestStepResult()==EPass)	
       
  1733 			{
       
  1734 				INFO_PRINTF1(_L("Now do some negative logging testing."));
       
  1735 				if(Result==KErrNone)
       
  1736 				{
       
  1737 					INFO_PRINTF1(_L("file set as output plugin ok"));
       
  1738 					_LIT8(KTextmedia,"uloggerfileplugin");
       
  1739 					TPtrC8 mediaptr(KTextmedia);
       
  1740 					if(Result==0||Result==-11)
       
  1741 					{	INFO_PRINTF1(_L("file set as active output plugin ok"));
       
  1742 						_LIT(KTextsetting, "output_path");
       
  1743 						_LIT(KnegTextvalue, "C:\\logs\\ULoggerKernelPrintfNegativeLoggingTest.log");
       
  1744 						TPluginConfiguration negSetPluginConfigs;
       
  1745 						negSetPluginConfigs.SetKey(KTextsetting);
       
  1746 						negSetPluginConfigs.SetValue(KnegTextvalue);
       
  1747 						Result=logger.SetPluginConfigurations(mediaptr, negSetPluginConfigs);
       
  1748 						if(Result==0)
       
  1749 							INFO_PRINTF1(_L("output plugin settings set ok"));
       
  1750 						else
       
  1751 							INFO_PRINTF1(_L("setting output plugin settings failed"));	
       
  1752 					}
       
  1753 					else
       
  1754 						INFO_PRINTF1(_L("file not set as active output plugin - failed"));
       
  1755 					
       
  1756 					/**************Now Change the filter settings********/
       
  1757 				
       
  1758 					CArrayFixFlat<TUint8> *removeprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
  1759 					removeprimfilter->AppendL(setprimfilter->At(0));
       
  1760 					RArray<TUint32> removesecondfilter;
       
  1761 					removesecondfilter.Append(setsecondfilter[0]);
       
  1762 					Result=logger.SetPrimaryFiltersEnabled(*removeprimfilter, EFalse);
       
  1763 					if(Result==0)
       
  1764 					{
       
  1765 						INFO_PRINTF1(_L("Call to removeprimary has passed"));
       
  1766 					}
       
  1767 					Result=logger.SetSecondaryFiltersEnabled(removesecondfilter, EFalse);
       
  1768 					if(Result==0)
       
  1769 					{
       
  1770 						INFO_PRINTF1(_L("Call to removesecondary has passed"));
       
  1771 					}
       
  1772 					CArrayFixFlat<TUint8> *newsetprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
  1773 					newsetprimfilter->AppendL((TUint8)(UTracePrimary+2));
       
  1774 					RArray<TUint32> newsetsecondfilter;
       
  1775 					newsetsecondfilter.Append((TUint32) (UTraceSecondary+2));
       
  1776 					logger.SetPrimaryFiltersEnabled(*newsetprimfilter,ETrue);
       
  1777 					logger.SetSecondaryFiltersEnabled(newsetsecondfilter,ETrue);
       
  1778 					if(Result==0)
       
  1779 					{
       
  1780 						logger.Start();
       
  1781 						INFO_PRINTF1(_L("now step over some UTrace statements"));
       
  1782 						r = TestKernelTracer.DoTheKernelPrintf(0, usbDevice);		
       
  1783 						if(r==KErrNone)
       
  1784 							INFO_PRINTF2(_L("SetStringDescriptor %d"), r);
       
  1785 						else
       
  1786 							INFO_PRINTF2(_L("SetStringDescriptor failed  %d"), r);
       
  1787 					}
       
  1788 					Result=logger.Stop();
       
  1789 					if(Result!=0)
       
  1790 					{
       
  1791 						INFO_PRINTF1(_L("Call to Ulogger.Stop() has failed"));
       
  1792 					}
       
  1793 					if(newsetprimfilter)
       
  1794 					{
       
  1795 						delete(newsetprimfilter);
       
  1796 						newsetprimfilter=NULL;
       
  1797 					}
       
  1798 				}
       
  1799 				else
       
  1800 					INFO_PRINTF1(_L("Incorrect error code when trying to add file as a plug-in when it already exists"));
       
  1801 				if(Result==0&&TestStepResult()==EPass)
       
  1802 						SetTestStepResult(EPass);
       
  1803 				else
       
  1804 						SetTestStepResult(EFail);
       
  1805 				INFO_PRINTF1(_L("Simple negative printf logging to file has been tested - check output log"));
       
  1806 			}	
       
  1807 
       
  1808 		/***************************multiple type test***********************/
       
  1809 	   	 // From negative test: primary has been set to UTracePrimary+2 and secondary to UTraceSecondary+2
       
  1810 			if(TestStepResult()==EPass)	
       
  1811 			{
       
  1812 				INFO_PRINTF1(_L("Now do some multiple type printf logging testing."));
       
  1813 				if(Result==0)
       
  1814 				{
       
  1815 					INFO_PRINTF1(_L("file set as output plugin ok"));
       
  1816 					_LIT8(KTextmedia,"uloggerfileplugin");
       
  1817 					TPtrC8 mediaptr(KTextmedia);				
       
  1818 					if(Result==0||Result==-11)
       
  1819 					{	INFO_PRINTF1(_L("file set as active output plugin ok"));
       
  1820 						_LIT(KTextsetting, "output_path");
       
  1821 						_LIT(KmultTextvalue, "C:\\logs\\ULoggerKernelPrintfMultipleLoggingTest.log");
       
  1822 						TPluginConfiguration setPluginConfigs;
       
  1823 						setPluginConfigs.SetKey(KTextsetting);
       
  1824 						setPluginConfigs.SetValue(KmultTextvalue);
       
  1825 						Result=logger.SetPluginConfigurations(mediaptr, setPluginConfigs);
       
  1826 						if(Result==0)
       
  1827 							INFO_PRINTF1(_L("output plugin settings set ok"));
       
  1828 						else
       
  1829 							INFO_PRINTF1(_L("setting output plugin settings failed"));	
       
  1830 					}
       
  1831 					else
       
  1832 						INFO_PRINTF1(_L("file not set as active output plugin - failed"));
       
  1833 					if(Result==0)
       
  1834 					{
       
  1835 						/******************reset filters and change call for multiple logging*****/
       
  1836 					
       
  1837 						CArrayFixFlat<TUint8> *multsetprimfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
       
  1838 						multsetprimfilter->AppendL(UTracePrimary);
       
  1839 						RArray<TUint32> multsetsecondfilter;
       
  1840 						multsetsecondfilter.Append((TUint32) (UTraceSecondary));
       
  1841 						logger.SetPrimaryFiltersEnabled(*multsetprimfilter,ETrue);
       
  1842 						logger.SetSecondaryFiltersEnabled(multsetsecondfilter,ETrue);
       
  1843 						INFO_PRINTF1(_L("Now given the two sets of set filters, step over traces of each type, some with matching primary but not secondary and vice versa"));
       
  1844 						Result=logger.Start();
       
  1845 						if(Result!=KErrNone)
       
  1846 							INFO_PRINTF2(_L("ulogger server didn't start, with error %d"), Result);
       
  1847 						
       
  1848 						/*****do the tracing**************/
       
  1849 						r = TestKernelTracer.DoTheKernelPrintf(1, usbDevice);
       
  1850 						if(r!=KErrNone)
       
  1851 						{
       
  1852 							INFO_PRINTF2(_L("RemoveStringDescriptor failed with error %d"), r);
       
  1853 						}
       
  1854 						Result=logger.Stop();
       
  1855 						if(Result!=KErrNone)
       
  1856 						{
       
  1857 							INFO_PRINTF2(_L("Call to Ulogger.Stop() has failed with error %d"), Result);
       
  1858 						}					
       
  1859 						if(multsetprimfilter)
       
  1860 						{
       
  1861 							delete(multsetprimfilter);
       
  1862 							multsetprimfilter=NULL;
       
  1863 						}
       
  1864 					}
       
  1865 				}
       
  1866 				else
       
  1867 					INFO_PRINTF1(_L("adding file as output plugin failed"));
       
  1868 				if(Result==0&&TestStepResult()==EPass)
       
  1869 						SetTestStepResult(EPass);
       
  1870 				else
       
  1871 						SetTestStepResult(EFail);
       
  1872 				INFO_PRINTF1(_L("Multiple printf logging to file with kernel side tracing has been tested - check output log. It should contain four lines of tracing of type, (sec,prim), (sec+2, prim), (sec, prim+2), (sec+2, prim+2)"));
       
  1873 				configIni.Clear(logger);
       
  1874 			}
       
  1875 			if(setprimfilter)
       
  1876 			{
       
  1877 				delete(setprimfilter);
       
  1878 				setprimfilter=NULL;
       
  1879 			}
       
  1880 			INFO_PRINTF1(_L("Now shutdown the ulogger server session"));
       
  1881 		    logger.Close();	
       
  1882 
       
  1883 			//  **************   Block end ****************
       
  1884 		}
       
  1885 #else
       
  1886 		INFO_PRINTF1(_L("Kernel tests not run on emulator"));
       
  1887 #endif
       
  1888 	  return TestStepResult();
       
  1889 	}
       
  1890 
       
  1891 
       
  1892 
       
  1893 TVerdict CULoggerAPIKernelPrintfTestStep::doTestStepPostambleL()
       
  1894 /**
       
  1895  * @return - TVerdict code
       
  1896  * Override of base class virtual
       
  1897  */
       
  1898 	{
       
  1899 		INFO_PRINTF1(_L("completed kernel printf functionality"));
       
  1900 		return TestStepResult();
       
  1901 	}
       
  1902