[rtems commit] psxtests: add POSIX API signature compliance tests for mqueue.h file (GCI 2018)

Joel Sherrill joel at rtems.org
Wed Nov 28 16:59:30 UTC 2018


Module:    rtems
Branch:    master
Commit:    93ccf479e2621109b4711f0cd4568d2463ae6b68
Changeset: http://git.rtems.org/rtems/commit/?id=93ccf479e2621109b4711f0cd4568d2463ae6b68

Author:    Himanshu40 <himanshuwindows8.1 at gmail.com>
Date:      Wed Nov 28 13:52:34 2018 +0530

psxtests: add POSIX API signature compliance tests for mqueue.h file (GCI 2018)

---

 testsuites/psxtests/Makefile.am                    | 12 ++++-
 testsuites/psxtests/psxhdrs/mqueue/mq_close.c      | 49 ++++++++++++++++++
 testsuites/psxtests/psxhdrs/mqueue/mq_getattr.c    | 49 ++++++++++++++++++
 testsuites/psxtests/psxhdrs/mqueue/mq_notify.c     | 52 +++++++++++++++++++
 testsuites/psxtests/psxhdrs/mqueue/mq_open.c       | 51 +++++++++++++++++++
 testsuites/psxtests/psxhdrs/mqueue/mq_receive.c    | 52 +++++++++++++++++++
 testsuites/psxtests/psxhdrs/mqueue/mq_send.c       | 53 ++++++++++++++++++++
 testsuites/psxtests/psxhdrs/mqueue/mq_setattr.c    | 50 +++++++++++++++++++
 .../psxtests/psxhdrs/mqueue/mq_timedreceive.c      | 57 +++++++++++++++++++++
 testsuites/psxtests/psxhdrs/mqueue/mq_timedsend.c  | 58 ++++++++++++++++++++++
 testsuites/psxtests/psxhdrs/mqueue/mq_unlink.c     | 39 +++++++++++++++
 11 files changed, 521 insertions(+), 1 deletion(-)

diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index bf1befd..2385ec8 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -1093,7 +1093,17 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \
 	psxhdrs/dirent/rewinddir.c \
 	psxhdrs/dirent/scandir.c \
 	psxhdrs/dirent/seekdir.c \
-	psxhdrs/dirent/telldir.c
+	psxhdrs/dirent/telldir.c \
+	psxhdrs/mqueue/mq_open.c \
+	psxhdrs/mqueue/mq_close.c \
+	psxhdrs/mqueue/mq_getattr.c \
+	psxhdrs/mqueue/mq_setattr.c \
+	psxhdrs/mqueue/mq_notify.c \
+	psxhdrs/mqueue/mq_receive.c \
+	psxhdrs/mqueue/mq_send.c \
+	psxhdrs/mqueue/mq_timedreceive.c \
+	psxhdrs/mqueue/mq_timedsend.c \
+	psxhdrs/mqueue/mq_unlink.c
 endif
 
 rtems_tests_PROGRAMS = $(psx_tests)
