imagingtestenv/imagingtestfw/Source/TestFrameworkServer/TestFrameworkServer.cpp
changeset 0 5752a19fdefe
equal deleted inserted replaced
-1:000000000000 0:5752a19fdefe
       
     1 // Copyright (c) 2002-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 //
       
    15 
       
    16 #include <e32svr.h>
       
    17 
       
    18 #include "TestFrameworkServer.h"
       
    19 
       
    20 #include "TestFrameworkServer.inl"
       
    21 
       
    22 #include <testframeworkipc.h>
       
    23 
       
    24 
       
    25 /**
       
    26  *
       
    27  * Initiate server exit when the timer expires
       
    28  *
       
    29  * @xxxx
       
    30  * 
       
    31  */
       
    32 void CTestFrameworkServerShutdown::RunL()
       
    33 	{
       
    34 	CActiveScheduler::Stop();
       
    35 	}
       
    36 
       
    37 /**
       
    38  *
       
    39  * Test Framework server static constructor
       
    40  * NOTE : only one instance of the server process should run
       
    41  * during any Test Framework run; all client sessions
       
    42  * will use this one instance.
       
    43  *
       
    44  * @xxxx
       
    45  * 
       
    46  */
       
    47 CMmfIpcServer* CTestFrameworkServer::NewL()
       
    48 	{
       
    49 	CTestFrameworkServer* s = new(ELeave) CTestFrameworkServer;
       
    50 	CleanupStack::PushL(s);
       
    51 	s->ConstructL();
       
    52 	CleanupStack::Pop();
       
    53 	return s;
       
    54 	}
       
    55 
       
    56 /**
       
    57  *
       
    58  * Test Framework server first-phase constructor
       
    59  *
       
    60  * @xxxx
       
    61  * 
       
    62  */
       
    63 CTestFrameworkServer::CTestFrameworkServer()
       
    64 	:CMmfIpcServer(0, ESharableSessions)
       
    65 	{
       
    66 	}
       
    67 
       
    68 // set up so that iConsole is NULL. A call to OpenLogL will initialise the console
       
    69 // and file (if any)
       
    70 
       
    71 /**
       
    72  *
       
    73  * Test Framework server second-phase constructor
       
    74  * Starts the server; does not initialise the log
       
    75  * (this must be done independently with a call to OpenLogL)
       
    76  *
       
    77  * @xxxx
       
    78  * 
       
    79  */
       
    80 void CTestFrameworkServer::ConstructL()
       
    81 	{
       
    82 	StartL(KTestFrameworkServerName);
       
    83 	//Ensure that the server will exit even if the first client fails to connect
       
    84 	iShutdown.ConstructL();
       
    85 	iShutdown.Start();
       
    86 
       
    87 	iLogMode = 0;	// initial value : not running any log
       
    88 	iConsole = NULL;
       
    89 	iFileLogger = NULL;
       
    90 	}
       
    91 
       
    92 /**
       
    93  *
       
    94  * Test Framework server destructor
       
    95  *
       
    96  * @xxxx
       
    97  * 
       
    98  */
       
    99 CTestFrameworkServer::~CTestFrameworkServer()
       
   100 	{
       
   101 	CloseLog();
       
   102 	}
       
   103 
       
   104 /**
       
   105  *
       
   106  * Create new server session.
       
   107  *
       
   108  * @param	"const TVersion &aVersion"
       
   109  *			Server version (required)
       
   110  *
       
   111  * @return	"CSharableSession*"
       
   112  *			The created server session.
       
   113  * 
       
   114  * @xxxx
       
   115  * 
       
   116  */
       
   117 CMmfIpcSession* CTestFrameworkServer::NewSessionL(const TVersion &aVersion) const
       
   118 	{
       
   119 	TVersion ver(KTestFrameworkServerMajorVersionNumber,
       
   120 			     KTestFrameworkServerMinorVersionNumber,
       
   121 			     KTestFrameworkServerBuildVersionNumber);
       
   122 	if (!User::QueryVersionSupported(ver, aVersion))
       
   123 		User::Leave(KErrNotSupported);
       
   124 	// make new session
       
   125 	return new(ELeave) CTestFrameworkServerSession();
       
   126 	}
       
   127 
       
   128 /**
       
   129  *
       
   130  * Add a server session.
       
   131  * 
       
   132  * @xxxx
       
   133  * 
       
   134  */
       
   135 void CTestFrameworkServer::AddSession()
       
   136 	{
       
   137 	++iSessionCount;
       
   138 	iShutdown.Cancel();
       
   139 	}
       
   140 
       
   141 /**
       
   142  *
       
   143  * Drop a server session.
       
   144  * 
       
   145  * @xxxx
       
   146  * 
       
   147  */
       
   148 void CTestFrameworkServer::DropSession()
       
   149 	{
       
   150 	if (--iSessionCount <= 0)
       
   151 		iShutdown.Start();
       
   152 	}
       
   153 
       
   154 /**
       
   155  *
       
   156  * Add an input window (at request from client).
       
   157  * 
       
   158  * @param	"CTestFrameworkServerSession* aOwner"
       
   159  *			Window owning server session
       
   160  *
       
   161  * @xxxx
       
   162  * 
       
   163  */
       
   164 void CTestFrameworkServer::AddInputWindowL(CTestFrameworkServerSession* aOwner)
       
   165 	{
       
   166 	if (iInputWindow.HasOwner())
       
   167 		User::Leave(KErrAlreadyExists);
       
   168 	// else
       
   169 	iInputWindow.SetOwner(aOwner);
       
   170 	TRect rect;
       
   171 	rect.iTl = TPoint(0,0);
       
   172 	rect.iBr = TPoint(KConsFullScreen, KConsFullScreen);
       
   173 	iInputWindow.SetWinRectAndNotifyOwner(rect);
       
   174 	}
       
   175 
       
   176 /**
       
   177  *
       
   178  * Remove an input window (at request from client).
       
   179  * 
       
   180  * @param	"CTestFrameworkServerSession* aOwner"
       
   181  *			Window owning server session
       
   182  *
       
   183  * @xxxx
       
   184  * 
       
   185  */
       
   186 void CTestFrameworkServer::RemoveWindow(CTestFrameworkServerSession* aOwner)
       
   187 	{
       
   188 	if (aOwner == iInputWindow.Owner())
       
   189 		{
       
   190 		iInputWindow.SetOwner(NULL);
       
   191 		}
       
   192 	}
       
   193 
       
   194 /**
       
   195  *
       
   196  * Open a log.
       
   197  * 
       
   198  * @param	"const TDesC& aLogName"
       
   199  *			The log name
       
   200  *
       
   201  * @param	"TInt aLogMode"
       
   202  *			The log mode (as bitmask of TTestFrameworkLogMode)
       
   203  *
       
   204  * @xxxx
       
   205  * 
       
   206  */
       
   207 void CTestFrameworkServer::OpenLogL(const TDesC& aLogName, TInt aLogMode)
       
   208 	{
       
   209 	// NB we need to check if a console is already open - if so, we do NOT
       
   210 	// create another one. Ditto with file / port.
       
   211 
       
   212 	if(aLogMode & ELogToConsole)
       
   213 		{
       
   214 		if(!iConsole)
       
   215 			{
       
   216 			iConsole = CServerConsole::NewL(aLogName);
       
   217 
       
   218 			CConsoleBase* theConsole = iConsole->Console();
       
   219 			theConsole->Printf(_L("%S : Server log starting\n"), &aLogName);
       
   220 
       
   221 			iLogMode |= ELogToConsole;
       
   222 			
       
   223 			if (aLogMode & ELogConsoleFull)
       
   224 				iLogMode |= ELogConsoleFull;
       
   225 
       
   226 			iConsole->Read(*this);
       
   227 
       
   228 			}
       
   229 		}
       
   230 
       
   231 	// NB relative paths will not work with TParse (there is no file server open).
       
   232 	// Exception is a bare filename (with no path) : this will be found in root of C:
       
   233 
       
   234 	// NOTE! We have no mechanism to notify this error. The console will display
       
   235 	// and then exit. The log file cannot be opened.
       
   236 
       
   237 	// TO BE ENHANCED - if console is made active, then we can pause
       
   238 
       
   239 	if(aLogMode & ELogToFile)
       
   240 	{
       
   241 		if(!iFileLogger)
       
   242 			{
       
   243 			TRAPD(err, iFileLogger = CFileLogger::NewL());
       
   244 			if(err != KErrNone)
       
   245 				{
       
   246 				// if we can't create a logger, we panic
       
   247 				User::Panic(_L("TestFrameworkServer"), 1);
       
   248 				}
       
   249 
       
   250 			_LIT(KLogPath, "C:\\Logs\\TestResults");
       
   251 			_LIT(KDefault, "C:\\.htm"); 
       
   252 
       
   253 			TParse parseLogName;
       
   254 			parseLogName.Set(aLogName, NULL, NULL); 
       
   255 
       
   256 			TFileName logFilePath;
       
   257 			logFilePath = KLogPath;
       
   258 
       
   259 			if(parseLogName.PathPresent())
       
   260 				logFilePath.Append(parseLogName.Path());
       
   261 			else
       
   262 				logFilePath.Append(_L("\\"));
       
   263 
       
   264 
       
   265 			// overwrite extension if supplied with .htm
       
   266 			TParse logFileFullName;
       
   267 			TInt returnCode = logFileFullName.Set(KDefault, &logFilePath, &aLogName);
       
   268 			if (returnCode == KErrNone)
       
   269 				{
       
   270 				TInt ret = iFileLogger->Connect();
       
   271 				if (ret == KErrNone)
       
   272 					{
       
   273 					iFileLogger->CreateLog(logFilePath, logFileFullName.NameAndExt());
       
   274 					iLogMode |= ELogToFile;
       
   275 					}
       
   276 				}
       
   277 			}
       
   278 		}
       
   279 
       
   280 	if(aLogMode & ELogToPort)
       
   281 		{
       
   282 		// RDebug::Print will deal with the serial port, we don't do anything special here
       
   283 		iLogMode |= ELogToPort;
       
   284 		}
       
   285 	}
       
   286 
       
   287 /**
       
   288  *
       
   289  * Write to the log.
       
   290  * 
       
   291  * @param	"const TDesC& aMsg"
       
   292  *			The message string to write
       
   293  *
       
   294  * @param	"TInt aLogMode"
       
   295  *			The log mode (as bitmask of TTestFrameworkLogMode)
       
   296  *
       
   297  * @xxxx
       
   298  * 
       
   299  */
       
   300 void CTestFrameworkServer::WriteLog(const TDesC& aMsg, TInt aLogMode)
       
   301 	{
       
   302 	if(aLogMode & ELogToConsole)
       
   303 		{
       
   304 		if(iConsole)
       
   305 			{
       
   306 			CConsoleBase* theConsole = iConsole->Console();
       
   307 			theConsole->Printf(aMsg);
       
   308 			theConsole->Printf(_L("\n")); // add newline
       
   309 			}
       
   310 		}
       
   311 
       
   312 	if(aLogMode & ELogToFile)
       
   313 		{
       
   314 		if(iFileLogger)
       
   315 			{
       
   316 			iFileLogger->WriteLog(aMsg);
       
   317 			}
       
   318 		}
       
   319 
       
   320 	if(aLogMode & ELogToPort)
       
   321 		{
       
   322 		RDebug::Print(aMsg);
       
   323 		}
       
   324 	}
       
   325 
       
   326 /**
       
   327  *
       
   328  * Close the log.
       
   329  * 
       
   330  * @xxxx
       
   331  * 
       
   332  */
       
   333 void CTestFrameworkServer::CloseLog()
       
   334 	{
       
   335 	if (iFileLogger != NULL)
       
   336 		iFileLogger->CloseLog();
       
   337 	delete(iFileLogger);
       
   338 	iFileLogger = NULL;
       
   339 	delete(iConsole);
       
   340 	iConsole = NULL;
       
   341 	iLogMode = 0;
       
   342 	}
       
   343 
       
   344 /**
       
   345  *
       
   346  * Get the log status.
       
   347  *
       
   348  * @return	"TInt"
       
   349  *			The log status (as bitmask of TTestFrameworkLogMode)
       
   350  *
       
   351  * @xxxx
       
   352  * 
       
   353  */
       
   354 TInt CTestFrameworkServer::LogStatus() const
       
   355 	{
       
   356 	return iLogMode;
       
   357 	}
       
   358 
       
   359 
       
   360 /**
       
   361  *
       
   362  * process key input from console.
       
   363  *
       
   364  * @param "TKeyCode aKeystroke"
       
   365  *			The keystroke
       
   366  * 
       
   367  * @xxxx
       
   368  *
       
   369  */
       
   370 void CTestFrameworkServer::InputReceived(TKeyCode aKeystroke)
       
   371 	{
       
   372 	// store it
       
   373 	iInputKey = STATIC_CAST(TInt, aKeystroke);
       
   374 
       
   375 	// key not processed as yet - pending implementation of async request from client
       
   376 		
       
   377 	//read from console again
       
   378 	iConsole->Read(*this);
       
   379 	}
       
   380 
       
   381 /**
       
   382  *
       
   383  * Display general error.
       
   384  *
       
   385  * @param "TInt aError"
       
   386  *			The error code
       
   387  * 
       
   388  * @xxxx
       
   389  *
       
   390  */
       
   391 void CTestFrameworkServer::Error(TInt)
       
   392 	{
       
   393 	// stubbed; undefined input keys can be safely discarded
       
   394 	}
       
   395 
       
   396 /**
       
   397  *
       
   398  * Default window constructor (no owner)
       
   399  *
       
   400  * @xxxx
       
   401  * 
       
   402  */
       
   403 TWindow::TWindow()
       
   404 	{
       
   405 	iOwner = NULL;
       
   406 	}
       
   407 
       
   408 /**
       
   409  *
       
   410  * Default window constructor
       
   411  *
       
   412  * @param	"CTestFrameworkServerSession* aOwner"
       
   413  *			The window owner
       
   414  * @xxxx
       
   415  * 
       
   416  */
       
   417 TWindow::TWindow(CTestFrameworkServerSession* aOwner)
       
   418 	{
       
   419 	iOwner = aOwner;
       
   420 	}
       
   421 
       
   422 /**
       
   423  *
       
   424  * Set the window owner
       
   425  *
       
   426  * @param	"CTestFrameworkServerSession* aOwner"
       
   427  *			The window owner
       
   428  * @xxxx
       
   429  * 
       
   430  */
       
   431 void TWindow::SetOwner(CTestFrameworkServerSession* aOwner)
       
   432 	{
       
   433 	iOwner = aOwner;
       
   434 	}
       
   435 
       
   436 /**
       
   437  *
       
   438  * Set the window rectangle, and notify owner
       
   439  *
       
   440  * @param	"const TRect& aWinRect"
       
   441  *			The window rectangle
       
   442  * @xxxx
       
   443  * 
       
   444  */
       
   445 void TWindow::SetWinRectAndNotifyOwner(const TRect& aWinRect)
       
   446 	{
       
   447 	if (HasOwner())
       
   448 		iOwner->NotifyWindowChanged(aWinRect);
       
   449 	}
       
   450 
       
   451 /**
       
   452  *
       
   453  * Does this window have an owner?
       
   454  *
       
   455  * @return	"TBool"
       
   456  *			ETrue if window has an owner
       
   457  * @xxxx
       
   458  * 
       
   459  */
       
   460 TBool TWindow::HasOwner()
       
   461 	{
       
   462 	if (iOwner)
       
   463 		return ETrue;
       
   464 	return EFalse;
       
   465 	}
       
   466 
       
   467 /**
       
   468  *
       
   469  * Server session first-phase constructor
       
   470  *
       
   471  * @xxxx
       
   472  * 
       
   473  */
       
   474 CTestFrameworkServerSession::CTestFrameworkServerSession()
       
   475 	{
       
   476 	}
       
   477 
       
   478 /**
       
   479  *
       
   480  * Create a server session.
       
   481  *
       
   482  * @param "aServer"
       
   483  *			The server to add this session to
       
   484  *
       
   485  * @xxxx
       
   486  * 
       
   487  */
       
   488 void CTestFrameworkServerSession::CreateL(const CMmfIpcServer& aServer)
       
   489 	{
       
   490 	CMmfIpcSession::CreateL(aServer);	// does not leave
       
   491 	//Add session to server first. If anything leaves, it will be removed by the destructor
       
   492 	iServer = STATIC_CAST(CTestFrameworkServer*, (CONST_CAST(CMmfIpcServer*, &aServer)));
       
   493 	iServer->AddSession();
       
   494 	ConstructL();
       
   495 	}
       
   496 
       
   497 /**
       
   498  *
       
   499  * Server session second-phase constructor
       
   500  *
       
   501  * @xxxx
       
   502  * 
       
   503  */
       
   504 void CTestFrameworkServerSession::ConstructL()
       
   505 	{
       
   506 	}
       
   507 
       
   508 /**
       
   509  *
       
   510  * Server session destructor
       
   511  *
       
   512  * @xxxx
       
   513  * 
       
   514  */
       
   515 CTestFrameworkServerSession::~CTestFrameworkServerSession()
       
   516 	{
       
   517 	iServer->RemoveWindow(this);
       
   518 	iServer->DropSession();
       
   519 	}
       
   520 
       
   521 /**
       
   522  *
       
   523  * Server session service function
       
   524  *
       
   525  * @param "aMessage"
       
   526  *			The message to be serviced.
       
   527  *
       
   528  * @xxxx
       
   529  * 
       
   530  */
       
   531 void CTestFrameworkServerSession::ServiceL(const RMmfIpcMessage& aMessage)
       
   532 	{
       
   533 	switch (aMessage.Function())
       
   534 		{
       
   535 	case ECreateInputWindow:
       
   536 		SetOwnCopyOfWindowMessageL(aMessage);
       
   537 		iServer->AddInputWindowL(this);
       
   538 		break;
       
   539 	case ENotifyIfWindowChange:
       
   540 		SetOwnCopyOfWindowMessageL(aMessage);
       
   541 		break;
       
   542 	case ECancelNotifyIfWindowChange:
       
   543 		CompleteOwnCopyOfWindowMessage(KErrCancel);
       
   544 		aMessage.Complete(KErrNone);
       
   545 		break;
       
   546 
       
   547 	// logging messages
       
   548 
       
   549 	case EOpenLog:
       
   550 		{
       
   551 		TBuf<KMaxLogFilenameLength> msgBuf;
       
   552 
       
   553 		TInt r = MmfMessageUtilX::Read(aMessage, 0, msgBuf);
       
   554 		if (r != KErrNone)
       
   555 			RunError(aMessage, r);
       
   556 		else
       
   557 			{
       
   558 			iServer->OpenLogL(msgBuf, aMessage.Int1());
       
   559 			aMessage.Complete(KErrNone);
       
   560 			}
       
   561 		}
       
   562 		break;
       
   563 
       
   564 	case EWriteLog:
       
   565 		{
       
   566 		TBuf<KMaxLogLineLength> msgBuf;
       
   567 
       
   568 		TInt r = MmfMessageUtilX::Read(aMessage, 0, msgBuf);
       
   569 
       
   570 		if (r != KErrNone)
       
   571 			RunError(aMessage, r);
       
   572 		else
       
   573 			{
       
   574 			iServer->WriteLog(msgBuf, aMessage.Int1());
       
   575 			aMessage.Complete(KErrNone);
       
   576 			}
       
   577 		}
       
   578 		break;
       
   579 
       
   580 	case ECloseLog:
       
   581 		iServer->CloseLog();
       
   582 		aMessage.Complete(KErrNone);
       
   583 		break;
       
   584 
       
   585 	case ELogStatus:
       
   586 		{
       
   587 		TPckgBuf<TInt> countPckg(iServer->LogStatus());
       
   588 		TInt r = MmfMessageUtilX::Write(aMessage, 0, countPckg);
       
   589 		if (r != KErrNone)
       
   590 			RunError(aMessage, r);
       
   591 		else
       
   592 			aMessage.Complete(KErrNone);
       
   593 		}
       
   594 		break;
       
   595 
       
   596 	default:
       
   597 		// ? should panic here
       
   598 		break;
       
   599 		}
       
   600 	}
       
   601 
       
   602 /**
       
   603  *
       
   604  * Error handler for server session.
       
   605  * Completes the pending message using the error code
       
   606  *
       
   607  * @param	"TInt aError"
       
   608  *			The error code
       
   609  *
       
   610  * @return	"TInt"
       
   611  *			The error code (always KErrNone)
       
   612  *
       
   613  * @xxxx
       
   614  *
       
   615  */
       
   616  TInt CTestFrameworkServerSession::RunError(const RMmfIpcMessage& aMessage, TInt aError)
       
   617 	{
       
   618 	aMessage.Complete(aError);
       
   619 	return KErrNone;
       
   620 	}
       
   621 
       
   622 /**
       
   623  *
       
   624  * Set own copy of message.
       
   625  * Helper function to enable window change notification.
       
   626  *
       
   627  * @param "aMessage"
       
   628  *			The message to be serviced.
       
   629  *
       
   630  * @xxxx
       
   631  *
       
   632  */
       
   633  void CTestFrameworkServerSession::SetOwnCopyOfWindowMessageL(const RMmfIpcMessage& aMessage)
       
   634 	{
       
   635 	if (iCanCompleteWindowMessage)
       
   636 		User::Leave(KErrAlreadyExists);
       
   637 	//else
       
   638 	iWindowMessage = aMessage;
       
   639 	iCanCompleteWindowMessage = ETrue;
       
   640 	
       
   641 	if (iNeedToNotifyClientOfWindowSizeChange)
       
   642 		{
       
   643 		TInt err = MmfMessageUtil::Write(iWindowMessage, 0, iWinRectBuf);
       
   644 		CompleteOwnCopyOfWindowMessage(err);
       
   645 		iNeedToNotifyClientOfWindowSizeChange = EFalse;
       
   646 		}
       
   647 	}
       
   648 
       
   649 /**
       
   650  *
       
   651  * Complete own copy of message.
       
   652  * Helper function to enable window change notification.
       
   653  *
       
   654  * @param "TInt aReason"
       
   655  *			The message return code.
       
   656  *
       
   657  * @xxxx
       
   658  *
       
   659  */
       
   660  void CTestFrameworkServerSession::CompleteOwnCopyOfWindowMessage(TInt aReason)
       
   661 	{
       
   662 	if (iCanCompleteWindowMessage)
       
   663 		iWindowMessage.Complete(aReason);
       
   664 	iCanCompleteWindowMessage = EFalse;
       
   665 	}
       
   666 
       
   667 /**
       
   668  *
       
   669  * Window change notification.
       
   670  *
       
   671  * @param "const TRect& aWinRect"
       
   672  *			The window rectangle.
       
   673  *
       
   674  * @xxxx
       
   675  *
       
   676  */
       
   677 void CTestFrameworkServerSession::NotifyWindowChanged(const TRect& aWinRect)
       
   678 	{
       
   679 	iWinRectBuf() = aWinRect;
       
   680 
       
   681 	if (iCanCompleteWindowMessage)
       
   682 		{
       
   683 		TInt err = MmfMessageUtilX::Write(iWindowMessage, 0, iWinRectBuf);
       
   684 		CompleteOwnCopyOfWindowMessage(err);
       
   685 		}
       
   686 	else
       
   687 		{
       
   688 		iNeedToNotifyClientOfWindowSizeChange = ETrue;
       
   689 		}
       
   690 	}
       
   691 
       
   692 // EXE/DLL initialisation
       
   693 
       
   694 // NOTE! None of this should be built when compiling for Unit Testing
       
   695 #if !defined (__TSU_TESTFRAMEWORK__)
       
   696 
       
   697 
       
   698 /**
       
   699  *
       
   700  * Perform all server initialisation, in particular creation of the
       
   701  * scheduler and server; then run the scheduler
       
   702  *
       
   703  *
       
   704  * @xxxx
       
   705  *
       
   706  */
       
   707 static void RunServerL()
       
   708 	{
       
   709 	// create and install the active scheduler we need
       
   710 	CActiveScheduler* s = new(ELeave) CActiveScheduler;
       
   711 	CleanupStack::PushL(s);
       
   712 	CActiveScheduler::Install(s);
       
   713 	//
       
   714 	// create the server (leave it on the cleanup stack)
       
   715 	CleanupStack::PushL(CTestFrameworkServer::NewL());
       
   716 	//
       
   717 	// Initialisation complete, now signal the client
       
   718 	RProcess::Rendezvous(KErrNone);
       
   719 
       
   720 	//
       
   721 	// Ready to run
       
   722 	CActiveScheduler::Start();
       
   723 	//
       
   724 	// Cleanup the server and scheduler
       
   725 	CleanupStack::PopAndDestroy(2);
       
   726 	}
       
   727 
       
   728 /**
       
   729  *
       
   730  * Main entry point for the server thread
       
   731  *
       
   732  * @param "TTestFrameworkServerStart& aStart"
       
   733  *			The server starter.
       
   734  *
       
   735  * @xxxx
       
   736  *
       
   737  */
       
   738 static TInt RunServer()
       
   739 	{
       
   740 	__UHEAP_MARK;
       
   741 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
   742 	TInt r = KErrNoMemory;
       
   743 	if (cleanup)
       
   744 		{
       
   745 		TRAP(r, RunServerL());
       
   746 		delete cleanup;
       
   747 		}
       
   748 	//
       
   749 	__UHEAP_MARKEND;
       
   750 	return r;
       
   751 	}
       
   752 
       
   753 
       
   754 GLDEF_C TInt E32Main()
       
   755 
       
   756 // Server process entry-point
       
   757 // Recover the startup parameters and run the server
       
   758 
       
   759 	{
       
   760 	TInt r = RunServer();
       
   761 	return r;
       
   762 	}
       
   763 
       
   764 
       
   765 #endif // __TSU_TESTFRAMEWORK__