kerneltest/e32test/usbho/t_otgdi/src/testcaseroot.cpp
branchRCL_3
changeset 257 3e88ff8f41d5
parent 256 c1f20ce4abcf
--- a/kerneltest/e32test/usbho/t_otgdi/src/testcaseroot.cpp	Tue Aug 31 16:34:26 2010 +0300
+++ b/kerneltest/e32test/usbho/t_otgdi/src/testcaseroot.cpp	Wed Sep 01 12:34:56 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-2009 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,10 +29,6 @@
 #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
  *
@@ -52,24 +48,17 @@
 	
 void CTestCaseRoot::BaseConstructL()
 	{
-	if(gVerboseOutput)
-	    {
-	    OstTraceFunctionEntry0(CTESTCASEROOT_BASECONSTRUCTL);
-	    }
+	LOG_FUNC
 	
 
 	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
 		{
-		OstTrace1(TRACE_NORMAL, CTESTCASEROOT_BASECONSTRUCTL_DUP02, "<Error %d> Test case timer could not be created",err);
+		RDebug::Printf("<Error %d> Test case timer could not be created",err);
 		User::Leave(err);
 		}
 	//
@@ -80,24 +69,17 @@
 	
 CTestCaseRoot::~CTestCaseRoot()
 	{
-	if(gVerboseOutput)
-	    {
-	    OstTraceFunctionEntry0(CTESTCASEROOT_DCTESTCASEROOT);
-	    }
+	LOG_FUNC
 	Cancel();
 	}
 
 // utility GUI methods
 void CTestCaseRoot::DisplayTestCaseOptions()
 	{
-	if(gVerboseOutput)
-	    {
-	    OstTraceFunctionEntry0(CTESTCASEROOT_DISPLAYTESTCASEOPTIONS);
-	    }
+	LOG_FUNC
 
 	// 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");	
 	}
 
     
@@ -118,10 +100,7 @@
 
 void CTestCaseRoot::DoCancel()
 	{
-	if(gVerboseOutput)
-	    {
-	    OstTraceFunctionEntry0(CTESTCASEROOT_DOCANCEL);
-	    }
+	LOG_FUNC
 	}
 
     
@@ -137,10 +116,7 @@
     
 void CTestCaseRoot::ProcessEngineKey(TKeyCode &aKey)
 	{
-	if(gVerboseOutput)
-	    {
-	    OstTraceFunctionEntry0(CTESTCASEROOT_PROCESSENGINEKEY);
-	    }
+	LOG_FUNC
 	
 	if (EKeyEscape == aKey)
 		{
@@ -159,10 +135,7 @@
 
 void CTestCaseRoot::RequestCharacter()
 	{
-	if(gVerboseOutput)
-	    {
-	    OstTraceFunctionEntry0(CTESTCASEROOT_REQUESTCHARACTER);
-	    }
+	LOG_FUNC
 	  // A request is issued to the CConsoleBase to accept a
 	  // character from the keyboard.
 
@@ -176,10 +149,7 @@
 
 void CTestCaseRoot::RunL()
 	{
-	if(gVerboseOutput)
-	    {
-	    OstTraceFunctionEntry0(CTESTCASEROOT_RUNL);
-	    }
+	LOG_FUNC
 	TInt complCode(iStatus.Int());
 	if (iRequestedChar)
 		{
@@ -205,16 +175,8 @@
 		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();
 		}
 	}
@@ -232,12 +194,8 @@
 
 TInt CTestCaseRoot::RunError(TInt aError)
 	{
-	if(gVerboseOutput)
-	    {
-	    OstTraceFunctionEntry0(CTESTCASEROOT_RUNERROR);
-	    }
+	LOG_FUNC
 	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;
 	}
@@ -266,23 +224,15 @@
 
 void CTestCaseRoot::TestFailed(TInt aFailResult, const TDesC &aErrorDescription)
 	{
-	if(gVerboseOutput)
-	    {
-	    OstTraceFunctionEntry0(CTESTCASEROOT_TESTFAILED);
-	    }
+	LOG_FUNC
 	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!
@@ -292,21 +242,13 @@
 	
 void CTestCaseRoot::TestFailed2(TInt aFailResult, const TDesC &aErrorDescription, TInt errorCode)
 	{
-	if(gVerboseOutput)
-	    {
-	    OstTraceFunctionEntry0(CTESTCASEROOT_TESTFAILED2);
-	    }
+	LOG_FUNC
 	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);
 	}
@@ -315,10 +257,7 @@
 	
 void CTestCaseRoot::TestPassed()
 	{
-	if(gVerboseOutput)
-	    {
-	    OstTraceFunctionEntry0(CTESTCASEROOT_TESTPASSED);
-	    }
+	LOG_FUNC
 	iTestResult = KErrNone;
 	TestPolicy().SignalTestComplete(iTestResult);
 	}
@@ -346,11 +285,9 @@
 	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");
 		}
 	}
 
@@ -361,20 +298,14 @@
 CTestCaseB2BRoot::CTestCaseB2BRoot(const TDesC& aTestCaseId, TBool aHost, TRequestStatus &aStatus) 
 	: CTestCaseRoot(aTestCaseId, aHost) , iCollector(aStatus)
 	{
-	if(gVerboseOutput)
-	    {
-	    OstTraceFunctionEntry0(CTESTCASEB2BROOT_CTESTCASEB2BROOT);
-	    }
+	LOG_FUNC
 	
 	}
 
 
 CTestCaseB2BRoot::~CTestCaseB2BRoot()
 	{
-	if(gVerboseOutput)
-	    {
-	    OstTraceFunctionEntry0(CTESTCASEB2BROOT_DCTESTCASEB2BROOT);
-	    }
+	LOG_FUNC
 	
 	}
 
@@ -385,7 +316,6 @@
 	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)
@@ -395,13 +325,8 @@
 			
 			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());
 		}
 	}
 
