kerneltest/e32test/usbho/t_otgdi/src/testengine.cpp
changeset 253 d37db4dcc88d
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/usbho/t_otgdi/src/testengine.cpp	Tue Aug 24 14:42:58 2010 +0100
+++ b/kerneltest/e32test/usbho/t_otgdi/src/testengine.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 "TestCaseController.h"
 #include "TestCaseFactory.h"
 #include "TestCaseRoot.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "testengineTraces.h"
+#endif
 
 // Console application parameter options
 _LIT(KArgAllTestCases,"/ALL");			// see default test-list below
@@ -80,7 +84,10 @@
 
 CTestEngine::~CTestEngine()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTENGINE_DCTESTENGINE);
+	    }
 	// Destroy the test case controller
 	if (iTestCaseController)
 		{
@@ -94,15 +101,21 @@
 	
 void CTestEngine::ConstructL()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTENGINE_CONSTRUCTL);
+	    }
 	TInt menuSelection(0);
 
 	// Display information 
 	test.Title();
 	test.Start(_L("Test Engine Initiation v2.00 "));
 	test.Printf(_L(">>\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_CONSTRUCTL_DUP01, ">>\n");
 	test.Printf(_L(">>   T E S T   R U N \n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_CONSTRUCTL_DUP02, ">>   T E S T   R U N \n");
 	test.Printf(_L(">>\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_CONSTRUCTL_DUP03, ">>\n");
 	
 
 	// Process the command line parameters for batch/etc
@@ -131,7 +144,9 @@
 		iTestCasesIdentities.ResetAndDestroy();
 		
 		test.Printf(_L("Please select 0 to %d\n"), RTestFactory::TestCaseCount()-1);
+		OstTrace1(TRACE_NORMAL, CTESTENGINE_CONSTRUCTL_DUP04, "Please select 0 to %d\n", RTestFactory::TestCaseCount()-1);
 		test.Printf(_L("or 99<ENTER> to exit\n"));
+		OstTrace0(TRACE_NORMAL, CTESTENGINE_CONSTRUCTL_DUP05, "or 99<ENTER> to exit\n");
 		GetNumericInput(menuSelection);
 		if ((menuSelection >=0) &&(menuSelection < RTestFactory::TestCaseCount()))
 			{
@@ -153,6 +168,7 @@
 		{
 		// Create the test case controller
 		test.Printf(_L("Creating the test controller\n"));
+		OstTrace0(TRACE_NORMAL, CTESTENGINE_CONSTRUCTL_DUP06, "Creating the test controller\n");
 		iTestCaseController = CTestCaseController::NewL(*this, ETrue);
 		
 		// Test-engine is non CActive class
@@ -161,6 +177,7 @@
 		{
 		// nothing to do, exit. USER aborted
 		test.Printf(_L("Test run stopped by user, nothing to do.\n"));
+		OstTrace0(TRACE_NORMAL, CTESTENGINE_CONSTRUCTL_DUP07, "Test run stopped by user, nothing to do.\n");
 		User::Leave(-2);
 		}
 	}
@@ -171,18 +188,31 @@
 void CTestEngine::PrintUsage()
 	{
 	test.Printf(_L("OTGDI Unit Test Suite.\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_PRINTUSAGE, "OTGDI Unit Test Suite.\n");
 	test.Printf(_L("Usage : t_otgdi.exe [/option] /G:<TESTNUM1>\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_PRINTUSAGE_DUP01, "Usage : t_otgdi.exe [/option] /G:<TESTNUM1>\n");
 	test.Printf(_L("  /ALL = add default test subset to List\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_PRINTUSAGE_DUP02, "  /ALL = add default test subset to List\n");
 	test.Printf(_L("  /G:<TESTNUM>  where <testname> is the test# to add \n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_PRINTUSAGE_DUP03, "  /G:<TESTNUM>  where <testname> is the test# to add \n");
 	test.Printf(_L("  /AUTO  = largely unattended operation\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_PRINTUSAGE_DUP04, "  /AUTO  = largely unattended operation\n");
 	test.Printf(_L("  /VERBOSE = test debugging info\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_PRINTUSAGE_DUP05, "  /VERBOSE = test debugging info\n");
 	test.Printf(_L("  /LOOPO:<n> = Open/close repeat counter<n>\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_PRINTUSAGE_DUP06, "  /LOOPO:<n> = Open/close repeat counter<n>\n");
 	test.Printf(_L("  /LOOPM:<n> = OOM HEAP_ALLOCS counter<n>\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_PRINTUSAGE_DUP07, "  /LOOPM:<n> = OOM HEAP_ALLOCS counter<n>\n");
 	test.Printf(_L("  /SLAVE = Test-peer server mode\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_PRINTUSAGE_DUP08, "  /SLAVE = Test-peer server mode\n");
 	test.Printf(_L("  /PID:<n> = USB VID/PID in hex eg 2670\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_PRINTUSAGE_DUP09, "  /PID:<n> = USB VID/PID in hex eg 2670\n");
 	test.Printf(_L("Valid test ID range 0456...0469\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_PRINTUSAGE_DUP10, "Valid test ID range 0456...0469\n");
 	test.Printf(_L("and 0675...0684 .\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_PRINTUSAGE_DUP11, "and 0675...0684 .\n");
 	test.Printf(_L("\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_PRINTUSAGE_DUP12, "\n");
 	}
 	
 /** process the command-line, ; arguments appear in any order
@@ -238,6 +268,7 @@
 			{
 			// skip some of the press-any key things
 			test.Printf(_L("Test semi-automated mode.\n"));
+			OstTrace0(TRACE_NORMAL, CTESTENGINE_PROCESSCOMMANDLINEL, "Test semi-automated mode.\n");
 			gSemiAutomated = ETrue;
 			tokenParsed = ETrue;
 			}
@@ -250,6 +281,10 @@
 			TPtrC testID = tc->Right(tc->Length() - pos - KArgGoTestCase().Length());
 
 			LOG_VERBOSE2(_L("Parameter found:'%S'\n"), &testID);
+			if(gVerboseOutput)
+			    {
+			    OstTraceExt1(TRACE_VERBOSE, CTESTENGINE_PROCESSCOMMANDLINEL_DUP01, "Parameter found:'%S'\n", testID);
+			    }
 
 			// Check if it is a test we know of in our suite, users may provide the full  
 			// name "PBASE-USB_OTGDI-0466", or just the last 4 digits "0466", in such cases, fetch the full name
@@ -263,6 +298,7 @@
 					{
 					
 					test.Printf(_L("Test case does NOT Exist: '%lS'\n"), &testID);
+					OstTraceExt1(TRACE_NORMAL, CTESTENGINE_PROCESSCOMMANDLINEL_DUP02, "Test case does NOT Exist: '%lS'\n", testID);
 					}
 				else
 					{ // only the number was supplied, copy the full name
@@ -275,6 +311,7 @@
 				HBufC* testIdentity = HBufC::NewLC(KTestCaseIdLength);
 				*testIdentity = testID;
 				test.Printf(_L("Test case specified: %lS\n"), testIdentity);
+				OstTraceExt1(TRACE_NORMAL, CTESTENGINE_PROCESSCOMMANDLINEL_DUP03, "Test case specified: %lS\n", *testIdentity);
 
 				iTestCasesIdentities.Append(testIdentity);
 				CleanupStack::Pop(testIdentity);
@@ -332,12 +369,17 @@
 					prodID = 0xFFFF;
 				tokenParsed = ETrue;
 				LOG_VERBOSE2(_L(" accept param %04X \n\n"), prodID);
+				if(gVerboseOutput)
+				    {
+				    OstTrace1(TRACE_VERBOSE, CTESTENGINE_PROCESSCOMMANDLINEL_DUP05, " accept param %04X \n\n", prodID);
+				    }
 				gUSBVidPid = prodID; // replace the vid-pid with the user-supplied one 
 				}
 			else
 				{
 				// print error
 				test.Printf(_L("Warning: VID+PID '%lS' not parsed .\n"), tc);
+				OstTraceExt1(TRACE_NORMAL, CTESTENGINE_PROCESSCOMMANDLINEL_DUP06, "Warning: VID+PID '%lS' not parsed .\n", *tc);
 				}
 			}
 		
@@ -360,6 +402,7 @@
 			{
 			// warn about unparsed parameter
 			test.Printf(_L("Warning: '%lS'??? not parsed\n"), tc);
+			OstTraceExt1(TRACE_NORMAL, CTESTENGINE_PROCESSCOMMANDLINEL_DUP07, "Warning: '%lS'??? not parsed\n", *tc);
 			iHelpRequested = ETrue;
 			}
 			
@@ -376,6 +419,7 @@
 void CTestEngine::AddAllDefaultTests()
 	{
 	test.Printf(_L("Adding default set test cases\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_ADDALLDEFAULTTESTS, "Adding default set test cases\n");
 	//
 	TInt index(0);
 	while (index < sizeof(KAllDefaultTestIDs)/sizeof(KAllDefaultTestIDs[0]))
@@ -430,6 +474,7 @@
 		if ( ( key >= '0' ) && ( key <= '9' ) )
 			{
 			test.Printf(_L("%c"),key);
+			OstTraceExt1(TRACE_NORMAL, CTESTENGINE_GETNUMERICINPUT, "%c",key);
 			
 			value = ( 10 * value ) + ( key - '0' );
 			digits++;
@@ -440,6 +485,7 @@
 				value = value/10;
 				digits--;
 				test.Printf(_L("\r    \r%d"), value);
+				OstTrace1(TRACE_NORMAL, CTESTENGINE_GETNUMERICINPUT_DUP01, "\r    \r%d", value);
 				}
 			}
 		}
@@ -449,6 +495,7 @@
 		aNumber = value;
 		}
 	test.Printf(_L("\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_GETNUMERICINPUT_DUP02, "\n");
 	}
 
 
@@ -458,19 +505,25 @@
 	{
 	TBuf<KTestCaseIdLength> aTestCaseId;
 	test.Printf(_L("============================\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_REPORT, "============================\n");
 	test.Printf(_L("PASSED TESTS:\n"));
+	OstTrace0(TRACE_NORMAL, CTESTENGINE_REPORT_DUP01, "PASSED TESTS:\n");
 	// itterate our list of tests to perform
 	ResetTestCaseIndex();
 	while (KErrNone == NextTestCaseId(aTestCaseId))
 		{
 		test.Printf(_L("%S\n"), &aTestCaseId);
+		OstTraceExt1(TRACE_NORMAL, CTESTENGINE_REPORT_DUP02, "%S\n", aTestCaseId);
 		}
 	}
 	
 	
 void CTestEngine::DoCancel()
 	{
-	LOG_FUNC
+	if(gVerboseOutput)
+	    {
+	    OstTraceFunctionEntry0(CTESTENGINE_DOCANCEL);
+	    }
 	test.Console()->ReadCancel();	
 	}