traceservices/tracefw/ost_trace_api/unit_test/te_ost/src/te_check_build_variability_step.cpp
branchRCL_3
changeset 24 cc28652e0254
parent 23 26645d81f48d
equal deleted inserted replaced
23:26645d81f48d 24:cc28652e0254
    86 	if (TestStepResult()==EPass)
    86 	if (TestStepResult()==EPass)
    87 		{
    87 		{
    88 		CheckBuildtimeVariability();
    88 		CheckBuildtimeVariability();
    89 		if (TestStepResult()==EPass)
    89 		if (TestStepResult()==EPass)
    90 			{//now check that logging occurs properly
    90 			{//now check that logging occurs properly
    91 			CheckLoggingVariabilityL();
    91 			CheckLoggingVariability();
    92 			}
    92 			}
    93 		}
    93 		}
    94 	return TestStepResult();
    94 	return TestStepResult();
    95 	}
    95 	}
    96 
    96 
    97 TVerdict CCheckBuildVariabilityStep::CheckLoggingVariabilityL()
    97 TVerdict CCheckBuildVariabilityStep::CheckLoggingVariability()
    98 	{
    98 	{
    99 	//test all cases when logging is enabled
    99 	//test all cases when logging is enabled
   100 	INFO_PRINTF2(_L("--- Logging enabled, tracing built in %i ---"), iTraceData.iTracingBuiltIn);
   100 	INFO_PRINTF2(_L("--- Logging enabled, tracing built in %i ---"), iTraceData.iTracingBuiltIn);
   101 	iTraceData.iLoggingEnabled = ETrue;
   101 	iTraceData.iLoggingEnabled = ETrue;
   102 	TTraceConfigsOperator::SetData(iTraceData, KData1, KData2, KAny1, KDefault8);
   102 	TTraceConfigsOperator::SetData(iTraceData, KData1, KData2, KAny1, KDefault8);
   106 	{
   106 	{
   107 		INFO_PRINTF2(_L("ERROR: Start logging failed, error %i "), error);
   107 		INFO_PRINTF2(_L("ERROR: Start logging failed, error %i "), error);
   108 		SetTestStepResult(EFail);
   108 		SetTestStepResult(EFail);
   109 		return TestStepResult();
   109 		return TestStepResult();
   110 	}
   110 	}
   111 	TBool passLogging = TestTracesL();
   111 	TBool passLogging = TestTraces();
   112 	//test all cases where logging is disabled
   112 	//test all cases where logging is disabled
   113 	INFO_PRINTF1(_L("--- Logging disabled ---"));
   113 	INFO_PRINTF1(_L("--- Logging disabled ---"));
   114 	iTraceData.iLoggingEnabled = EFalse;
   114 	iTraceData.iLoggingEnabled = EFalse;
   115 	error = StopLogging();
   115 	error = StopLogging();
   116 	if(error)
   116 	if(error)
   118 		INFO_PRINTF2(_L("ERROR: Failed to stop logging, error %i "), error);
   118 		INFO_PRINTF2(_L("ERROR: Failed to stop logging, error %i "), error);
   119 		SetTestStepResult(EFail);
   119 		SetTestStepResult(EFail);
   120 		return TestStepResult();
   120 		return TestStepResult();
   121 	}
   121 	}
   122 
   122 
   123 	TBool passNoLogging = TestTracesL();
   123 	TBool passNoLogging = TestTraces();
   124 
   124 
   125 	//if any of the cases failed, fail the test step
   125 	//if any of the cases failed, fail the test step
   126 	if((passLogging == EFalse) || (passNoLogging == EFalse))
   126 	if((passLogging == EFalse) || (passNoLogging == EFalse))
   127 		{
   127 		{
   128 		SetTestStepResult(EFail);
   128 		SetTestStepResult(EFail);
   129 		}
   129 		}
   130 	return TestStepResult();
   130 	return TestStepResult();
   131 	}
   131 	}
   132 
   132 
   133 TBool CCheckBuildVariabilityStep::TestTracesL()
   133 TBool CCheckBuildVariabilityStep::TestTraces()
   134 	{
   134 	{
   135 	TBool allPassed = ETrue;
   135 	TBool allPassed = ETrue;
   136 	for(TInt i = 1; i <= KAPIMaxNumberOfTraceApis; i++)
   136 	for(TInt i = 1; i <= KAPIMaxNumberOfTraceApis; i++)
   137 		{
   137 		{
   138 			if(i == EPrintTDesC8)
   138 			if(i == EPrintTDesC8)
   140 			if(i == EKernelPrintDesC8)
   140 			if(i == EKernelPrintDesC8)
   141 				INFO_PRINTF1(_L("-- Testing kernel side --"));
   141 				INFO_PRINTF1(_L("-- Testing kernel side --"));
   142 			if(i == EContextTClassification)
   142 			if(i == EContextTClassification)
   143 				INFO_PRINTF1(_L("-- Testing contexts --"));
   143 				INFO_PRINTF1(_L("-- Testing contexts --"));
   144 
   144 
   145 			if(DoSendTraceL((TTraceApiUsed)i))
   145 			if(DoSendTrace((TTraceApiUsed)i))
   146 				INFO_PRINTF2(_L("Trace %i - ok"), i);
   146 				INFO_PRINTF2(_L("Trace %i - ok"), i);
   147 			else
   147 			else
   148 				allPassed = EFalse;
   148 				allPassed = EFalse;
   149 		}
   149 		}
   150 	INFO_PRINTF1(_L("Trace variability testing done"));
   150 	INFO_PRINTF1(_L("Trace variability testing done"));
   151 
   151 
   152 	return allPassed;
   152 	return allPassed;
   153 	}
   153 	}
   154 
   154 
   155 
   155 
   156 TBool CCheckBuildVariabilityStep::DoSendTraceL(TTraceApiUsed aApiUsed)
   156 TBool CCheckBuildVariabilityStep::DoSendTrace(TTraceApiUsed aApiUsed)
   157 	{
   157 	{
   158 	iTraceData.iApiUsed = aApiUsed;
   158 	iTraceData.iApiUsed = aApiUsed;
   159 	TInt result = iTraceTester.SendTraceL(iTraceData);
   159 	TInt result = iTraceTester.SendTraceL(iTraceData);
   160 	TBool pass = WasTraceVariabilitySuccessful(result);
   160 	TBool pass = WasTraceVariabilitySuccessful(result);
   161 	if(!pass)
   161 	if(!pass)