--- a/kerneltest/e32test/usbho/t_usbdi/src/TestCaseController.cpp Thu Aug 19 11:14:22 2010 +0300
+++ b/kerneltest/e32test/usbho/t_usbdi/src/TestCaseController.cpp Tue Aug 31 16:34:26 2010 +0300
@@ -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"
@@ -22,6 +22,10 @@
#include "testengine.h"
#include "testpolicy.h"
#include "testdebug.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "TestCaseControllerTraces.h"
+#endif
_LIT(KClientDeviceDriverName,"EUSBC");
_LIT(KHostDeviceDriverName,"usbhubdriver");
@@ -33,10 +37,12 @@
CTestCaseController* CTestCaseController::NewL(CTestEngine& aTestEngine,TBool aHostRole)
{
+ OstTraceFunctionEntryExt( CTESTCASECONTROLLER_NEWL_ENTRY, 0 );
CTestCaseController* self = new (ELeave) CTestCaseController(aTestEngine,aHostRole);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
+ OstTraceFunctionExit1( CTESTCASECONTROLLER_NEWL_EXIT, ( TUint )( self ) );
return self;
}
@@ -46,14 +52,16 @@
iTestEngine(aTestEngine),
iHostRole(aHostRole)
{
+ OstTraceFunctionEntryExt( CTESTCASECONTROLLER_CTESTCASECONTROLLER_ENTRY, this );
// Add to current threads active scheduler
CActiveScheduler::Add(this);
+ OstTraceFunctionExit1( CTESTCASECONTROLLER_CTESTCASECONTROLLER_EXIT, this );
}
CTestCaseController::~CTestCaseController()
{
- LOG_FUNC
+ OstTraceFunctionEntry1( CTESTCASECONTROLLER_CTESTCASECONTROLLER_ENTRY_DUP01, this );
Cancel(); // Cancels any oustanding test cases
@@ -64,19 +72,19 @@
TInt err = User::FreeLogicalDevice(KHostDeviceInterfaceDriverName);
if(err != KErrNone)
{
- RDebug::Printf("<Error %d> Unable to unload driver: %S",err,&KHostDeviceInterfaceDriverName);
+ OstTraceExt2(TRACE_NORMAL, CTESTCASECONTROLLER_DCTESTCASECONTROLLER, "<Error %d> Unable to unload driver: %S",err,KHostDeviceInterfaceDriverName());
}
err = User::FreeLogicalDevice(KHostDeviceDriverName);
if(err != KErrNone)
{
- RDebug::Printf("<Error %d> Unable to unload driver: %S",err,&KHostDeviceDriverName);
+ OstTraceExt2(TRACE_NORMAL, CTESTCASECONTROLLER_DCTESTCASECONTROLLER_DUP01, "<Error %d> Unable to unload driver: %S",err,KHostDeviceDriverName());
}
err = User::FreeLogicalDevice(KOtgdiLddFileName);
if(err != KErrNone)
{
- RDebug::Printf("<Error %d> Unable to unload driver: %S",err,&KHostDeviceDriverName);
+ OstTraceExt2(TRACE_NORMAL, CTESTCASECONTROLLER_DCTESTCASECONTROLLER_DUP02, "<Error %d> Unable to unload driver: %S",err,KHostDeviceDriverName());
}
}
else
@@ -84,14 +92,15 @@
TInt err(User::FreeLogicalDevice(KClientDeviceDriverName));
if(err != KErrNone)
{
- RDebug::Printf("<Error %d> Unable to unload driver: %S",err,&KClientDeviceDriverName);
+ OstTraceExt2(TRACE_NORMAL, CTESTCASECONTROLLER_DCTESTCASECONTROLLER_DUP03, "<Error %d> Unable to unload driver: %S",err,KClientDeviceDriverName());
}
}
+ OstTraceFunctionExit1( CTESTCASECONTROLLER_CTESTCASECONTROLLER_EXIT_DUP01, this );
}
void CTestCaseController::ConstructL()
{
- LOG_FUNC
+ OstTraceFunctionEntry1( CTESTCASECONTROLLER_CONSTRUCTL_ENTRY, this );
TInt err = KErrNone;
_LIT(KLoadingNamedDriverString,"loading driver: %S\n");
@@ -101,15 +110,18 @@
if(iHostRole)
{
gtest.Printf(KLoadingNamedDriverString,&KHostDeviceDriverName);
+ OstTraceExt1(TRACE_NORMAL, CTESTCASECONTROLLER_CONSTRUCTL, "loading driver: %S\n", KHostDeviceDriverName());
// Load both Host USB device drivers
err = User::LoadLogicalDevice(KHostDeviceDriverName);
gtest((err == KErrNone) || (err == KErrAlreadyExists));
gtest.Printf(KLoadedNamedDriverString,&KHostDeviceDriverName);
+ OstTraceExt1(TRACE_NORMAL, CTESTCASECONTROLLER_CONSTRUCTL_DUP01, "loaded driver: %S\n",KHostDeviceDriverName());
- RDebug::Print(KLoadingNamedDriverString,&KHostDeviceInterfaceDriverName);
+ OstTraceExt1(TRACE_NORMAL, CTESTCASECONTROLLER_CONSTRUCTL_DUP02, "loading driver: %S\n",KHostDeviceInterfaceDriverName());
err = User::LoadLogicalDevice(KHostDeviceInterfaceDriverName);
gtest((err == KErrNone) || (err == KErrAlreadyExists));
gtest.Printf(KLoadedNamedDriverString,&KHostDeviceInterfaceDriverName);
+ OstTraceExt1(TRACE_NORMAL, CTESTCASECONTROLLER_CONSTRUCTL_DUP03, "loaded driver: %S\n",KHostDeviceInterfaceDriverName());
// If test cases are running USB host side actions
// then run each test case in its own thread
@@ -120,9 +132,11 @@
// Load the USB client driver
gtest.Printf(KLoadingNamedDriverString,&KClientDeviceDriverName);
+ OstTraceExt1(TRACE_NORMAL, CTESTCASECONTROLLER_CONSTRUCTL_DUP04, "loading driver: %S\n",KClientDeviceDriverName());
err = User::LoadLogicalDevice(KClientDeviceDriverName);
gtest((err == KErrNone) || (err == KErrAlreadyExists));
gtest.Printf(KLoadedNamedDriverString,&KClientDeviceDriverName);
+ OstTraceExt1(TRACE_NORMAL, CTESTCASECONTROLLER_CONSTRUCTL_DUP05, "loaded driver: %S\n",KClientDeviceDriverName());
// Run each test case in the main thread as its not new API
// and not expected to panic
@@ -136,20 +150,23 @@
// Run the test case
iTestPolicy->RunTestCaseL(iTestCaseId,iStatus);
SetActive();
+ OstTraceFunctionExit1( CTESTCASECONTROLLER_CONSTRUCTL_EXIT, this );
}
void CTestCaseController::DoCancel()
{
+ OstTraceFunctionEntry1( CTESTCASECONTROLLER_DOCANCEL_ENTRY, this );
// Cancel the outstanding test case running
iTestPolicy->Cancel();
+ OstTraceFunctionExit1( CTESTCASECONTROLLER_DOCANCEL_EXIT, this );
}
void CTestCaseController::RunL()
{
- LOG_FUNC
+ OstTraceFunctionEntry1( CTESTCASECONTROLLER_RUNL_ENTRY, this );
// Retrieve the completion code of the last test case run
TInt err(iStatus.Int());
@@ -159,11 +176,13 @@
{
iTestCasesResults.Append(EFalse);
gtest.Printf(_L("FAILED err=%d\n"),err);
+ OstTrace1(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL, "FAILED err=%d\n",err);
}
else
{
iTestCasesResults.Append(ETrue);
gtest.Printf(_L("PASSED\n"));
+ OstTrace0(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP01, "PASSED\n");
}
// Get the identity of the next test case to run
@@ -171,14 +190,14 @@
err = iTestEngine.NextTestCaseId(iTestCaseId);
if(err == KErrNone)
{
- RDebug::Printf("\n");
- RDebug::Printf("\n");
- RDebug::Printf("\n");
+ OstTrace0(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP02, "\n");
+ OstTrace0(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP03, "\n");
+ OstTrace0(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP04, "\n");
gtest.Next(iTestCaseId);
- RDebug::Printf(" --------------------");
- RDebug::Printf("\n");
- RDebug::Printf("\n");
- RDebug::Printf("\n");
+ OstTrace0(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP05, " --------------------");
+ OstTrace0(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP06, "\n");
+ OstTrace0(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP07, "\n");
+ OstTrace0(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP08, "\n");
// Run the next test case
@@ -187,8 +206,8 @@
}
else if(err == KErrNotFound)
{
- RDebug::Printf("All specified test cases performed");
- RDebug::Printf("----------------------------------");
+ OstTrace0(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP09, "All specified test cases performed");
+ OstTrace0(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP10, "----------------------------------");
// count nb failures
@@ -202,15 +221,15 @@
nbFailures++;
}
}
- RDebug::Printf("There are %d test case results, %d failures", iTestCasesResults.Count(), nbFailures);
+ OstTraceExt2(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP11, "There are %d test case results, %d failures", iTestCasesResults.Count(), nbFailures);
// Number of tests that should have been run (including repeats)
TUint nbTests = iTestEngine.TestCasesIdentities().Count() * iTestEngine.NumRepeats();
if(nbTests!=iTestCasesResults.Count())
{
- RDebug::Printf("The number of tests that should have been run (%d) DOES NOT EQUAL the actual number of tests run (%d).",
+ OstTraceExt2(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP12, "The number of tests that should have been run (%d) DOES NOT EQUAL the actual number of tests run (%d).",
nbTests, iTestCasesResults.Count());
- RDebug::Printf("This test suite will now PANIC!");
+ OstTrace0(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP13, "This test suite will now PANIC!");
}
ASSERT((nbTests==iTestCasesResults.Count()));
@@ -219,35 +238,36 @@
{
if(iTestEngine.NumRepeats() > 1)
{
- RDebug::Printf("Test Case Loop %d..........", repeat+1);
+ OstTrace1(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP14, "Test Case Loop %d..........", repeat+1);
}
for(TInt testIndex = 0; testIndex < iTestEngine.TestCasesIdentities().Count() ; testIndex++)
{
if(iTestCasesResults[testIndex])
{
- RDebug::Print(_L("Test Case: %S : PASSED"), (iTestEngine.TestCasesIdentities())[testIndex]);
+ OstTraceExt1(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP15, "Test Case: %S : PASSED", *(iTestEngine.TestCasesIdentities())[testIndex]);
}
else
{
- RDebug::Print(_L("Test Case: %S : FAILED"), (iTestEngine.TestCasesIdentities())[testIndex]);
+ OstTraceExt1(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP16, "Test Case: %S : FAILED", *(iTestEngine.TestCasesIdentities())[testIndex]);
}
}
}
- RDebug::Printf("CActiveScheduler::Stop CTestCaseController::RunL");
+ OstTrace0(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP17, "CActiveScheduler::Stop CTestCaseController::RunL");
CActiveScheduler::Stop();
}
else
{
- RDebug::Printf("<Error %d> Unknown error from CTestEngine::NextTestCaseId",err);
+ OstTrace1(TRACE_NORMAL, CTESTCASECONTROLLER_RUNL_DUP18, "<Error %d> Unknown error from CTestEngine::NextTestCaseId",err);
User::Leave(err);
}
+ OstTraceFunctionExit1( CTESTCASECONTROLLER_RUNL_EXIT, this );
}
TInt CTestCaseController::RunError(TInt aError)
{
- LOG_FUNC
+ OstTraceFunctionEntryExt( CTESTCASECONTROLLER_RUNERROR_ENTRY, this );
switch(aError)
{
@@ -257,6 +277,7 @@
gtest(EFalse);
break;
}
+ OstTraceFunctionExitExt( CTESTCASECONTROLLER_RUNERROR_EXIT, this, KErrNone );
return KErrNone;
}