This is through.
Regards--
Subrata,

Riaz Rahaman wrote:
the patch is for open posix test located at the below location

ltp/testcases/open_posix_testsuite/conformance/interfaces/mq_timedsend/12-1.c

I observed that in the start routine when a condition fails for eg
mq_open function isn't implemented in which case the thread is
terminated by calling pthread_exit. Good thtz the right thing to do.
So far so good, next in the main function there is a while loop
looping on a condition sem==INTHREAD and this loop is forever which
leaves the test running for ever.

I did a small change in the thread routine, before termination I am
setting this variable to INMAIN so in the later stage in main when
trying to communicate with the thread will fail causing the testcase
to fail.

I acknowledge that this might not be the wisest way to do it but at
least itz the start.

There are a couple of other changes as well which is in the thread
routine when a condition fails NULL is returned, I changed that to
return what ever pthread_exit returns for the reason that to my
understanding the general practice is to return NULL on success and
non zero on a failure.

------------------------------------------------------------------------

--- 12-1.c      2004-05-04 07:43:50.000000000 +0530
+++ 12-1.c_new  2007-06-05 15:01:01.372800000 +0530
@@ -84,7 +84,8 @@ void *a_thread_func()
                        gqueue = mq_open(gqname, O_CREAT |O_RDWR, S_IRUSR | 
S_IWUSR, &attr);
                if (gqueue == (mqd_t)-1) {
                        perror("mq_open() did not return success");
-                       pthread_exit((void*)PTS_UNRESOLVED);
+                       sem = INMAIN;
+ pthread_exit((void*)PTS_UNRESOLVED); return NULL;
                }
                
@@ -101,17 +102,17 @@ void *a_thread_func()
                                if (errno == EINTR) {
                                        if (mq_unlink(gqname) != 0) {
                                                perror("mq_unlink() did not return 
success");
-                                               
pthread_exit((void*)PTS_UNRESOLVED);
-                                               return NULL;
+                                                        
pthread_exit((void*)PTS_UNRESOLVED);
+                                               return (void*)PTS_UNRESOLVED;
                                        }
                                        printf("thread: mq_timedsend interrupted by 
signal and correctly set errno to EINTR\n");
                                        errno_eintr=1;
                                        pthread_exit((void*)PTS_PASS);
-                                       return NULL;
+                                       return (void*)PTS_PASS;
                                } else {
                                printf("mq_timedsend not interrupted by signal or 
set errno to incorrect code: %d\n", errno);
                                        pthread_exit((void*)PTS_FAIL);
-                                       return NULL;
+                                       return (void*)PTS_FAIL;
                                }
                        }
                }
@@ -121,14 +122,13 @@ void *a_thread_func()
perror("Error: thread never blocked\n");
                pthread_exit((void*)PTS_FAIL);
-               return NULL;
+               return (void*)PTS_FAIL;
 }
int main()
 {
         pthread_t new_th;
        int i;
-
        /* Initialized values */
        i = 0;
        in_handler=0;
@@ -140,11 +140,11 @@ int main()
                perror("Error: in pthread_create\n");
                return PTS_UNRESOLVED;
        }
-       
+
        /* Wait for thread to set up handler for SIGUSR1 */
        while(sem==INTHREAD)
-               sleep(1);
-
+                       sleep(1);
+ while((i != 10) && (sem==INMAIN))
        {
                /* signal thread while it's in mq_timedsend */
------------------------------------------------------------------------

-------------------------------------------------------------------------
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/
------------------------------------------------------------------------

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

-------------------------------------------------------------------------
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/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to