kerneltest/e32test/usbho/t_otgdi/src/testcaseroot.cpp
changeset 253 d37db4dcc88d
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/usbho/t_otgdi/src/testcaseroot.cpp	Tue Aug 24 14:42:58 2010 +0100
+++ b/kerneltest/e32test/usbho/t_otgdi/src/testcaseroot.cpp	Tue Aug 24 14:49:21 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -29,6 +29,10 @@
 #include <d32otgdi.h>		// OTGDI header
 #include <d32usbc.h>		// USBCC header
 #include "testcaseroot.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "testcaserootTraces.h"
+#endif
 
 /* Implemention of classes CTestCaseRoot, CTestCaseB2BRoot
  *
@@ -48,17 +52,24 @@
 	
 void CTestCaseRoot::BaseConstructL()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTCASEROOT_BASECONSTRUCTL);
+	    }
 	
 
 	TInt err(iTimer.CreateLocal());
 	if (err == KErrNone)
 		{
 		LOG_VERBOSE1(_L("Test case timer created"));
+		if(gVerboseOutput)
+		    {
+		    OstTrace0(TRACE_VERBOSE, CTESTCASEROOT_BASECONSTRUCTL_DUP01, "Test case timer created");
+		    }
 		}
 	else
 		{
-		RDebug::Printf("<Error %d> Test case timer could not be created",err);
+		OstTrace1(TRACE_NORMAL, CTESTCASEROOT_BASECONSTRUCTL_DUP02, "<Error %d> Test case timer could not be created",err);
 		User::Leave(err);
 		}
 	//
@@ -69,17 +80,24 @@
 	
 CTestCaseRoot::~CTestCaseRoot()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTCASEROOT_DCTESTCASEROOT);
+	    }
 	Cancel();
 	}
 
 // utility GUI methods
 void CTestCaseRoot::DisplayTestCaseOptions()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTCASEROOT_DISPLAYTESTCASEOPTIONS);
+	    }
 
 	// commonly overridden to display any options for that test
 	test.Printf(_L("Press <ESC> to end the test.\n"));	
+	OstTrace0(TRACE_NORMAL, CTESTCASEROOT_DISPLAYTESTCASEOPTIONS_DUP01, "Press <ESC> to end the test.\n");	
 	}
 
     
@@ -100,7 +118,10 @@
 
 void CTestCaseRoot::DoCancel()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTCASEROOT_DOCANCEL);
+	    }
 	}
 
     
@@ -116,7 +137,10 @@
     
 void CTestCaseRoot::ProcessEngineKey(TKeyCode &aKey)
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTCASEROOT_PROCESSENGINEKEY);
+	    }
 	
 	if (EKeyEscape == aKey)
 		{
@@ -135,7 +159,10 @@
 
 void CTestCaseRoot::RequestCharacter()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTCASEROOT_REQUESTCHARACTER);
+	    }
 	  // A request is issued to the CConsoleBase to accept a
 	  // character from the keyboard.
 
@@ -149,7 +176,10 @@
 
 void CTestCaseRoot::RunL()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTCASEROOT_RUNL);
+	    }
 	TInt complCode(iStatus.Int());
 	if (iRequestedChar)
 		{
@@ -175,8 +205,16 @@
 		TInt currentStep(GetStepIndex());
 		PreRunStep();
 		LOG_VERBOSE2(_L("\n<< RunStepL() step=%d\n"), currentStep);
+		if(gVerboseOutput)
+		    {
+		    OstTrace1(TRACE_VERBOSE, CTESTCASEROOT_RUNL_DUP01, "\n<< RunStepL() step=%d\n", currentStep);
+		    }
 		RunStepL();
 		LOG_VERBOSE3(_L(">> RunStepL() step=%d->%d\n"), currentStep, GetStepIndex());
+		if(gVerboseOutput)
+		    {
+		    OstTraceExt2(TRACE_VERBOSE, CTESTCASEROOT_RUNL_DUP02, ">> RunStepL() step=%d->%d\n", currentStep, GetStepIndex());
+		    }
 		PostRunStep();
 		}
 	}
@@ -194,8 +232,12 @@
 
 TInt CTestCaseRoot::RunError(TInt aError)
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTCASEROOT_RUNERROR);
+	    }
 	test.Printf(_L("Test case C%lS::RunL left with %d"), &iTestCaseId, aError);
+	OstTraceExt2(TRACE_NORMAL, CTESTCASEROOT_RUNERROR_DUP01, "Test case C%lS::RunL left with %d", iTestCaseId, aError);
 	AssertionFailed(aError, _L("RunError"));
 	return KErrNone;
 	}
@@ -224,15 +266,23 @@
 
 void CTestCaseRoot::TestFailed(TInt aFailResult, const TDesC &aErrorDescription)
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTCASEROOT_TESTFAILED);
+	    }
 	iTestResult = aFailResult;
 	test.Printf(_L("Test %S\n"), &TestCaseId());
+	OstTraceExt1(TRACE_NORMAL, CTESTCASEROOT_TESTFAILED_DUP01, "Test %S\n", TestCaseId());
 	test.Printf(_L("Failed (%d)\n"), aFailResult);
+	OstTrace1(TRACE_NORMAL, CTESTCASEROOT_TESTFAILED_DUP02, "Failed (%d)\n", aFailResult);
 	test.Printf(_L("%S!\n"), &aErrorDescription);
+	OstTraceExt1(TRACE_NORMAL, CTESTCASEROOT_TESTFAILED_DUP03, "%S!\n", aErrorDescription);
 	if (!iAutomated)
 		{
 		test.Printf(_L("\n"));
+		OstTrace0(TRACE_NORMAL, CTESTCASEROOT_TESTFAILED_DUP04, "\n");
 		test.Printf(KPressAnyKeyToContinue);
+		OstTrace0(TRACE_NORMAL, CTESTCASEROOT_TESTFAILED_DUP05, KPressAnyKeyToContinue);
 		iConsole->Getch();
 		}
 	// the next call panics the framework!
@@ -242,13 +292,21 @@
 	
 void CTestCaseRoot::TestFailed2(TInt aFailResult, const TDesC &aErrorDescription, TInt errorCode)
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTCASEROOT_TESTFAILED2);
+	    }
 	iTestResult = aFailResult;
 	test.Printf(_L("Test %S FAILED %d '%S %d'!\n"), 
 	            &TestCaseId(), 
 	            aFailResult, 
 	            &aErrorDescription, 
 	            errorCode);
+	OstTraceExt4(TRACE_NORMAL, CTESTCASEROOT_TESTFAILED2_DUP01, "Test %S FAILED %d '%S %d'!\n", 
+	            TestCaseId(), 
+	            aFailResult, 
+	            aErrorDescription, 
+	            errorCode);
 	// the next call panics the framework!
 	TestPolicy().SignalTestComplete(iTestResult);
 	}
@@ -257,7 +315,10 @@
 	
 void CTestCaseRoot::TestPassed()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTCASEROOT_TESTPASSED);
+	    }
 	iTestResult = KErrNone;
 	TestPolicy().SignalTestComplete(iTestResult);
 	}
@@ -285,9 +346,11 @@
 	if (gVerboseOutput) 
 		{
 		test.Printf(_L("--------------\n %S "), &aStepName);
+		OstTraceExt1(TRACE_NORMAL, CTESTCASEROOT_PRINTSTEPNAME, "--------------\n %S ", aStepName);
 		// B2B class method dumps the engine state
 		//
 		test.Printf(_L("\n--------------\n"));
+		OstTrace0(TRACE_NORMAL, CTESTCASEROOT_PRINTSTEPNAME_DUP01, "\n--------------\n");
 		}
 	}
 
@@ -298,14 +361,20 @@
 CTestCaseB2BRoot::CTestCaseB2BRoot(const TDesC& aTestCaseId, TBool aHost, TRequestStatus &aStatus) 
 	: CTestCaseRoot(aTestCaseId, aHost) , iCollector(aStatus)
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTCASEB2BROOT_CTESTCASEB2BROOT);
+	    }
 	
 	}
 
 
 CTestCaseB2BRoot::~CTestCaseB2BRoot()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTCASEB2BROOT_DCTESTCASEB2BROOT);
+	    }
 	
 	}
 
@@ -316,6 +385,7 @@
 	if (gVerboseOutput) 
 		{
 		test.Printf(_L("--------------\n %S "), &aStepName);
+		OstTraceExt1(TRACE_NORMAL, CTESTCASEB2BROOT_PRINTSTEPNAME, "--------------\n %S ", aStepName);
 		// engine state
 		CNotifyWatcherBase *pWatcher = iCollector.GetWatcher(EWatcherState);
 		if (pWatcher)
@@ -325,8 +395,13 @@
 			
 			OtgStateString(aState, aDescription);
 			LOG_VERBOSE3(_L("OTGState %d '%S' \n"), aState, &aDescription);
+			if(gVerboseOutput)
+			    {
+			    OstTraceExt2(TRACE_VERBOSE, CTESTCASEB2BROOT_PRINTSTEPNAME_DUP01, "OTGState %d '%S' \n", aState, aDescription);
+			    }
 			}
 		test.Printf(_L(" : time = %dms\n--------------\n"), iCollector.DurationElapsed());
+		OstTrace1(TRACE_NORMAL, CTESTCASEB2BROOT_PRINTSTEPNAME_DUP02, " : time = %dms\n--------------\n", iCollector.DurationElapsed());
 		}
 	}
 
@@ -335,10 +410,17 @@
 void CTestCaseB2BRoot::DescribePreconditions()
 	{
 	test.Printf(KTestTypeB2BMsg); // B2B
+	OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_DESCRIBEPRECONDITIONS, KTestTypeB2BMsg); // B2B
 	if (gTestRoleMaster)
+	   {
 		test.Printf(KRoleMasterMsg);
+		OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_DESCRIBEPRECONDITIONS_DUP01, KRoleMasterMsg);
+		}
 	else
+	    {
 		test.Printf(KRoleSlaveMsg);
+		OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_DESCRIBEPRECONDITIONS_DUP02, KRoleSlaveMsg);
+		}
 	}
 
 
@@ -348,10 +430,12 @@
 	if (gTestRoleMaster)
 		{ // "B" device
 		test.Printf(KInsertBCablePrompt);
+		OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_STEPB2BPRECONDITIONS, KInsertBCablePrompt);
 		}
 	else
 		{
 		test.Printf(KInsertACablePrompt);
+		OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_STEPB2BPRECONDITIONS_DUP01, KInsertACablePrompt);
 		}
 	if (iAutomated)
 		{
@@ -360,6 +444,7 @@
 		return;
 		}
 	test.Printf(KPressAnyKeyToContinue);
+	OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_STEPB2BPRECONDITIONS_DUP02, KPressAnyKeyToContinue);
 	RequestCharacter();	
 	}
 
@@ -373,6 +458,7 @@
 		if (otgIdPinPresent())
 			{ // oops
 			test.Printf(KMsgErrorPreconditionFailed);
+			OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_CHECKROLECONNECTIONS, KMsgErrorPreconditionFailed);
 			return TestFailed(KErrAbort, KMsgBPlugNotFound);
 			}
 		}
@@ -381,6 +467,7 @@
 		if (!otgIdPinPresent())
 			{ // oops
 			test.Printf(KMsgErrorPreconditionFailed);
+			OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_CHECKROLECONNECTIONS_DUP01, KMsgErrorPreconditionFailed);
 			return TestFailed(KErrAbort, KMsgAPlugNotFound);
 			}
 		}
@@ -392,7 +479,10 @@
  */
 void CTestCaseB2BRoot::PreRunStep()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTCASEB2BROOT_PRERUNSTEP);
+	    }
 		
 		iCollector.ClearAllEvents(EFalse, ETrue);
 	}
@@ -400,7 +490,10 @@
 
 void CTestCaseB2BRoot::PostRunStep()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTCASEB2BROOT_POSTRUNSTEP);
+	    }
 		// clear the recieved event Q, but not the expected Q
 		iCollector.ClearAllEvents(ETrue, EFalse);