egl/egltest/src/egltestcommonstep.cpp
changeset 36 01a6848ebfd7
parent 0 5d03bc08d59c
child 160 969102054596
equal deleted inserted replaced
0:5d03bc08d59c 36:01a6848ebfd7
   292 
   292 
   293     // create MsgQueue (only used in some test to pass data between 2 processes)
   293     // create MsgQueue (only used in some test to pass data between 2 processes)
   294 	RMsgQueue<TSgDrawableId> messageQueueSgId;
   294 	RMsgQueue<TSgDrawableId> messageQueueSgId;
   295 	TInt ret = messageQueueSgId.CreateGlobal(KNullDesC, 1, EOwnerProcess);
   295 	TInt ret = messageQueueSgId.CreateGlobal(KNullDesC, 1, EOwnerProcess);
   296 	ASSERT_EQUALS(ret, KErrNone);
   296 	ASSERT_EQUALS(ret, KErrNone);
       
   297 	CleanupClosePushL(messageQueueSgId);
   297 
   298 
   298 	RMsgQueue<TProcessId> messageQueueProcId;
   299 	RMsgQueue<TProcessId> messageQueueProcId;
   299 	ret = messageQueueProcId.CreateGlobal(KNullDesC, 1, EOwnerProcess);
   300 	ret = messageQueueProcId.CreateGlobal(KNullDesC, 1, EOwnerProcess);
   300 	ASSERT_EQUALS(ret, KErrNone);
   301 	ASSERT_EQUALS(ret, KErrNone);
       
   302 	CleanupClosePushL(messageQueueProcId);
   301 
   303 
   302     // Create semphores that can be shared (only used in some test to synch between 2 process)
   304     // Create semphores that can be shared (only used in some test to synch between 2 process)
   303     ret = iSemaphore[0].CreateGlobal(KNullDesC(), 0, EOwnerProcess);
   305     ret = iSemaphore[0].CreateGlobal(KNullDesC(), 0, EOwnerProcess);
   304     ASSERT_EQUALS(ret, KErrNone);
   306     ASSERT_EQUALS(ret, KErrNone);
   305     ret = iSemaphore[1].CreateGlobal(KNullDesC(), 0, EOwnerProcess);
   307     ret = iSemaphore[1].CreateGlobal(KNullDesC(), 0, EOwnerProcess);
   306     ASSERT_EQUALS(ret, KErrNone);
   308     ASSERT_EQUALS(ret, KErrNone);
   307 
   309 
       
   310     // create MsgQueue (only used in some tests to pass data from client processes to the main process)
       
   311     RMsgQueue<TEglStepMessageBuffer> messageQueueClientProcParam;
       
   312     ret = messageQueueClientProcParam.CreateGlobal(KNullDesC, 1, EOwnerProcess);
       
   313     ASSERT_EQUALS(ret, KErrNone);
       
   314     CleanupClosePushL(messageQueueClientProcParam);
       
   315     
   308 	for (TInt i=0; i<aProcessCount; i++)
   316 	for (TInt i=0; i<aProcessCount; i++)
   309 		{
   317 		{
   310 		TProcessInfo info;
   318 		TProcessInfo info;
   311 		info.iIdx=i;
   319 		info.iIdx=i;
   312 		info.iSgId=	aSgIdList[ImageIndexFromProcessId(i, imageCount)];
   320 		info.iSgId=	aSgIdList[ImageIndexFromProcessId(i, imageCount)];
   336 		User::LeaveIfError(ret);
   344 		User::LeaveIfError(ret);
   337 		ret = iProcessStatus[i].iProcess.SetParameter(EProcSlotSourceFormat, static_cast<TInt>(iSourceFormat));
   345 		ret = iProcessStatus[i].iProcess.SetParameter(EProcSlotSourceFormat, static_cast<TInt>(iSourceFormat));
   338 		User::LeaveIfError(ret);
   346 		User::LeaveIfError(ret);
   339 		ret = iProcessStatus[i].iProcess.SetParameter(EProcSlotSurfaceFormat, static_cast<TInt>(iSurfaceFormat));
   347 		ret = iProcessStatus[i].iProcess.SetParameter(EProcSlotSurfaceFormat, static_cast<TInt>(iSurfaceFormat));
   340 		User::LeaveIfError(ret);
   348 		User::LeaveIfError(ret);
   341 		               
   349         ret = iProcessStatus[i].iProcess.SetParameter(EProcSlotCustomClientParam, messageQueueClientProcParam);
       
   350         User::LeaveIfError(ret);
       
   351 		
   342 		iProcessStatus[i].iProcess.Logon(iProcessStatus[i].iStatus); 
   352 		iProcessStatus[i].iProcess.Logon(iProcessStatus[i].iStatus); 
   343 		iProcessStatus[i].iProcess.Resume();
   353 		iProcessStatus[i].iProcess.Resume();
   344 		}
   354 		}
       
   355     
       
   356 	//by default an empty implementation
       
   357     ReceiveMessageFromClient(messageQueueClientProcParam);
   345 
   358 
   346 	// wait for all processes to complete (not worried about the order)
   359 	// wait for all processes to complete (not worried about the order)
   347 	// This is needed, as the only way to determine whether the process step has failed is to check
   360 	// This is needed, as the only way to determine whether the process step has failed is to check
   348 	//   the return value (using TEST(EFalse) has no effect on the spawned process)
   361 	//  the return value (using TEST(EFalse) has no effect on the spawned process)
   349 	for (TInt i=0; i<aProcessCount; i++)
   362 	for (TInt i=0; i<aProcessCount; i++)
   350 		{
   363 		{
   351 		User::WaitForRequest(iProcessStatus[i].iStatus);
   364 		User::WaitForRequest(iProcessStatus[i].iStatus);
   352 		CheckProcessStatusL(i, iProcessStatus[i].iStatus, iProcessStatus[i].iProcess);
   365 		CheckProcessStatusL(i, iProcessStatus[i].iStatus, iProcessStatus[i].iProcess);
   353 		RDebug::Print(_L(">>>>>(%d)>> status :%d"), i, iProcessStatus[i].iStatus.Int());
   366 		RDebug::Print(_L(">>>>>(%d)>> status :%d"), i, iProcessStatus[i].iStatus.Int());
   354 		iProcessStatus[i].iProcess.Close();
   367 		iProcessStatus[i].iProcess.Close();
   355 		}
   368 		}
   356 
   369 
   357 	// close MsgQueue and semaphores (as used in some test with 2 spawned processes)
   370 	// close MsgQueue and semaphores (as used in some test with 2 spawned processes)
   358 	messageQueueSgId.Close();
   371 	CleanupStack::PopAndDestroy(3, &messageQueueSgId); //messageQueueClientProcParam, messageQueueProcId
   359 	messageQueueProcId.Close();
       
   360 	iSemaphore[1].Close();
   372 	iSemaphore[1].Close();
   361 	iSemaphore[0].Close();
   373 	iSemaphore[0].Close();
   362 	}
   374 	}
   363 
   375 
   364 /**
   376 /**