[Cppunit-devel] How to Test a multithreaded application
Brought to you by:
blep
From: CppUnit d. m. l. <cpp...@li...> - 2007-06-04 05:31:18
|
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. |