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

Rather than returning 0 or a failure.
This commit is contained in:
Samuel Thibault 2022-01-15 15:52:41 +01:00
parent 5f3a7ebc35
commit 9702a41cee
10 changed files with 61 additions and 25 deletions

View file

@ -26,6 +26,7 @@
#include <time.h>
#include <unistd.h>
#include <stdint.h>
#include <support/check.h>
#include "tst-mqueue.h"
static int
@ -322,10 +323,13 @@ 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);
result |= do_one_test (q, name, 0);

View file

@ -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 };

View file

@ -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,10 +49,13 @@ 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);
mqd_t q2 = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);

View file

@ -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;
}

View file

@ -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,10 +46,13 @@ 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);
*p = '.';

View file

@ -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,10 +631,13 @@ 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);
struct sigevent ev;

View file

@ -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,10 +117,13 @@ 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);
pthread_attr_t nattr;

View file

@ -25,6 +25,7 @@
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>
#include <support/check.h>
#define OPT_AFTEREXEC 20000

View file

@ -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)

View file

@ -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,10 +42,13 @@ 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);
if (seteuid (1) != 0)