diff mbox series

rt/tst-mqueue*: Return UNSUPPORTED when mq_open fails with ENOSYS

Message ID 20220115145346.304375-1-samuel.thibault@ens-lyon.org
State Committed
Commit 9702a41cee31e3588e46485a5db06d1d7c222d30
Headers show
Series rt/tst-mqueue*: Return UNSUPPORTED when mq_open fails with ENOSYS | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Samuel Thibault Jan. 15, 2022, 2:53 p.m. UTC
Rather than returning 0 or a failure.
---
 rt/tst-mqueue1.c  | 10 +++++++---
 rt/tst-mqueue10.c | 10 +++++++++-
 rt/tst-mqueue2.c  | 10 +++++++---
 rt/tst-mqueue3.c  |  9 ++++-----
 rt/tst-mqueue4.c  | 10 +++++++---
 rt/tst-mqueue5.c  | 10 +++++++---
 rt/tst-mqueue6.c  | 10 +++++++---
 rt/tst-mqueue7.c  |  1 +
 rt/tst-mqueue8.c  |  6 +++++-
 rt/tst-mqueue9.c  | 10 +++++++---
 10 files changed, 61 insertions(+), 25 deletions(-)

Comments

Adhemerval Zanella Jan. 17, 2022, 5:46 p.m. UTC | #1
On 15/01/2022 11:53, Samuel Thibault wrote:
> Rather than returning 0 or a failure.

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  rt/tst-mqueue1.c  | 10 +++++++---
>  rt/tst-mqueue10.c | 10 +++++++++-
>  rt/tst-mqueue2.c  | 10 +++++++---
>  rt/tst-mqueue3.c  |  9 ++++-----
>  rt/tst-mqueue4.c  | 10 +++++++---
>  rt/tst-mqueue5.c  | 10 +++++++---
>  rt/tst-mqueue6.c  | 10 +++++++---
>  rt/tst-mqueue7.c  |  1 +
>  rt/tst-mqueue8.c  |  6 +++++-
>  rt/tst-mqueue9.c  | 10 +++++++---
>  10 files changed, 61 insertions(+), 25 deletions(-)
> 
> diff --git a/rt/tst-mqueue1.c b/rt/tst-mqueue1.c
> index 1fa807f19a..3aa0369a2b 100644
> --- a/rt/tst-mqueue1.c
> +++ b/rt/tst-mqueue1.c
> @@ -26,6 +26,7 @@
>  #include <time.h>
>  #include <unistd.h>
>  #include <stdint.h>
> +#include <support/check.h>
>  #include "tst-mqueue.h"
>  
>  static int
> @@ -322,11 +323,14 @@ do_test (void)
>  
>    if (q == (mqd_t) -1)
>      {
> +      if (errno == ENOSYS)
> +	FAIL_UNSUPPORTED ("mq_open not supported");
> +
>        printf ("mq_open failed with: %m\n");
> -      return result;
> +      return 1;
>      }
> -  else
> -    add_temp_mq (name);
> +
> +  add_temp_mq (name);
>  
>    result |= do_one_test (q, name, 0);
>  
> diff --git a/rt/tst-mqueue10.c b/rt/tst-mqueue10.c
> index 9da9838258..059c064488 100644
> --- a/rt/tst-mqueue10.c
> +++ b/rt/tst-mqueue10.c
> @@ -43,7 +43,15 @@ do_test (void)
>  
>    struct mq_attr attr = { .mq_maxmsg = 1, .mq_msgsize = sizeof (msg) };
>    mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
> -  TEST_VERIFY_EXIT (q != (mqd_t) -1);
> +
> +  if (q == (mqd_t) -1)
> +    {
> +      if (errno == ENOSYS)
> +	FAIL_UNSUPPORTED ("mq_open not supported");
> +
> +      printf ("mq_open failed with: %m\n");
> +      return 1;
> +    }
>  
>    struct timespec ts = { TYPE_MAXIMUM (time_t), 0 };
>  
> diff --git a/rt/tst-mqueue2.c b/rt/tst-mqueue2.c
> index 18fadfe09c..b355d22474 100644
> --- a/rt/tst-mqueue2.c
> +++ b/rt/tst-mqueue2.c
> @@ -27,6 +27,7 @@
>  #include <sys/wait.h>
>  #include <time.h>
>  #include <unistd.h>
> +#include <support/check.h>
>  #include "tst-mqueue.h"
>  
>  static void
> @@ -48,11 +49,14 @@ do_test (void)
>  
>    if (q == (mqd_t) -1)
>      {
> +      if (errno == ENOSYS)
> +	FAIL_UNSUPPORTED ("mq_open not supported");
> +
>        printf ("mq_open failed with: %m\n");
> -      return result;
> +      return 1;
>      }
> -  else
> -    add_temp_mq (name);
> +
> +  add_temp_mq (name);
>  
>    mqd_t q2 = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
>    if (q2 != (mqd_t) -1)
> diff --git a/rt/tst-mqueue3.c b/rt/tst-mqueue3.c
> index 812602e2c7..634db921e6 100644
> --- a/rt/tst-mqueue3.c
> +++ b/rt/tst-mqueue3.c
> @@ -27,6 +27,7 @@
>  #include <sys/mman.h>
>  #include <sys/wait.h>
>  #include <unistd.h>
> +#include <support/check.h>
>  
>  #if _POSIX_THREADS
>  # include <pthread.h>
> @@ -161,15 +162,13 @@ do_test (void)
>    /* Create the message queue.  */
>    struct mq_attr attr = { .mq_maxmsg = MAXMSG, .mq_msgsize = MSGSIZE };
>    m = mq_open (mqname, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
> +
>    if (m == -1)
>      {
>        if (errno == ENOSYS)
> -	{
> -	  puts ("not implemented");
> -	  return 0;
> -	}
> +	FAIL_UNSUPPORTED ("mq_open not supported");
>  
> -      puts ("mq_open failed");
> +      printf ("mq_open failed with: %m\n");
>        return 1;
>      }
>  
> diff --git a/rt/tst-mqueue4.c b/rt/tst-mqueue4.c
> index ea19c27ab4..62d427a3ca 100644
> --- a/rt/tst-mqueue4.c
> +++ b/rt/tst-mqueue4.c
> @@ -29,6 +29,7 @@
>  #include <sys/wait.h>
>  #include <time.h>
>  #include <unistd.h>
> +#include <support/check.h>
>  #include "tst-mqueue.h"
>  
>  #define TEST_FUNCTION do_test ()
> @@ -45,11 +46,14 @@ do_test (void)
>  
>    if (q == (mqd_t) -1)
>      {
> +      if (errno == ENOSYS)
> +	FAIL_UNSUPPORTED ("mq_open not supported");
> +
>        printf ("mq_open failed with: %m\n");
> -      return result;
> +      return 1;
>      }
> -  else
> -    add_temp_mq (name);
> +
> +  add_temp_mq (name);
>  
>    *p = '.';
>    memset (p + 1, 'x', NAME_MAX + 1 - (p - name));
> diff --git a/rt/tst-mqueue5.c b/rt/tst-mqueue5.c
> index 24539dbb14..70d97a36c2 100644
> --- a/rt/tst-mqueue5.c
> +++ b/rt/tst-mqueue5.c
> @@ -30,6 +30,7 @@
>  #include <sys/wait.h>
>  #include <time.h>
>  #include <unistd.h>
> +#include <support/check.h>
>  #include "tst-mqueue.h"
>  
>  #if _POSIX_THREADS && defined SIGRTMIN && defined SA_SIGINFO
> @@ -630,11 +631,14 @@ do_test (void)
>  
>    if (q == (mqd_t) -1)
>      {
> +      if (errno == ENOSYS)
> +	FAIL_UNSUPPORTED ("mq_open not supported");
> +
>        printf ("mq_open failed with: %m\n");
> -      return result;
> +      return 1;
>      }
> -  else
> -    add_temp_mq (name);
> +
> +  add_temp_mq (name);
>  
>    struct sigevent ev;
>    memset (&ev, 0xaa, sizeof (ev));
> diff --git a/rt/tst-mqueue6.c b/rt/tst-mqueue6.c
> index 4831bf2dc1..bc875f101e 100644
> --- a/rt/tst-mqueue6.c
> +++ b/rt/tst-mqueue6.c
> @@ -30,6 +30,7 @@
>  #include <sys/wait.h>
>  #include <time.h>
>  #include <unistd.h>
> +#include <support/check.h>
>  #include "tst-mqueue.h"
>  
>  #if _POSIX_THREADS
> @@ -116,11 +117,14 @@ do_test (void)
>  
>    if (q == (mqd_t) -1)
>      {
> +      if (errno == ENOSYS)
> +	FAIL_UNSUPPORTED ("mq_open not supported");
> +
>        printf ("mq_open failed with: %m\n");
> -      return result;
> +      return 1;
>      }
> -  else
> -    add_temp_mq (name);
> +
> +  add_temp_mq (name);
>  
>    pthread_attr_t nattr;
>    if (pthread_attr_init (&nattr)
> diff --git a/rt/tst-mqueue7.c b/rt/tst-mqueue7.c
> index 302e9e454c..948c0d1326 100644
> --- a/rt/tst-mqueue7.c
> +++ b/rt/tst-mqueue7.c
> @@ -25,6 +25,7 @@
>  #include <sys/wait.h>
>  #include <time.h>
>  #include <unistd.h>
> +#include <support/check.h>
>  
>  #define OPT_AFTEREXEC 20000
>  
> diff --git a/rt/tst-mqueue8.c b/rt/tst-mqueue8.c
> index da1e7644e6..b14cde1188 100644
> --- a/rt/tst-mqueue8.c
> +++ b/rt/tst-mqueue8.c
> @@ -23,6 +23,7 @@
>  #include <unistd.h>
>  #if _POSIX_THREADS
>  # include <pthread.h>
> +# include <support/check.h>
>  
>  static pthread_barrier_t b;
>  
> @@ -95,8 +96,11 @@ do_test (void)
>  
>    if (q == (mqd_t) -1)
>      {
> +      if (errno == ENOSYS)
> +	FAIL_UNSUPPORTED ("mq_open not supported");
> +
>        printf ("mq_open failed with: %m\n");
> -      return 0;
> +      return 1;
>      }
>  
>    if (mq_unlink (name) != 0)
> diff --git a/rt/tst-mqueue9.c b/rt/tst-mqueue9.c
> index ef2233623b..fe991ec32f 100644
> --- a/rt/tst-mqueue9.c
> +++ b/rt/tst-mqueue9.c
> @@ -21,6 +21,7 @@
>  #include <stdlib.h>
>  #include <string.h>
>  #include <unistd.h>
> +#include <support/check.h>
>  #include "tst-mqueue.h"
>  
>  #define TEST_FUNCTION do_test ()
> @@ -41,11 +42,14 @@ do_test (void)
>  
>    if (q == (mqd_t) -1)
>      {
> +      if (errno == ENOSYS)
> +	FAIL_UNSUPPORTED ("mq_open not supported");
> +
>        printf ("mq_open failed with: %m\n");
> -      return 0;
> +      return 1;
>      }
> -  else
> -    add_temp_mq (name);
> +
> +  add_temp_mq (name);
>  
>    if (seteuid (1) != 0)
>      {
Samuel Thibault Jan. 17, 2022, 6:18 p.m. UTC | #2
Adhemerval Zanella, le lun. 17 janv. 2022 14:46:37 -0300, a ecrit:
> On 15/01/2022 11:53, Samuel Thibault wrote:
> > Rather than returning 0 or a failure.
> 
> LGTM, thanks.
> 
> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

Pushed so, thanks!

> > ---
> >  rt/tst-mqueue1.c  | 10 +++++++---
> >  rt/tst-mqueue10.c | 10 +++++++++-
> >  rt/tst-mqueue2.c  | 10 +++++++---
> >  rt/tst-mqueue3.c  |  9 ++++-----
> >  rt/tst-mqueue4.c  | 10 +++++++---
> >  rt/tst-mqueue5.c  | 10 +++++++---
> >  rt/tst-mqueue6.c  | 10 +++++++---
> >  rt/tst-mqueue7.c  |  1 +
> >  rt/tst-mqueue8.c  |  6 +++++-
> >  rt/tst-mqueue9.c  | 10 +++++++---
> >  10 files changed, 61 insertions(+), 25 deletions(-)
> > 
> > diff --git a/rt/tst-mqueue1.c b/rt/tst-mqueue1.c
> > index 1fa807f19a..3aa0369a2b 100644
> > --- a/rt/tst-mqueue1.c
> > +++ b/rt/tst-mqueue1.c
> > @@ -26,6 +26,7 @@
> >  #include <time.h>
> >  #include <unistd.h>
> >  #include <stdint.h>
> > +#include <support/check.h>
> >  #include "tst-mqueue.h"
> >  
> >  static int
> > @@ -322,11 +323,14 @@ do_test (void)
> >  
> >    if (q == (mqd_t) -1)
> >      {
> > +      if (errno == ENOSYS)
> > +	FAIL_UNSUPPORTED ("mq_open not supported");
> > +
> >        printf ("mq_open failed with: %m\n");
> > -      return result;
> > +      return 1;
> >      }
> > -  else
> > -    add_temp_mq (name);
> > +
> > +  add_temp_mq (name);
> >  
> >    result |= do_one_test (q, name, 0);
> >  
> > diff --git a/rt/tst-mqueue10.c b/rt/tst-mqueue10.c
> > index 9da9838258..059c064488 100644
> > --- a/rt/tst-mqueue10.c
> > +++ b/rt/tst-mqueue10.c
> > @@ -43,7 +43,15 @@ do_test (void)
> >  
> >    struct mq_attr attr = { .mq_maxmsg = 1, .mq_msgsize = sizeof (msg) };
> >    mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
> > -  TEST_VERIFY_EXIT (q != (mqd_t) -1);
> > +
> > +  if (q == (mqd_t) -1)
> > +    {
> > +      if (errno == ENOSYS)
> > +	FAIL_UNSUPPORTED ("mq_open not supported");
> > +
> > +      printf ("mq_open failed with: %m\n");
> > +      return 1;
> > +    }
> >  
> >    struct timespec ts = { TYPE_MAXIMUM (time_t), 0 };
> >  
> > diff --git a/rt/tst-mqueue2.c b/rt/tst-mqueue2.c
> > index 18fadfe09c..b355d22474 100644
> > --- a/rt/tst-mqueue2.c
> > +++ b/rt/tst-mqueue2.c
> > @@ -27,6 +27,7 @@
> >  #include <sys/wait.h>
> >  #include <time.h>
> >  #include <unistd.h>
> > +#include <support/check.h>
> >  #include "tst-mqueue.h"
> >  
> >  static void
> > @@ -48,11 +49,14 @@ do_test (void)
> >  
> >    if (q == (mqd_t) -1)
> >      {
> > +      if (errno == ENOSYS)
> > +	FAIL_UNSUPPORTED ("mq_open not supported");
> > +
> >        printf ("mq_open failed with: %m\n");
> > -      return result;
> > +      return 1;
> >      }
> > -  else
> > -    add_temp_mq (name);
> > +
> > +  add_temp_mq (name);
> >  
> >    mqd_t q2 = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
> >    if (q2 != (mqd_t) -1)
> > diff --git a/rt/tst-mqueue3.c b/rt/tst-mqueue3.c
> > index 812602e2c7..634db921e6 100644
> > --- a/rt/tst-mqueue3.c
> > +++ b/rt/tst-mqueue3.c
> > @@ -27,6 +27,7 @@
> >  #include <sys/mman.h>
> >  #include <sys/wait.h>
> >  #include <unistd.h>
> > +#include <support/check.h>
> >  
> >  #if _POSIX_THREADS
> >  # include <pthread.h>
> > @@ -161,15 +162,13 @@ do_test (void)
> >    /* Create the message queue.  */
> >    struct mq_attr attr = { .mq_maxmsg = MAXMSG, .mq_msgsize = MSGSIZE };
> >    m = mq_open (mqname, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
> > +
> >    if (m == -1)
> >      {
> >        if (errno == ENOSYS)
> > -	{
> > -	  puts ("not implemented");
> > -	  return 0;
> > -	}
> > +	FAIL_UNSUPPORTED ("mq_open not supported");
> >  
> > -      puts ("mq_open failed");
> > +      printf ("mq_open failed with: %m\n");
> >        return 1;
> >      }
> >  
> > diff --git a/rt/tst-mqueue4.c b/rt/tst-mqueue4.c
> > index ea19c27ab4..62d427a3ca 100644
> > --- a/rt/tst-mqueue4.c
> > +++ b/rt/tst-mqueue4.c
> > @@ -29,6 +29,7 @@
> >  #include <sys/wait.h>
> >  #include <time.h>
> >  #include <unistd.h>
> > +#include <support/check.h>
> >  #include "tst-mqueue.h"
> >  
> >  #define TEST_FUNCTION do_test ()
> > @@ -45,11 +46,14 @@ do_test (void)
> >  
> >    if (q == (mqd_t) -1)
> >      {
> > +      if (errno == ENOSYS)
> > +	FAIL_UNSUPPORTED ("mq_open not supported");
> > +
> >        printf ("mq_open failed with: %m\n");
> > -      return result;
> > +      return 1;
> >      }
> > -  else
> > -    add_temp_mq (name);
> > +
> > +  add_temp_mq (name);
> >  
> >    *p = '.';
> >    memset (p + 1, 'x', NAME_MAX + 1 - (p - name));
> > diff --git a/rt/tst-mqueue5.c b/rt/tst-mqueue5.c
> > index 24539dbb14..70d97a36c2 100644
> > --- a/rt/tst-mqueue5.c
> > +++ b/rt/tst-mqueue5.c
> > @@ -30,6 +30,7 @@
> >  #include <sys/wait.h>
> >  #include <time.h>
> >  #include <unistd.h>
> > +#include <support/check.h>
> >  #include "tst-mqueue.h"
> >  
> >  #if _POSIX_THREADS && defined SIGRTMIN && defined SA_SIGINFO
> > @@ -630,11 +631,14 @@ do_test (void)
> >  
> >    if (q == (mqd_t) -1)
> >      {
> > +      if (errno == ENOSYS)
> > +	FAIL_UNSUPPORTED ("mq_open not supported");
> > +
> >        printf ("mq_open failed with: %m\n");
> > -      return result;
> > +      return 1;
> >      }
> > -  else
> > -    add_temp_mq (name);
> > +
> > +  add_temp_mq (name);
> >  
> >    struct sigevent ev;
> >    memset (&ev, 0xaa, sizeof (ev));
> > diff --git a/rt/tst-mqueue6.c b/rt/tst-mqueue6.c
> > index 4831bf2dc1..bc875f101e 100644
> > --- a/rt/tst-mqueue6.c
> > +++ b/rt/tst-mqueue6.c
> > @@ -30,6 +30,7 @@
> >  #include <sys/wait.h>
> >  #include <time.h>
> >  #include <unistd.h>
> > +#include <support/check.h>
> >  #include "tst-mqueue.h"
> >  
> >  #if _POSIX_THREADS
> > @@ -116,11 +117,14 @@ do_test (void)
> >  
> >    if (q == (mqd_t) -1)
> >      {
> > +      if (errno == ENOSYS)
> > +	FAIL_UNSUPPORTED ("mq_open not supported");
> > +
> >        printf ("mq_open failed with: %m\n");
> > -      return result;
> > +      return 1;
> >      }
> > -  else
> > -    add_temp_mq (name);
> > +
> > +  add_temp_mq (name);
> >  
> >    pthread_attr_t nattr;
> >    if (pthread_attr_init (&nattr)
> > diff --git a/rt/tst-mqueue7.c b/rt/tst-mqueue7.c
> > index 302e9e454c..948c0d1326 100644
> > --- a/rt/tst-mqueue7.c
> > +++ b/rt/tst-mqueue7.c
> > @@ -25,6 +25,7 @@
> >  #include <sys/wait.h>
> >  #include <time.h>
> >  #include <unistd.h>
> > +#include <support/check.h>
> >  
> >  #define OPT_AFTEREXEC 20000
> >  
> > diff --git a/rt/tst-mqueue8.c b/rt/tst-mqueue8.c
> > index da1e7644e6..b14cde1188 100644
> > --- a/rt/tst-mqueue8.c
> > +++ b/rt/tst-mqueue8.c
> > @@ -23,6 +23,7 @@
> >  #include <unistd.h>
> >  #if _POSIX_THREADS
> >  # include <pthread.h>
> > +# include <support/check.h>
> >  
> >  static pthread_barrier_t b;
> >  
> > @@ -95,8 +96,11 @@ do_test (void)
> >  
> >    if (q == (mqd_t) -1)
> >      {
> > +      if (errno == ENOSYS)
> > +	FAIL_UNSUPPORTED ("mq_open not supported");
> > +
> >        printf ("mq_open failed with: %m\n");
> > -      return 0;
> > +      return 1;
> >      }
> >  
> >    if (mq_unlink (name) != 0)
> > diff --git a/rt/tst-mqueue9.c b/rt/tst-mqueue9.c
> > index ef2233623b..fe991ec32f 100644
> > --- a/rt/tst-mqueue9.c
> > +++ b/rt/tst-mqueue9.c
> > @@ -21,6 +21,7 @@
> >  #include <stdlib.h>
> >  #include <string.h>
> >  #include <unistd.h>
> > +#include <support/check.h>
> >  #include "tst-mqueue.h"
> >  
> >  #define TEST_FUNCTION do_test ()
> > @@ -41,11 +42,14 @@ do_test (void)
> >  
> >    if (q == (mqd_t) -1)
> >      {
> > +      if (errno == ENOSYS)
> > +	FAIL_UNSUPPORTED ("mq_open not supported");
> > +
> >        printf ("mq_open failed with: %m\n");
> > -      return 0;
> > +      return 1;
> >      }
> > -  else
> > -    add_temp_mq (name);
> > +
> > +  add_temp_mq (name);
> >  
> >    if (seteuid (1) != 0)
> >      {
diff mbox series

Patch

diff --git a/rt/tst-mqueue1.c b/rt/tst-mqueue1.c
index 1fa807f19a..3aa0369a2b 100644
--- a/rt/tst-mqueue1.c
+++ b/rt/tst-mqueue1.c
@@ -26,6 +26,7 @@ 
 #include <time.h>
 #include <unistd.h>
 #include <stdint.h>
+#include <support/check.h>
 #include "tst-mqueue.h"
 
 static int
@@ -322,11 +323,14 @@  do_test (void)
 
   if (q == (mqd_t) -1)
     {
+      if (errno == ENOSYS)
+	FAIL_UNSUPPORTED ("mq_open not supported");
+
       printf ("mq_open failed with: %m\n");
-      return result;
+      return 1;
     }
-  else
-    add_temp_mq (name);
+
+  add_temp_mq (name);
 
   result |= do_one_test (q, name, 0);
 
diff --git a/rt/tst-mqueue10.c b/rt/tst-mqueue10.c
index 9da9838258..059c064488 100644
--- a/rt/tst-mqueue10.c
+++ b/rt/tst-mqueue10.c
@@ -43,7 +43,15 @@  do_test (void)
 
   struct mq_attr attr = { .mq_maxmsg = 1, .mq_msgsize = sizeof (msg) };
   mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
-  TEST_VERIFY_EXIT (q != (mqd_t) -1);
+
+  if (q == (mqd_t) -1)
+    {
+      if (errno == ENOSYS)
+	FAIL_UNSUPPORTED ("mq_open not supported");
+
+      printf ("mq_open failed with: %m\n");
+      return 1;
+    }
 
   struct timespec ts = { TYPE_MAXIMUM (time_t), 0 };
 
diff --git a/rt/tst-mqueue2.c b/rt/tst-mqueue2.c
index 18fadfe09c..b355d22474 100644
--- a/rt/tst-mqueue2.c
+++ b/rt/tst-mqueue2.c
@@ -27,6 +27,7 @@ 
 #include <sys/wait.h>
 #include <time.h>
 #include <unistd.h>
+#include <support/check.h>
 #include "tst-mqueue.h"
 
 static void
@@ -48,11 +49,14 @@  do_test (void)
 
   if (q == (mqd_t) -1)
     {
+      if (errno == ENOSYS)
+	FAIL_UNSUPPORTED ("mq_open not supported");
+
       printf ("mq_open failed with: %m\n");
-      return result;
+      return 1;
     }
-  else
-    add_temp_mq (name);
+
+  add_temp_mq (name);
 
   mqd_t q2 = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
   if (q2 != (mqd_t) -1)
diff --git a/rt/tst-mqueue3.c b/rt/tst-mqueue3.c
index 812602e2c7..634db921e6 100644
--- a/rt/tst-mqueue3.c
+++ b/rt/tst-mqueue3.c
@@ -27,6 +27,7 @@ 
 #include <sys/mman.h>
 #include <sys/wait.h>
 #include <unistd.h>
+#include <support/check.h>
 
 #if _POSIX_THREADS
 # include <pthread.h>
@@ -161,15 +162,13 @@  do_test (void)
   /* Create the message queue.  */
   struct mq_attr attr = { .mq_maxmsg = MAXMSG, .mq_msgsize = MSGSIZE };
   m = mq_open (mqname, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
+
   if (m == -1)
     {
       if (errno == ENOSYS)
-	{
-	  puts ("not implemented");
-	  return 0;
-	}
+	FAIL_UNSUPPORTED ("mq_open not supported");
 
-      puts ("mq_open failed");
+      printf ("mq_open failed with: %m\n");
       return 1;
     }
 
diff --git a/rt/tst-mqueue4.c b/rt/tst-mqueue4.c
index ea19c27ab4..62d427a3ca 100644
--- a/rt/tst-mqueue4.c
+++ b/rt/tst-mqueue4.c
@@ -29,6 +29,7 @@ 
 #include <sys/wait.h>
 #include <time.h>
 #include <unistd.h>
+#include <support/check.h>
 #include "tst-mqueue.h"
 
 #define TEST_FUNCTION do_test ()
@@ -45,11 +46,14 @@  do_test (void)
 
   if (q == (mqd_t) -1)
     {
+      if (errno == ENOSYS)
+	FAIL_UNSUPPORTED ("mq_open not supported");
+
       printf ("mq_open failed with: %m\n");
-      return result;
+      return 1;
     }
-  else
-    add_temp_mq (name);
+
+  add_temp_mq (name);
 
   *p = '.';
   memset (p + 1, 'x', NAME_MAX + 1 - (p - name));
diff --git a/rt/tst-mqueue5.c b/rt/tst-mqueue5.c
index 24539dbb14..70d97a36c2 100644
--- a/rt/tst-mqueue5.c
+++ b/rt/tst-mqueue5.c
@@ -30,6 +30,7 @@ 
 #include <sys/wait.h>
 #include <time.h>
 #include <unistd.h>
+#include <support/check.h>
 #include "tst-mqueue.h"
 
 #if _POSIX_THREADS && defined SIGRTMIN && defined SA_SIGINFO
@@ -630,11 +631,14 @@  do_test (void)
 
   if (q == (mqd_t) -1)
     {
+      if (errno == ENOSYS)
+	FAIL_UNSUPPORTED ("mq_open not supported");
+
       printf ("mq_open failed with: %m\n");
-      return result;
+      return 1;
     }
-  else
-    add_temp_mq (name);
+
+  add_temp_mq (name);
 
   struct sigevent ev;
   memset (&ev, 0xaa, sizeof (ev));
diff --git a/rt/tst-mqueue6.c b/rt/tst-mqueue6.c
index 4831bf2dc1..bc875f101e 100644
--- a/rt/tst-mqueue6.c
+++ b/rt/tst-mqueue6.c
@@ -30,6 +30,7 @@ 
 #include <sys/wait.h>
 #include <time.h>
 #include <unistd.h>
+#include <support/check.h>
 #include "tst-mqueue.h"
 
 #if _POSIX_THREADS
@@ -116,11 +117,14 @@  do_test (void)
 
   if (q == (mqd_t) -1)
     {
+      if (errno == ENOSYS)
+	FAIL_UNSUPPORTED ("mq_open not supported");
+
       printf ("mq_open failed with: %m\n");
-      return result;
+      return 1;
     }
-  else
-    add_temp_mq (name);
+
+  add_temp_mq (name);
 
   pthread_attr_t nattr;
   if (pthread_attr_init (&nattr)
diff --git a/rt/tst-mqueue7.c b/rt/tst-mqueue7.c
index 302e9e454c..948c0d1326 100644
--- a/rt/tst-mqueue7.c
+++ b/rt/tst-mqueue7.c
@@ -25,6 +25,7 @@ 
 #include <sys/wait.h>
 #include <time.h>
 #include <unistd.h>
+#include <support/check.h>
 
 #define OPT_AFTEREXEC 20000
 
diff --git a/rt/tst-mqueue8.c b/rt/tst-mqueue8.c
index da1e7644e6..b14cde1188 100644
--- a/rt/tst-mqueue8.c
+++ b/rt/tst-mqueue8.c
@@ -23,6 +23,7 @@ 
 #include <unistd.h>
 #if _POSIX_THREADS
 # include <pthread.h>
+# include <support/check.h>
 
 static pthread_barrier_t b;
 
@@ -95,8 +96,11 @@  do_test (void)
 
   if (q == (mqd_t) -1)
     {
+      if (errno == ENOSYS)
+	FAIL_UNSUPPORTED ("mq_open not supported");
+
       printf ("mq_open failed with: %m\n");
-      return 0;
+      return 1;
     }
 
   if (mq_unlink (name) != 0)
diff --git a/rt/tst-mqueue9.c b/rt/tst-mqueue9.c
index ef2233623b..fe991ec32f 100644
--- a/rt/tst-mqueue9.c
+++ b/rt/tst-mqueue9.c
@@ -21,6 +21,7 @@ 
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <support/check.h>
 #include "tst-mqueue.h"
 
 #define TEST_FUNCTION do_test ()
@@ -41,11 +42,14 @@  do_test (void)
 
   if (q == (mqd_t) -1)
     {
+      if (errno == ENOSYS)
+	FAIL_UNSUPPORTED ("mq_open not supported");
+
       printf ("mq_open failed with: %m\n");
-      return 0;
+      return 1;
     }
-  else
-    add_temp_mq (name);
+
+  add_temp_mq (name);
 
   if (seteuid (1) != 0)
     {