How to Test a multithreaded application

View: New views
1 Messages — Rating Filter:   Alert me  

How to Test a multithreaded application

by cppunit-devel mailing list :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all. 
I have developed a Server Application that Tests a Client for possible test scenarios. 
It send an asynchrnous replies to client as a response to any command. 
Every time it sends an Asynchrnous reply, it creates a thread and make a remote procedure call to a function. My Question is that how to create a testCase for that module that is creating a thread and calling a remote procedure. 
Here is the sample code that creates a thread and make a remote procedure call. 
This RPC is based on ONCRPC framework. 
 
BOOL CRadioServerInterface :: 
Object_Login__Session_Status(unsigned short uArgs) 

Session_status=uArgs;  
void * ignore = NULL; 
HANDLE login__thread; 
DWORD ID__loginThread; 
login__thread = CreateThread(NULL,  
0,  
(LPTHREAD_START_ROUTINE) createLoginThread, 
ignore, 
0,  
&ID__loginThread);  
if (login__thread == NULL)  
return FALSE; 
else 
return TRUE; 

 
// THIS IS THEAD 
void CRadioServerInterface :: createLoginThread(void * ignore) 

if( getInstance()->createClient() ) // CREATE A NEW CLIENT 

// CALL A REMOTE PROCEDURE 
call__session_1(&(getInstance()->Session_status),getInstance()->m_clnt);  
clnt_destroy(getInstance()->m_clnt); // DESTROYS A CLIENT HANDLE 


 
 
HERE IN Object_Login__Session_Status I AM CREATING A THREAD NAMED createLoginThread 
IN THIS THREAD I AM CREATING  
1. A CLIENT HANDLE TO A REMOTE CLIENT  
2. MAKING A CALL TO REMOTE PROCEDURE NAMED call__session_1 
3. AND DESTROYING A CLIENT HANDLE 
 
So i need to know how to create a TestCase for Object_Login__Session_status and for createLoginThread
function. 
I have searched for it a lot but unable to found any solution for the problem.
 
Regards, 
Sandeep. 

 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Cppunit-devel mailing list
Cppunit-devel@...
https://lists.sourceforge.net/lists/listinfo/cppunit-devel