loggingservices/eventlogger/test/src/t_logbadclient.cpp
changeset 51 7d4490026038
parent 40 b8bdbc8f59c7
child 55 44f437012c90
equal deleted inserted replaced
40:b8bdbc8f59c7 51:7d4490026038
   174 					User::Panic(KPanicCategory2, KPanicCode2);
   174 					User::Panic(KPanicCategory2, KPanicCode2);
   175 					break;
   175 					break;
   176 				}
   176 				}
   177 			}
   177 			}
   178 		//Send arguments
   178 		//Send arguments
       
   179 		//RDebug::Print(_L("##data.iFunction=%d\r\n"), data.iFunction);
   179 		TRequestStatus stat;
   180 		TRequestStatus stat;
   180 		sess.Send(data.iFunction, args, stat);
   181 		sess.Send(data.iFunction, args, stat);
   181 		if(stat.Int() == KErrServerTerminated)
   182 		if(stat.Int() == KErrServerTerminated)
   182 			{
   183 			{
   183 			User::Panic(KPanicCategory, KPanicCode);
   184 			User::Panic(KPanicCategory, KPanicCode);
   184 			}
   185 			}
   185 		else if(stat.Int() == KRequestPending)
   186 		else if(stat.Int() == KRequestPending)
   186 			{
   187 			{
   187 			if(data.iFunction == ELogOperationInitiate)
   188 			if(data.iFunction == ELogOperationInitiate)
   188 				{
   189 				{
       
   190 				//RDebug::Print(_L("##ELogOperationGetResult\r\n"));
   189 				err = sess.Send(ELogOperationGetResult, args);
   191 				err = sess.Send(ELogOperationGetResult, args);
   190 				if(err == KErrServerTerminated)
   192 				if(err == KErrServerTerminated)
   191 					{
   193 					{
   192 					User::Panic(KPanicCategory, KPanicCode);
   194 					User::Panic(KPanicCategory, KPanicCode);
   193 					}
   195 					}
   195 			else
   197 			else
   196 				{
   198 				{
   197 				//Give some time to the LogEng server to do something with that async request, then cancel it.
   199 				//Give some time to the LogEng server to do something with that async request, then cancel it.
   198 				//Otherwise, on a multi-core hardware, the LogEnd server will end up with a long queue of
   200 				//Otherwise, on a multi-core hardware, the LogEnd server will end up with a long queue of
   199 				//pending requests, not cleared if the client side thread is panic'd. It will be a complete chaos.
   201 				//pending requests, not cleared if the client side thread is panic'd. It will be a complete chaos.
   200 				User::After(20000);
   202 				//RDebug::Print(_L("##data.iFunction=%d, wait and cancel async request\r\n"), data.iFunction);
       
   203 				User::After(100000);
   201 				TRequestStatus* s = &stat;
   204 				TRequestStatus* s = &stat;
   202 				User::RequestComplete(s, KErrCancel);
   205 				User::RequestComplete(s, KErrCancel);
   203 				}
   206 				}
       
   207 			//RDebug::Print(_L("##---err=%d\r\n"), err);
   204 			}
   208 			}
   205 		}
   209 		}
   206 
   210 
   207 	sess.Close();
   211 	sess.Close();
   208 
   212 
   328 		User::WaitForRequest(status, serverStatus);
   332 		User::WaitForRequest(status, serverStatus);
   329 
   333 
   330 		// If the Server has crashed then we must fail		
   334 		// If the Server has crashed then we must fail		
   331 		if (serverStatus != KRequestPending) 
   335 		if (serverStatus != KRequestPending) 
   332 			{
   336 			{
   333 			TheTest.Printf(_L("##Iteration=%d, Function=%d, Status1=%d, Status2=%d\r\n"), data.iIteration, data.iFunction, status.Int(), serverStatus.Int());
   337 			TheTest.Printf(_L("##Iteration=%d, Function=%d, Status=%d, Server Status=%d\r\n"), data.iIteration, data.iFunction, status.Int(), serverStatus.Int());
   334 			break;
       
   335 			}
   338 			}
   336 
   339 
   337 		TExitType exitType = thread.ExitType();
   340 		TExitType exitType = thread.ExitType();
   338 		TInt exitReason = thread.ExitReason();
   341 		TInt exitReason = thread.ExitReason();
   339 		thread.Close();
   342 		thread.Close();
   340 		User::SetJustInTime(ETrue);
   343 		User::SetJustInTime(ETrue);
   341 		
   344 		
   342 		if(exitType == EExitPanic)
   345 		if(exitType == EExitPanic || serverStatus != KRequestPending)
   343 			{
   346 			{
   344 			if(exitReason == KPanicCode)
   347 			if(exitReason == KPanicCode || serverStatus != KRequestPending)
   345 				{
   348 				{
   346 				TheTest.Printf(_L("##Server terminated!\r\n"));
   349 				TheTest.Printf(_L("##Server terminated!\r\n"));
   347 				TheTest.Printf(_L("##Iteration=%d, Function=%d\r\n"), data.iIteration, data.iFunction);
   350 				TheTest.Printf(_L("##Iteration=%d, Function=%d, iOperationType=%d, iDataSlot1=%d, iDataSlot2=%d\r\n"), 
       
   351 						data.iIteration, data.iFunction,
       
   352 						TheLogIpcData.iOperationType,
       
   353 						TheLogIpcData.iDataSlot1,
       
   354 						TheLogIpcData.iDataSlot2);
   348 				for(TInt i=0;i<KMaxMessageArguments;++i)
   355 				for(TInt i=0;i<KMaxMessageArguments;++i)
   349 					{
   356 					{
   350 					TheTest.Printf(_L("##Arg %d, Type %d\r\n"), i + 1, data.iArgType[i]);
   357 					TheTest.Printf(_L("##Arg %d, Type %d\r\n"), i + 1, data.iArgType[i]);
   351 					switch(data.iArgType[i])
   358 					switch(data.iArgType[i])
   352 						{
   359 						{
   368 				}
   375 				}
   369 			}
   376 			}
   370 		}//for
   377 		}//for
   371 	delete p;
   378 	delete p;
   372 
   379 
   373 
       
   374 	// Check to see if the server crashed and not detected by client
   380 	// Check to see if the server crashed and not detected by client
   375 	TEST(serverStatus.Int() == KRequestPending);
   381 	TEST(serverStatus.Int() == KRequestPending);
   376 	serverWatcher.Kill(KErrCancel);
   382 	serverWatcher.Kill(KErrCancel);
   377 	serverWatcher.Close();
   383 	serverWatcher.Close();
   378 		
   384