@@ -410,17 +335,10 @@
 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);
-		}
 	}
 
 
@@ -430,12 +348,10 @@
 	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)
 		{
@@ -444,7 +360,6 @@
 		return;
 		}
 	test.Printf(KPressAnyKeyToContinue);
-	OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_STEPB2BPRECONDITIONS_DUP02, KPressAnyKeyToContinue);
 	RequestCharacter();	
 	}
 
@@ -458,7 +373,6 @@
 		if (otgIdPinPresent())
 			{ // oops
 			test.Printf(KMsgErrorPreconditionFailed);
-			OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_CHECKROLECONNECTIONS, KMsgErrorPreconditionFailed);
 			return TestFailed(KErrAbort, KMsgBPlugNotFound);
 			}
 		}
@@ -467,7 +381,6 @@
 		if (!otgIdPinPresent())
 			{ // oops
 			test.Printf(KMsgErrorPreconditionFailed);
-			OstTrace0(TRACE_NORMAL, CTESTCASEB2BROOT_CHECKROLECONNECTIONS_DUP01, KMsgErrorPreconditionFailed);
 			return TestFailed(KErrAbort, KMsgAPlugNotFound);
 			}
 		}
@@ -479,10 +392,7 @@
  */
 void CTestCaseB2BRoot::PreRunStep()
 	{
-	if(gVerboseOutput)
-	    {
-	    OstTraceFunctionEntry0(CTESTCASEB2BROOT_PRERUNSTEP);
-	    }
+	LOG_FUNC
 		
 		iCollector.ClearAllEvents(EFalse, ETrue);
 	}
@@ -490,10 +400,7 @@
 
 void CTestCaseB2BRoot::PostRunStep()
 	{
-	if(gVerboseOutput)
-	    {
-	    OstTraceFunctionEntry0(CTESTCASEB2BROOT_POSTRUNSTEP);
-	    }
+	LOG_FUNC
 		// clear the recieved event Q, but not the expected Q
 		iCollector.ClearAllEvents(ETrue, EFalse);