traceservices/tracefw/integ_test/ulogger/TEF/te_ulogger/src/te_uloggermclsuiteserver.cpp
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Example file/test code to demonstrate how to develop a TestExecute Server
       
    15 // Developers should take this project as a template and substitute their own
       
    16 // for (WINS && !EKA2) versions will be xxxServer.Dll and require a thread to be started
       
    17 // in the process of the client. The client initialises the server by calling the
       
    18 // one and only ordinal.
       
    19 // 
       
    20 //
       
    21 
       
    22 /**
       
    23  @file te_uloggermclsuiteserver.cpp
       
    24  @internalTechnology
       
    25 */
       
    26 
       
    27 #include "te_uloggermclsuiteserver.h"
       
    28 #include "te_uloggerapiteststep.h"
       
    29 #include "te_uloggermclperfstep.h"
       
    30 #include "te_uloggerfilepluginstep.h"
       
    31 #include "te_uloggerserialpluginstep.h"
       
    32 #include "te_uloggerbuffersizingstep.h"
       
    33 #include "te_uloggerbuffermodestep.h"
       
    34 #include "te_uloggerclearconfigstep.h"
       
    35 #include "te_uloggerconfigfilestep.h"
       
    36 #include "te_uloggerfilepluginsteperr.h"
       
    37 
       
    38 
       
    39 _LIT(KServerName,"te_uloggermclsuite");
       
    40 CTe_ULoggerMCLSuite* CTe_ULoggerMCLSuite::NewL()
       
    41 /**
       
    42  * @return - Instance of the test server
       
    43  * Same code for Secure and non-secure variants
       
    44  * Called inside the MainL() function to create and start the
       
    45  * CTestServer derived server.
       
    46  */
       
    47 	{
       
    48 	CTe_ULoggerMCLSuite * server = new (ELeave) CTe_ULoggerMCLSuite();
       
    49 	CleanupStack::PushL(server);
       
    50 
       
    51 	server->ConstructL(KServerName);
       
    52 	CleanupStack::Pop(server);
       
    53 	return server;
       
    54 	}
       
    55 
       
    56 
       
    57 // Secure variants much simpler
       
    58 // For EKA2, just an E32Main and a MainL()
       
    59 LOCAL_C void MainL()
       
    60 /**
       
    61  * Secure variant
       
    62  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    63  */
       
    64 	{
       
    65 	// Leave the hooks in for platform security
       
    66 #if (defined __DATA_CAGING__)
       
    67 	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    68 	RProcess().DataCaging(RProcess::ESecureApiOn);
       
    69 #endif
       
    70 	CActiveScheduler* sched=NULL;
       
    71 	sched=new(ELeave) CActiveScheduler;
       
    72 	CActiveScheduler::Install(sched);
       
    73 	CTe_ULoggerMCLSuite* server = NULL;
       
    74 	// Create the CTestServer derived server
       
    75 	TRAPD(err,server = CTe_ULoggerMCLSuite::NewL());
       
    76 	if(!err)
       
    77 		{
       
    78 		// Sync with the client and enter the active scheduler
       
    79 		RProcess::Rendezvous(KErrNone);
       
    80 		sched->Start();
       
    81 		}
       
    82 	delete server;
       
    83 	delete sched;
       
    84 	}
       
    85 
       
    86 
       
    87 
       
    88 GLDEF_C TInt E32Main()
       
    89 /**
       
    90  * @return - Standard Epoc error code on process exit
       
    91  * Secure variant only
       
    92  * Process entry point. Called by client using RProcess API
       
    93  */
       
    94 	{
       
    95 	__UHEAP_MARK;
       
    96 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    97 	if(cleanup == NULL)
       
    98 		{
       
    99 		return KErrNoMemory;
       
   100 		}
       
   101 	TRAPD(err,MainL());
       
   102 	delete cleanup;
       
   103 	__UHEAP_MARKEND;
       
   104 	return err;
       
   105     }
       
   106 
       
   107 
       
   108 CTestStep* CTe_ULoggerMCLSuite::CreateTestStep(const TDesC& aStepName)
       
   109 /**
       
   110  * @return - A CTestStep derived instance
       
   111  * Secure and non-secure variants
       
   112  * Implementation of CTestServer pure virtual
       
   113  */
       
   114 	{
       
   115 	CTestStep* testStep = NULL;
       
   116 	//API functionality tests
       
   117               if(aStepName == KULoggerAPIPrimTestStep)
       
   118                             testStep = new CULoggerAPIPrimTestStep();
       
   119               else if(aStepName == KULoggerAPISecondTestStep)
       
   120                             testStep = new CULoggerAPISecondTestStep();
       
   121               else if(aStepName == KULoggerAPILoggingTestStep)
       
   122                             testStep = new CULoggerAPILoggingTestStep();
       
   123               else if(aStepName == KULoggerAPIKernelTestStep)
       
   124                             testStep = new CULoggerAPIKernelTestStep();
       
   125               else if(aStepName == KULoggerAPIPrintfTestStep)
       
   126                             testStep = new CULoggerAPIPrintfTestStep();
       
   127               else if(aStepName == KULoggerAPIKernelPrintfTestStep)
       
   128                             testStep = new CULoggerAPIKernelPrintfTestStep();
       
   129               else if(aStepName == KULoggerFilePluginStep)
       
   130                             testStep = new CULoggerFilePluginStep();
       
   131               else if(aStepName == KULoggerSerialPluginStep)
       
   132                             testStep = new CULoggerSerialPluginStep();
       
   133 	          else if(aStepName == KULoggerBufferSizingStep)
       
   134                             testStep = new CULoggerBufferSizingStep();
       
   135               else if(aStepName == KULoggerBufferModeStep)
       
   136                             testStep = new CULoggerBufferModeStep();
       
   137               else if(aStepName == KULoggerClearConfigStep)
       
   138                             testStep = new CULoggerClearConfigStep();
       
   139               else if(aStepName == KULoggerPublicConfigFileTestStep)
       
   140                	    	    testStep = new CULoggerPublicConfigFileTestStep();
       
   141               else if(aStepName == KULoggerPrivateConfigFileTestStep)
       
   142                             testStep = new CULoggerPrivateConfigFileTestStep();
       
   143               //negative tests (error code returned from an ulogger plugin) - server shouldn't panic
       
   144               else if(aStepName == KULoggerFilePluginStepErr)
       
   145             	  			testStep = new CULoggerFilePluginStepErr();
       
   146 	 //Performance tests
       
   147               else if(aStepName == KULoggerMCLUserPerfStep)
       
   148                             testStep = new CULoggerMCLUserPerfStep();
       
   149               else if(aStepName == KULoggerMCLKernelPerfStep)
       
   150                             testStep = new CULoggerMCLKernelPerfStep();
       
   151 
       
   152 			 return testStep;
       
   153 	}