datacommsserver/esockserver/test/TE_Socket/SocketTestSection1.cpp
changeset 79 cf589eb1e31e
parent 65 41cc8e7ff496
equal deleted inserted replaced
75:a365cb779476 79:cf589eb1e31e
   311 
   311 
   312 enum TVerdict CSocketTest1_7::InternalDoTestStepL( void )
   312 enum TVerdict CSocketTest1_7::InternalDoTestStepL( void )
   313 	{
   313 	{
   314 	TVerdict verdict = EPass;
   314 	TVerdict verdict = EPass;
   315 
   315 
   316 	TInt numExhaustiveSockets = iNormalTest ? KNumExhaustiveSockets : 10;
   316 	TInt numExhaustiveSockets = iNormalTest ? KNumExhaustiveSockets : 10;	
   317 	iNormalTest = EFalse; // normal test is only run once, the rest are OOM tests
   317 	iNormalTest = EFalse; // normal test is only run once, the rest are OOM tests
   318 
   318 
   319 	Logger().WriteFormat(_L("Test Purpose: Exhaustive Socket Open"));
   319 	Logger().WriteFormat(_L("Test Purpose: Exhaustive Socket Open"));
   320 
   320 
   321 	// connect to esock
   321 	// connect to esock
   389 	// Not sure what use it is to test whether we can open at least as many sockets as previously.
   389 	// Not sure what use it is to test whether we can open at least as many sockets as previously.
   390 	// We can't assume that once we've freed all the sockets first time around that the ESock heap will
   390 	// We can't assume that once we've freed all the sockets first time around that the ESock heap will
   391 	// go back exactly to where it was before - this makes assumptions about the ESock algorithms.  Why
   391 	// go back exactly to where it was before - this makes assumptions about the ESock algorithms.  Why
   392 	// wouldn't ESock legitimately cache objects, for example?
   392 	// wouldn't ESock legitimately cache objects, for example?
   393 	//TESTL(sockNum >= sockCount1);
   393 	//TESTL(sockNum >= sockCount1);
       
   394 	TESTL(sockNum >= sockCount1);
       
   395 
       
   396 	Logger().WriteFormat(_L("Freeing sockets in creation order"));
       
   397 	for (i=0; i<sockNum; i++)
       
   398 		{
       
   399 		socks[i].Close();
       
   400 		}
   394 
   401 
   395 	//
   402 	//
   396 	// NOTE:
   403 	// NOTE:
   397 	// We do *not* free up the sockets but just close the session.  This is to exercise the subsession
   404 	// We do *not* free up the sockets but just close the session.  This is to exercise the subsession
   398 	// cleanup behaviour in ESock with a large number of sockets.  We test that this cleanup operation
   405 	// cleanup behaviour in ESock with a large number of sockets.  We test that this cleanup operation
   402 #endif	// (_DEBUG) }
   409 #endif	// (_DEBUG) }
   403 
   410 
   404 	CleanupStack::PopAndDestroy(socks);
   411 	CleanupStack::PopAndDestroy(socks);
   405 
   412 
   406 	CleanupStack::Pop(&ss);
   413 	CleanupStack::Pop(&ss);
       
   414 	Logger().WriteFormat(_L("Now closing socket server session without closing %d opened sockets"), sockNum);
   407 	ss.Close();
   415 	ss.Close();
   408 	SetTestStepResult(verdict);
   416 	SetTestStepResult(verdict);
   409 	return verdict;
   417 	return verdict;
   410 	}
   418 	}
   411 
   419