On Wed, Feb 17, 2010 at 12:11 AM, Rishikesh <[email protected]> wrote:
> Hi Jiri,
>
> Thanks for patch ( ref:
> http://marc.info/?l=ltp-list&m=126415968820646&w=2 ). It will be merged
> in feb 2010 release. please verify once it is out.

I took a bit different route to arrive at the same conclusion as more
spots could be affected by this POSIX ambiguity. I also fixed a
compiler warning and bumped _XOPEN_SOURCE to 600 as per my manpage for
mq_timedsend:

gcoo...@orangebox /scratch/ltp-git/ltp-dev $ sudo
testcases/kernel/syscalls/mq_notify/mq_notify01
mq_notify01    0  TINFO  :  (case00) START
EXPECT: return value(ret)=(N >= 0) errno=0 (Success)
RESULT: return value(ret)=       0 errno=0 (Success)
mq_notify01    0  TINFO  :  (case00) END => OK
mq_notify01    0  TINFO  :  (case01) START
EXPECT: return value(ret)=(N >= 0) errno=0 (Success)
RESULT: return value(ret)=       0 errno=0 (Success)
mq_notify01    0  TINFO  :  (case01) END => OK
mq_notify01    0  TINFO  :  (case02) START
EXPECT: return value(ret)=(N >= 0) errno=0 (Success)
RESULT: return value(ret)=       0 errno=0 (Success)
mq_notify01    0  TINFO  :  (case02) END => OK
mq_notify01    0  TINFO  :  (case03) START
EXPECT: return value(ret)=-1 errno=9 (Bad file descriptor)
RESULT: return value(ret)=-1 errno=9 (Bad file descriptor)
mq_notify01    0  TINFO  :  (case03) END => OK
mq_notify01    0  TINFO  :  (case04) START
EXPECT: return value(ret)=-1 errno=9 (Bad file descriptor)
RESULT: return value(ret)=-1 errno=9 (Bad file descriptor)
mq_notify01    0  TINFO  :  (case04) END => OK
mq_notify01    0  TINFO  :  (case05) START
EXPECT: return value(ret)=-1 errno=9 (Bad file descriptor)
RESULT: return value(ret)=-1 errno=9 (Bad file descriptor)
mq_notify01    0  TINFO  :  (case05) END => OK
mq_notify01    0  TINFO  :  (case06) START
EXPECT: return value(ret)=-1 errno=16 (Device or resource busy)
RESULT: return value(ret)=-1 errno=16 (Device or resource busy)
mq_notify01    0  TINFO  :  (case06) END => OK
mq_notify01    1  TPASS  :  mq_notify call succeeded

diff --git a/testcases/kernel/syscalls/mq_notify/mq_notify01.c
b/testcases/kernel/syscalls/mq_notify/mq_notify01.c
index 6004373..0370740 100644
--- a/testcases/kernel/syscalls/mq_notify/mq_notify01.c
+++ b/testcases/kernel/syscalls/mq_notify/mq_notify01.c
@@ -45,7 +45,7 @@
 /* History:     Porting from Crackerjack to LTP is done by
        */
 /*              Manas Kumar Nayak [email protected]>
        */
 
/******************************************************************************/
-#define _XOPEN_SOURCE 500
+#define _XOPEN_SOURCE 600
 #include <sys/syscall.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -262,15 +262,20 @@ static int do_test(struct test_case *tc)
         int rc, i, fd = -1;
         struct sigevent ev;
         struct sigaction sigact;
+       struct timespec abs_timeout;
         char smsg[MAX_MSGSIZE];

         notified = cmp_ok = 1;

+       /* Don't timeout. */
+       abs_timeout.tv_sec = 0;
+       abs_timeout.tv_nsec = 0;
+
         /*
          * When test ended with SIGTERM etc, mq discriptor is left remains.
          * So we delete it first.
          */
-        TEST(mq_unlink(QUEUE_NAME));
+        mq_unlink(QUEUE_NAME);

         switch (tc->ttype) {
         case FD_NOT_EXIST:
@@ -345,7 +350,7 @@ static int do_test(struct test_case *tc)
          */
         for (i = 0; i < MSG_SIZE; i++)
                 smsg[i] = i;
-        TEST(rc = mq_timedsend(fd, smsg, MSG_SIZE, 0, NULL));
+        TEST(rc = mq_timedsend(fd, smsg, MSG_SIZE, 0, &abs_timeout));
         if (rc < 0) {
                 tst_resm(TFAIL,"mq_timedsend failed errno = %d :
%s",TEST_ERRNO, strerror(TEST_ERRNO));
                 result = 1;
@@ -359,7 +364,7 @@ TEST_END:
         /*
          * Check results
          */
-        result |= (sys_errno != tc->err) || !cmp_ok;
+        result |= (sys_ret != 0 && sys_errno != tc->err) || !cmp_ok;
         PRINT_RESULT_CMP(sys_ret >= 0, tc->ret, tc->err, sys_ret, sys_errno,
                          cmp_ok);

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to