serialserver/c32serialserver/Test/TE_C32/TE_c32server.cpp
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2003-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 "TE_c32server.h"
       
    17 #include "TE_c32.h"
       
    18 
       
    19 _LIT(KServerName,"TE_C32");
       
    20 
       
    21 CC32TestServer* CC32TestServer::NewL()
       
    22 /**
       
    23  * @return - Instance of the test server
       
    24  * Called inside the MainL() function to create and start the
       
    25  * CTestServer derived server.
       
    26  */
       
    27 	{
       
    28 	CC32TestServer * server = new (ELeave) CC32TestServer();
       
    29 	CleanupStack::PushL(server);
       
    30 	// CServer base class call
       
    31 	server->StartL(KServerName);
       
    32 	CleanupStack::Pop(server);
       
    33 	return server;
       
    34 	}
       
    35 
       
    36 LOCAL_C void MainL()
       
    37 /**
       
    38  * Much simpler, uses the new Rendezvous() call to sync with the client
       
    39  */
       
    40 	{
       
    41 	CActiveScheduler* sched=NULL;
       
    42 	sched=new(ELeave) CActiveScheduler;
       
    43 	CActiveScheduler::Install(sched);
       
    44 	CC32TestServer* server = NULL;
       
    45 	// Create the CTestServer derived server
       
    46 	TRAPD(err,server = CC32TestServer::NewL());
       
    47 	if(!err)
       
    48 		{
       
    49 		// Sync with the client and enter the active scheduler
       
    50 		RProcess::Rendezvous(KErrNone);
       
    51 		sched->Start();
       
    52 		}
       
    53 	delete server;
       
    54 	delete sched;
       
    55 	}
       
    56 
       
    57 GLDEF_C TInt E32Main()
       
    58 /**
       
    59  * @return - Standard Epoc error code on exit
       
    60  */
       
    61 	{
       
    62 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    63 	if(cleanup == NULL)
       
    64 		{
       
    65 		return KErrNoMemory;
       
    66 		}
       
    67 	TRAPD(err,MainL());
       
    68 	delete cleanup;
       
    69 	return err;
       
    70     }
       
    71 
       
    72 CTestStep* CC32TestServer::CreateTestStep(const TDesC& aStepName)
       
    73 /**
       
    74  * @return - A CTestStep derived instance
       
    75  * Implementation of CTestServer pure virtual
       
    76  */
       
    77 	{
       
    78 	CTestStep*  testStep = NULL;
       
    79 
       
    80 	//
       
    81 	// Here the test step is created when it is needed. Note that this
       
    82 	// function is non-leaving so we cannot use new(ELeave). Therefore
       
    83 	// the new could return NULL, but that is not a problem as it implies
       
    84 	// the test step is missing and this will be marked in the log file.
       
    85 	//
       
    86 
       
    87 	// Loopback test
       
    88 	if(aStepName == _L("TestLoopback"))
       
    89 		{
       
    90 		testStep = new CTestLoopback;
       
    91 		}
       
    92 				
       
    93 	// Old TCOMM tests
       
    94 	
       
    95 	if(aStepName == _L("TestInit"))
       
    96 		{
       
    97 		testStep = new CTestInit;
       
    98 		}
       
    99 
       
   100 	if(aStepName == _L("TestDoubleStart"))
       
   101 		{
       
   102 		testStep = new CTestDoubleStart;
       
   103 		}
       
   104 
       
   105 	if(aStepName == _L("TestOpen"))
       
   106 		{
       
   107 		testStep = new CTestOpen;
       
   108 		}
       
   109 
       
   110 	if(aStepName == _L("TestInfo"))
       
   111 		{
       
   112 		testStep = new CTestInfo;
       
   113 		}
       
   114 
       
   115 	if(aStepName == _L("TestDoubleRead"))
       
   116 		{
       
   117 		testStep = new CTestDoubleRead;	
       
   118 		}
       
   119 			
       
   120 	if(aStepName == _L("TestConfigPanic"))
       
   121 		{
       
   122 		testStep = new CTestConfigPanic;			
       
   123 		}
       
   124 			
       
   125 	if(aStepName == _L("TestBadDescriptorPanic"))
       
   126 		{
       
   127 		testStep = new CTestBadDescriptorPanic;			
       
   128 		}
       
   129 
       
   130 	if(aStepName == _L("TestBusyReturn"))
       
   131 		{
       
   132 		testStep = new CTestBusyReturn;						
       
   133 		}
       
   134 
       
   135 	if(aStepName == _L("TestCancel"))
       
   136 		{
       
   137 		testStep = new CTestCancel;						
       
   138 		}
       
   139 
       
   140 	if(aStepName == _L("TestGetSetConfig"))
       
   141 		{
       
   142 		testStep = new CTestGetSetConfig;					
       
   143 		}
       
   144 
       
   145 	if(aStepName == _L("TestTimeOut"))
       
   146 		{
       
   147 		testStep = new CTestTimeOut;				
       
   148 		}
       
   149 
       
   150 	if(aStepName == _L("TestThreadPanic"))
       
   151 		{
       
   152 		testStep = new CTestThreadPanic;				
       
   153 		}
       
   154 
       
   155 	if(aStepName == _L("TestBufferOptions"))
       
   156 		{
       
   157 		testStep = new CTestBufferOptions;				
       
   158 		}
       
   159 
       
   160 	if(aStepName == _L("TestOOMConnection"))
       
   161 		{
       
   162 		testStep = new CTestOOMConnection;							
       
   163 		}
       
   164 			
       
   165 	if(aStepName == _L("TestOOMPortCreation"))
       
   166 		{
       
   167 		testStep = new CTestOOMPortCreation	;
       
   168 		}
       
   169 
       
   170 	if(aStepName == _L("TestSetSignalsPanicBug"))
       
   171 		{
       
   172 		testStep = new CTestSetSignalsPanicBug;			
       
   173 		}
       
   174 
       
   175 	if(aStepName == _L("TestStartServerThread"))
       
   176 		{
       
   177 		testStep = new CTestStartServerThread;						
       
   178 		}
       
   179 						
       
   180 	if(aStepName == _L("TestCapsV02"))
       
   181 		{
       
   182 		testStep = new CTestCapsV02;						
       
   183 		}
       
   184 
       
   185 	if(aStepName == _L("TestOpenPortsWithHighNumbers"))
       
   186 		{
       
   187 		testStep = new CTestOpenPortsWithHighNumbers;									
       
   188 		}
       
   189 
       
   190 	if(aStepName == _L("TestTimerAllocation"))
       
   191 		{
       
   192 		testStep = new CTestTimerAllocation;									
       
   193 		}
       
   194 
       
   195 	if(aStepName == _L("TestReadWrite"))
       
   196 		{
       
   197 		testStep = new CTestReadWrite;									
       
   198 		}
       
   199 
       
   200 	if(aStepName == _L("TestReadWrite2"))
       
   201 		{
       
   202 		testStep = new CTestReadWrite2;									
       
   203 		}
       
   204 
       
   205 	if(aStepName == _L("TestSignalLines"))
       
   206 		{
       
   207 		testStep = new CTestSignalLines	;
       
   208 		}
       
   209 
       
   210 	if(aStepName == _L("TestQueryreceiveBuffer"))
       
   211 		{
       
   212 		testStep = new CTestQueryreceiveBuffer;
       
   213 		}
       
   214 
       
   215 	if(aStepName == _L("TestWrite0"))
       
   216 		{
       
   217 		testStep = new CTestWrite0;			
       
   218 		}
       
   219 			
       
   220 	if(aStepName == _L("TestReadOneOrMore"))
       
   221 		{
       
   222 		testStep = new CTestReadOneOrMore;		
       
   223 		}
       
   224 
       
   225 	if(aStepName == _L("TestBufferReadWrite"))
       
   226 		{
       
   227 		testStep = new CTestBufferReadWrite;					
       
   228 		}
       
   229 
       
   230 	if(aStepName == _L("TestBufferreadOneOrMore"))
       
   231 		{
       
   232 		testStep = new CTestBufferreadOneOrMore;	
       
   233 		}
       
   234 
       
   235 	if(aStepName == _L("TestNotifySignals"))
       
   236 		{
       
   237 		testStep = new CTestNotifySignals;	
       
   238 		}
       
   239 
       
   240 	if(aStepName == _L("TestRxDataAvailable"))
       
   241 		{
       
   242 		testStep = new CTestRxDataAvailable;	
       
   243 		}
       
   244 
       
   245 	if(aStepName == _L("TestHelloEllo"))
       
   246 		{
       
   247 		testStep = new CTestHelloEllo;
       
   248 		}
       
   249 
       
   250 	// Old T_LSC32 tests
       
   251 
       
   252 	if(aStepName == _L("Lsc32ListAvailablePorts"))
       
   253 		{
       
   254 		testStep = new CLsc32ListAvailablePorts;
       
   255 		}
       
   256 
       
   257 	if(aStepName == _L("Lsc32ListNumberOfLoadedCSYs"))
       
   258 		{
       
   259 		testStep = new CLsc32ListNumberOfLoadedCSYs;			
       
   260 		}
       
   261 			
       
   262 	if(aStepName == _L("Lsc32LoadUnloadCsy"))
       
   263 		{
       
   264 		testStep = new CLsc32LoadUnloadCsy;			
       
   265 		}
       
   266 			
       
   267 	if(aStepName == _L("Lsc32GetPortInfo"))
       
   268 		{
       
   269 		testStep = new CLsc32GetPortInfo;			
       
   270 		}
       
   271 			
       
   272 	// Old TDUMMY tests
       
   273 	
       
   274 	if(aStepName == _L("DummyTest"))
       
   275 		{
       
   276 		testStep = new CDummyTest;	
       
   277 		}
       
   278 			
       
   279 	// Old TCOMMNEW tests
       
   280 	
       
   281 	if(aStepName == _L("TestDCEPort"))
       
   282 		{
       
   283 		testStep = new CTestDCEPort;						
       
   284 		}
       
   285 		
       
   286 	if(aStepName == _L("TestPlatSecOpenPortDummy"))
       
   287 		{
       
   288 		testStep = new CTestPlatSecOpenPortDummy;						
       
   289 		}
       
   290 
       
   291 	if(aStepName == _L("TestAllocMoreWriteMem"))
       
   292 		{
       
   293 		testStep = new CTestAllocMoreWriteMem;
       
   294 		}
       
   295 		
       
   296 	if(aStepName == _L("TestMemoryWriteFail"))
       
   297 		{
       
   298 		testStep = new CTestMemoryWriteFail;
       
   299 		}
       
   300 		
       
   301 	if(aStepName == _L("TestResetBuffers"))
       
   302 		{
       
   303 		testStep = new CTestResetBuffers;
       
   304 		}
       
   305 	
       
   306 	if(aStepName == _L("TestCorrectDataRead"))
       
   307 		{
       
   308 		testStep = new CTestCorrectDataRead;
       
   309 		}
       
   310 				
       
   311 	if(aStepName == _L("TestMaxBufferOverflow"))
       
   312 		{
       
   313 		testStep = new CTestMaxBufferOverflow;
       
   314 		}
       
   315 	if(aStepName == _L("TestOpenWhenAvailable"))
       
   316 		{
       
   317 		testStep = new CTestOpenWhenAvailable;			
       
   318 		}
       
   319 	
       
   320 //PREQ 890
       
   321 //Test Case No NET-C32-I-001-HP
       
   322    if(aStepName == _L("TestLoadDealerCSY"))
       
   323 		{
       
   324 		testStep = new CTestLoadDealerCSY;						
       
   325 		}
       
   326 //Test Case No NET-C32-I-002-HP
       
   327 	if(aStepName == _L("TestLoadPlayerCSY"))
       
   328 		{
       
   329 		testStep = new CTestLoadPlayerCSY;						
       
   330 		}
       
   331 //Test Case No NET-C32-I-003-HP
       
   332 	if(aStepName == _L("TestLoadCSYthread"))
       
   333 		{
       
   334 		testStep = new CTestLoadCSYthread;						
       
   335 		}		
       
   336   		
       
   337  //Test Case No NET-C32-I-004-HP
       
   338  if(aStepName == _L("TestLoadMoreCSY"))
       
   339 		{
       
   340 		testStep = new CTestLoadMoreCSY;						
       
   341 		}
       
   342 			
       
   343 //Test Case No NET-C32-I-005-HP
       
   344  if(aStepName == _L("TestApiCallCSY"))
       
   345 		{
       
   346 		testStep = new CTestApiCallCSY;						
       
   347 		}
       
   348 		
       
   349 //Test Case No NET-C32-I-006-HP
       
   350 if(aStepName == _L("TestLoadUnknownCSY"))
       
   351 		{
       
   352 		testStep = new CTestLoadUnknownCSY;						
       
   353 		}
       
   354 
       
   355 //Test case No NET-C32-I-007-HP		
       
   356  if(aStepName == _L("TestMissingRoleParmCMI"))
       
   357 		{
       
   358 		testStep = new CTestMissingRoleParmCMI;						
       
   359 		}	
       
   360 
       
   361 //Test case No NET-C32-I-008-HP
       
   362 	if(aStepName == _L("TestMissingWorkerIDParm"))
       
   363 		{
       
   364 		testStep = new CTestMissingWorkerIDParm;						
       
   365 		}	
       
   366 //Test case No NET-C32-I-009-HP		
       
   367  if(aStepName == _L("TestLoadUnLoadCsySameOrder"))
       
   368 		{
       
   369 		testStep = new CTestLoadUnLoadCsySameOrder;						
       
   370 		}	
       
   371 		
       
   372 //Test case No NET-C32-I-0010-HP		
       
   373  if(aStepName == _L("TestLoadUnLoadCsyDiffOrder"))
       
   374 		{
       
   375 		testStep = new CTestLoadUnLoadCsyDiffOrder;						
       
   376 		}
       
   377 			
       
   378 //Test case No NET-C32-I-0011-HP		
       
   379  if(aStepName == _L("SendDatainDealerThr"))
       
   380 		{
       
   381 		testStep = new CSendDatainDealerThr;						
       
   382 		}
       
   383 					
       
   384 //Test case No NET-C32-I-0012-HP		
       
   385  if(aStepName == _L("SendDatainPlayerThr"))
       
   386 		{
       
   387 		testStep = new CSendDatainPlayerThr;						
       
   388 		}
       
   389 			
       
   390  //Test case No NET-C32-I-0013-HP		
       
   391  if(aStepName == _L("TestGetPortInfo"))
       
   392 		{
       
   393 		testStep = new CTestGetPortInfo;						
       
   394 		}
       
   395 			
       
   396  //Test case No NET-C32-I-0014-HP							
       
   397 if(aStepName == _L("LoadingCsydiffSession"))
       
   398 		{
       
   399 		testStep = new CLoadingCsydiffSession;						
       
   400 		}
       
   401 								
       
   402 //Test case No NET-C32-I-0015-HP	
       
   403 if(aStepName == _L("LoadingSameCsydiffSession"))
       
   404 		{
       
   405 		testStep = new CLoadingSameCsydiffSession;						
       
   406 		}
       
   407 		
       
   408 //Test case No NET-C32-I-0016-HP		
       
   409 if(aStepName == _L("NumPortsdiffSession"))
       
   410 		{
       
   411 		testStep = new CNumPortsdiffSession;						
       
   412 		}
       
   413 		
       
   414 //Test case No NET-C32-I-0017-HP		
       
   415 if(aStepName == _L("DataReadDealerPlayer"))
       
   416 		{
       
   417 		testStep = new CDataReadDealerPlayer;						
       
   418 		}
       
   419 		
       
   420 //Test case No NET-C32-I-0019-HP
       
   421 if(aStepName == _L("TestStackableCSY"))
       
   422 		{
       
   423 		testStep = new CTestStackableCSY;						
       
   424 		}
       
   425 
       
   426 //Test case No NET-C32-I-0020-HP
       
   427 if(aStepName == _L("LoadCsywithOldCMI"))
       
   428 		{
       
   429 		testStep = new CLoadCsywithOldCMI;						
       
   430 		}
       
   431 //Test case No NET-C32-I-0021-HP		
       
   432 if(aStepName == _L("OldandNewCMIfiles"))
       
   433 		{
       
   434 		testStep = new COldandNewCMIfiles;						
       
   435 		}	
       
   436 //Test case No NET-C32-I-0022-HP				
       
   437 if(aStepName == _L("LoadCsyPlayerThread"))
       
   438 		{
       
   439 		testStep = new CLoadCsyPlayerThread;						
       
   440 		}	
       
   441 //Test case No NET-C32-I-0023-HP
       
   442 if(aStepName == _L("LoadCsyDealerPlayerThreads"))
       
   443 		{
       
   444 		testStep = new CLoadCsyDealerPlayerThreads;						
       
   445 		}
       
   446 //Test case No NET-C32-I-0024-HP			
       
   447 if(aStepName == _L("LoadandUnloadDiffSession"))
       
   448 		{
       
   449 		testStep = new CLoadandUnloadDiffSession;						
       
   450 		}
       
   451 //Test case No NET-C32-I-0025-HP		
       
   452 if(aStepName == _L("MissingCsyListinCMI"))
       
   453 		{
       
   454 		testStep = new CMissingCsyListinCMI;						
       
   455 		}
       
   456 				
       
   457 //Test case No NET-C32-I-0026-HP
       
   458 if(aStepName == _L("AllCMIFileRolePlayer"))
       
   459 		{
       
   460 		testStep = new CAllCMIFileRolePlayer;						
       
   461 		}
       
   462 		
       
   463 //Test case No NET-C32-I-0027-HP
       
   464 if(aStepName == _L("TwoCMIfileSetWildcard"))
       
   465 		{
       
   466 		testStep = new CTwoCMIfileSetWildcard;						
       
   467 		}
       
   468 //Test case No NET-C32-I-0028-HP		
       
   469 if(aStepName == _L("NoCMIfileSetWildcard"))
       
   470 		{
       
   471 		testStep = new CNoCMIfileSetWildcard;						
       
   472 		}
       
   473 //Test case No NET-C32-I-0029-HP			
       
   474 if(aStepName == _L("TwoCMIsameWorkerID"))
       
   475 		{
       
   476 		testStep = new CTwoCMIsameWorkerID;						
       
   477 		}
       
   478 //Test case No NET-C32-I-0030-HP			
       
   479 if(aStepName == _L("TwoNewCMIfileRoleDealer"))
       
   480 		{
       
   481 		testStep = new CTwoNewCMIfileRoleDealer;						
       
   482 		}
       
   483 //Test case No NET-C32-I-0031-HP			
       
   484 if(aStepName == _L("OldNewCMIfileRoleDealer"))
       
   485 		{
       
   486 		testStep = new COldNewCMIfileRoleDealer;						
       
   487 		}		
       
   488 							
       
   489  //Test case No NET-C32-I-0034-HP			
       
   490 if(aStepName == _L("LoadCsyAllPlayerThread"))
       
   491 		{
       
   492 		testStep = new CLoadCsyAllPlayerThread;						
       
   493 		}	
       
   494 		
       
   495  //Test case No NET-C32-I-0035-HP			
       
   496 if(aStepName == _L("GetPortInfo"))
       
   497 		{
       
   498 		testStep = new CGetPortInfo;						
       
   499 		}			
       
   500 //Test case No NET-C32-I-0032-HP		
       
   501 if(aStepName == _L("TestBlockCSY"))
       
   502 		{
       
   503 		testStep = new CTestBlockCSY;						
       
   504 		}			
       
   505 //Test case No NET-C32-I-0033-HP	
       
   506 if(aStepName == _L("TestCorruptCsy"))
       
   507 		{
       
   508 		testStep = new CTestCorruptCsy;						
       
   509 		}	
       
   510 	
       
   511 if(aStepName == _L("GetPortInfoByName"))
       
   512 		{
       
   513 		testStep = new CGetPortInfoByName;						
       
   514 		}
       
   515 //Test case No NET-C32-I-0036-HP					
       
   516 if(aStepName == _L("UnSequentialWorkerID"))
       
   517 		{
       
   518 		testStep = new CUnSequentialWorkerID;						
       
   519 		}
       
   520  //Test case No NET-C32-I-0037-HP					
       
   521 if(aStepName == _L("TestLoadUnknownCPM"))
       
   522 		{
       
   523 		testStep = new CTestLoadUnknownCPM;						
       
   524 		}
       
   525 
       
   526  //Test case No NET-C32-I-0038-HP					
       
   527 if(aStepName == _L("TestLongPortName"))
       
   528 		{
       
   529 		testStep = new CTestLongPortName;						
       
   530 		}
       
   531 			
       
   532 //Test case No NET-C32-I-0039-HP					
       
   533 if(aStepName == _L("TestStackableCSYNoClose"))
       
   534 		{
       
   535 		testStep = new CTestStackableCSYNoClose;						
       
   536 		}		
       
   537 
       
   538 																											
       
   539    	//
       
   540 	// Set the test step name here to save code!!!
       
   541 	//
       
   542 	if (testStep != NULL)
       
   543 		{
       
   544 		testStep->SetTestStepName(aStepName);
       
   545 		}
       
   546 
       
   547 	return testStep;
       
   548 	}
       
   549 	
       
   550 	
       
   551