diff --git a/testsuites/psxtests/psxhdrs/mqueue/mq_close.c b/testsuites/psxtests/psxhdrs/mqueue/mq_close.c
new file mode 100644
index 0000000..02afecf
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/mqueue/mq_close.c
@@ -0,0 +1,49 @@
+/**
+ *  @file
+ *  @brief mq_close() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <fcntl.h>
+  #include <mqueue.h>
+
+  int test( void );
+
+  #define MQ_MAXMSG     1
+  #define MQ_MSGSIZE    sizeof(int)
+
+  int test( void )
+  {
+    mqd_t mqdes;
+    struct mq_attr mqstat;
+    const char *q_name;
+    int result;
+
+    mqstat.mq_maxmsg  = MQ_MAXMSG;
+    mqstat.mq_msgsize = MQ_MSGSIZE;
+    q_name = "queue";
+
+    mqdes = mq_open( q_name, O_CREAT | O_RDWR, 0x777, &mqstat );
+    result = mq_close( mqdes );
+
+    return result;
+  }
diff --git a/testsuites/psxtests/psxhdrs/mqueue/mq_getattr.c b/testsuites/psxtests/psxhdrs/mqueue/mq_getattr.c
new file mode 100644
index 0000000..092c6bf
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/mqueue/mq_getattr.c
@@ -0,0 +1,49 @@
+/**
+ *  @file
+ *  @brief mq_getattr() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <fcntl.h>
+  #include <mqueue.h>
+
+  int test( void );
+
+  #define MQ_MAXMSG     1
+  #define MQ_MSGSIZE    sizeof(int)
+
+  int test( void )
+  {
+    mqd_t mqdes;
+    struct mq_attr mqstat;
+    const char *q_name;
+    int result;
+
+    mqstat.mq_maxmsg  = MQ_MAXMSG;
+    mqstat.mq_msgsize = MQ_MSGSIZE;
+    q_name = "queue";
+
+    mqdes = mq_open( q_name, O_CREAT | O_RDWR, 0x777, &mqstat );
+    result = mq_getattr( mqdes, &mqstat );
+
+    return result;
+  }
diff --git a/testsuites/psxtests/psxhdrs/mqueue/mq_notify.c b/testsuites/psxtests/psxhdrs/mqueue/mq_notify.c
new file mode 100644
index 0000000..3b4ace4
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/mqueue/mq_notify.c
@@ -0,0 +1,52 @@
+/**
+ *  @file
+ *  @brief mq_notify() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <fcntl.h>
+  #include <mqueue.h>
+
+  int test( void );
+
+  #define MQ_MAXMSG     1
+  #define MQ_MSGSIZE    sizeof(int)
+
+  int test( void )
+  {
+    mqd_t mqdes;
+    struct mq_attr mqstat;
+    struct sigevent sevp;
+    const char *q_name;
+    int result;
+
+    mqstat.mq_maxmsg  = MQ_MAXMSG;
+    mqstat.mq_msgsize = MQ_MSGSIZE;
+    sevp.sigev_notify = SIGEV_SIGNAL;
+    sevp.sigev_signo  = SIGUSR1;
+    q_name = "queue";
+
+    mqdes = mq_open( q_name, O_CREAT | O_RDWR, 0x777, &mqstat );
+    result = mq_notify( mqdes, &sevp );
+
+    return result;
+  }
diff --git a/testsuites/psxtests/psxhdrs/mqueue/mq_open.c b/testsuites/psxtests/psxhdrs/mqueue/mq_open.c
new file mode 100644
index 0000000..963a8a1
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/mqueue/mq_open.c
@@ -0,0 +1,51 @@
+/**
+ *  @file
+ *  @brief mq_open() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <fcntl.h>
+  #include <mqueue.h>
+
+  int test( void );
+
+  #define MQ_MAXMSG     1
+  #define MQ_MSGSIZE    sizeof(int)
+
+  int result = 1;
+
+  int test( void )
+  {
+    mqd_t mqdes;
+    struct mq_attr mqstat;
+    const char *q_name;
+    result = 0;
+
+    mqstat.mq_maxmsg  = MQ_MAXMSG;
+    mqstat.mq_msgsize = MQ_MSGSIZE;
+    q_name = "queue";
+
+    mqdes = mq_open( q_name, O_CREAT | O_RDWR, 0x777, &mqstat );
+    (void) mqdes;
+
+    return result;
+  }
diff --git a/testsuites/psxtests/psxhdrs/mqueue/mq_receive.c b/testsuites/psxtests/psxhdrs/mqueue/mq_receive.c
new file mode 100644
index 0000000..b6c4c2b
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/mqueue/mq_receive.c
@@ -0,0 +1,52 @@
+/**
+ *  @file
+ *  @brief mq_receive() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <fcntl.h>
+  #include <mqueue.h>
+
+  int test( void );
+
+  #define MQ_MAXMSG     1
+  #define MQ_MSGSIZE    sizeof(int)
+
+  int test( void )
+  {
+    mqd_t mqdes;
+    struct mq_attr mqstat;
+    const char *q_name;
+    int message[MQ_MAXMSG];
+    unsigned int msg_prio;
+    int result;
+
+    mqstat.mq_maxmsg  = MQ_MAXMSG;
+    mqstat.mq_msgsize = MQ_MSGSIZE;
+    msg_prio = 1;
+    q_name = "queue";
+
+    mqdes = mq_open( q_name, O_CREAT | O_RDWR, 0x777, &mqstat );
+    result = mq_receive( mqdes, (char *)message, MQ_MSGSIZE, &msg_prio );
+
+    return result;
+  }
diff --git a/testsuites/psxtests/psxhdrs/mqueue/mq_send.c b/testsuites/psxtests/psxhdrs/mqueue/mq_send.c
new file mode 100644
index 0000000..a2f457c
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/mqueue/mq_send.c
@@ -0,0 +1,53 @@
+/**
+ *  @file
+ *  @brief mq_send() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <fcntl.h>
+  #include <mqueue.h>
+
+  int test( void );
+
+  #define MQ_MAXMSG     1
+  #define MQ_MSGSIZE    sizeof(int)
+
+  int test( void )
+  {
+    mqd_t mqdes;
+    struct mq_attr mqstat;
+    const char *q_name;
+    int msg_ptr;
+    unsigned int msg_prio;
+    int result;
+
+    mqstat.mq_maxmsg  = MQ_MAXMSG;
+    mqstat.mq_msgsize = MQ_MSGSIZE;
+    msg_prio = 1;
+    msg_ptr = 9;
+    q_name = "queue";
+
+    mqdes = mq_open( q_name, O_CREAT | O_RDWR, 0x777, &mqstat );
+    result = mq_send( mqdes, (const char *)&msg_ptr, MQ_MSGSIZE, msg_prio );
+
+    return result;
+  }
diff --git a/testsuites/psxtests/psxhdrs/mqueue/mq_setattr.c b/testsuites/psxtests/psxhdrs/mqueue/mq_setattr.c
new file mode 100644
index 0000000..b97abaa
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/mqueue/mq_setattr.c
@@ -0,0 +1,50 @@
+/**
+ *  @file
+ *  @brief mq_setattr() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <fcntl.h>
+  #include <mqueue.h>
+
+  int test( void );
+
+  #define MQ_MAXMSG     1
+  #define MQ_MSGSIZE    sizeof(int)
+
+  int test( void )
+  {
+    mqd_t mqdes;
+    struct mq_attr mqstat;
+    struct mq_attr *omqstat = NULL;
+    const char *q_name;
+    int result;
+
+    mqstat.mq_maxmsg  = MQ_MAXMSG;
+    mqstat.mq_msgsize = MQ_MSGSIZE;
+    q_name = "queue";
+
+    mqdes = mq_open( q_name, O_CREAT | O_RDWR, 0x777, &mqstat );
+    result = mq_setattr( mqdes, &mqstat,  omqstat );
+
+    return result;
+  }
diff --git a/testsuites/psxtests/psxhdrs/mqueue/mq_timedreceive.c b/testsuites/psxtests/psxhdrs/mqueue/mq_timedreceive.c
new file mode 100644
index 0000000..7eee364
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/mqueue/mq_timedreceive.c
@@ -0,0 +1,57 @@
+/**
+ *  @file
+ *  @brief mq_timedreceive() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <fcntl.h>
+  #include <time.h>
+  #include <mqueue.h>
+
+  int test( void );
+
+  #define MQ_MAXMSG     1
+  #define MQ_MSGSIZE    sizeof(int)
+
+  int test( void )
+  {
+    mqd_t mqdes;
+    struct mq_attr mqstat;
+    const char *q_name;
+    int message[MQ_MAXMSG];
+    struct timespec abs_timeout;
+    unsigned int msg_prio;
+    int result;
+
+    mqstat.mq_maxmsg  = MQ_MAXMSG;
+    mqstat.mq_msgsize = MQ_MSGSIZE;
+    abs_timeout.tv_sec  = 0;
+    abs_timeout.tv_nsec = 0;
+    msg_prio = 1;
+    q_name = "queue";
+
+    mqdes = mq_open( q_name, O_CREAT | O_RDWR, 0x777, &mqstat );
+    result = mq_timedreceive(
+		  mqdes, (char *)message, MQ_MSGSIZE, &msg_prio, &abs_timeout );
+
+    return result;
+  }
diff --git a/testsuites/psxtests/psxhdrs/mqueue/mq_timedsend.c b/testsuites/psxtests/psxhdrs/mqueue/mq_timedsend.c
new file mode 100644
index 0000000..6e059ee
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/mqueue/mq_timedsend.c
@@ -0,0 +1,58 @@
+/**
+ *  @file
+ *  @brief mq_timedsend() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <fcntl.h>
+  #include <time.h>
+  #include <mqueue.h>
+
+  int test( void );
+
+  #define MQ_MAXMSG     1
+  #define MQ_MSGSIZE    sizeof(int)
+
+  int test( void )
+  {
+    mqd_t mqdes;
+    struct mq_attr mqstat;
+    const char *q_name;
+    struct timespec abs_timeout;
+    unsigned int msg_prio;
+    int msg_ptr;
+    int result;
+
+    mqstat.mq_maxmsg  = MQ_MAXMSG;
+    mqstat.mq_msgsize = MQ_MSGSIZE;
+    abs_timeout.tv_sec  = 0;
+    abs_timeout.tv_nsec = 1;
+    msg_ptr = 5;
+    msg_prio = 1;
+    q_name = "queue";
+
+    mqdes = mq_open( q_name, O_CREAT | O_RDWR, 0x777, &mqstat );
+    result = mq_timedsend(
+	     mqdes, (const char *)&msg_ptr, MQ_MSGSIZE, msg_prio, &abs_timeout);
+
+    return result;
+  }
diff --git a/testsuites/psxtests/psxhdrs/mqueue/mq_unlink.c b/testsuites/psxtests/psxhdrs/mqueue/mq_unlink.c
new file mode 100644
index 0000000..7b651d7
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/mqueue/mq_unlink.c
@@ -0,0 +1,39 @@
+/**
+ *  @file
+ *  @brief mq_unlink() API Conformance Test
+ */
+
+ /*
+  *  COPYRIGHT (c) 2018.
+  *  Himanshu Sekhar Nayak
+  *
+  *  Permission to use, copy, modify, and/or distribute this software
+  *  for any purpose with or without fee is hereby granted.
+  *
+  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
+
+  #ifdef HAVE_CONFIG_H
+  #include "config.h"
+  #endif
+
+  #include <mqueue.h>
+
+  int test( void );
+
+  int test( void )
+  {
+    const char *q_name;
+    int result;
+
+    q_name = "queue";
+    result = mq_unlink( q_name );
+
+    return result;
+  }




More information about the vc mailing list