Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/sys Don't bother attempting any of the (real)...
details: https://anonhg.NetBSD.org/src/rev/120ec9ab9a2a
branches: trunk
changeset: 826991:120ec9ab9a2a
user: kre <kre%NetBSD.org@localhost>
date: Sun Oct 08 08:31:05 2017 +0000
description:
Don't bother attempting any of the (real) test cases if the SYSVMSG
option isn't configured in the kernel.
diffstat:
tests/lib/libc/sys/t_msgget.c | 54 +++++++++++++++++++++++++++++++++++-----
tests/lib/libc/sys/t_msgrcv.c | 57 ++++++++++++++++++++++++++++++++++++------
tests/lib/libc/sys/t_msgsnd.c | 55 ++++++++++++++++++++++++++++++++++++-----
3 files changed, 144 insertions(+), 22 deletions(-)
diffs (239 lines):
diff -r 2aff19c665ba -r 120ec9ab9a2a tests/lib/libc/sys/t_msgget.c
--- a/tests/lib/libc/sys/t_msgget.c Sun Oct 08 08:29:57 2017 +0000
+++ b/tests/lib/libc/sys/t_msgget.c Sun Oct 08 08:31:05 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_msgget.c,v 1.2 2014/02/27 00:59:50 joerg Exp $ */
+/* $NetBSD: t_msgget.c,v 1.3 2017/10/08 08:31:05 kre Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_msgget.c,v 1.2 2014/02/27 00:59:50 joerg Exp $");
+__RCSID("$NetBSD: t_msgget.c,v 1.3 2017/10/08 08:31:05 kre Exp $");
#include <sys/msg.h>
#include <sys/stat.h>
@@ -278,15 +278,55 @@
clean();
}
+static volatile int sig_caught;
+
+static void
+sigsys_handler(int signum)
+{
+
+ sig_caught = signum;
+}
+
+static int
+no_kernel_sysvmsg(void)
+{
+ int id;
+ void (*osig)(int);
+
+ sig_caught = 0;
+ osig = signal(SIGSYS, sigsys_handler);
+ id = msgget(MSG_KEY, IPC_CREAT | 0600);
+ if (sig_caught || id == -1)
+ return 1;
+
+ (void)msgctl(id, IPC_RMID, 0);
+ (void)signal(SIGSYS, osig);
+
+ return 0;
+}
+
+ATF_TC(msgget_query);
+ATF_TC_HEAD(msgget_query, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Skip msgget_* tests - no SYSVMSG");
+}
+ATF_TC_BODY(msgget_query, tc)
+{
+ atf_tc_skip("No SYSVMSG in kernel");
+}
ATF_TP_ADD_TCS(tp)
{
- ATF_TP_ADD_TC(tp, msgget_excl);
- ATF_TP_ADD_TC(tp, msgget_exit);
- ATF_TP_ADD_TC(tp, msgget_init);
- ATF_TP_ADD_TC(tp, msgget_limit);
- ATF_TP_ADD_TC(tp, msgget_mode);
+ if (no_kernel_sysvmsg()) {
+ ATF_TP_ADD_TC(tp, msgget_query);
+ } else {
+ ATF_TP_ADD_TC(tp, msgget_excl);
+ ATF_TP_ADD_TC(tp, msgget_exit);
+ ATF_TP_ADD_TC(tp, msgget_init);
+ ATF_TP_ADD_TC(tp, msgget_limit);
+ ATF_TP_ADD_TC(tp, msgget_mode);
+ }
return atf_no_error();
}
diff -r 2aff19c665ba -r 120ec9ab9a2a tests/lib/libc/sys/t_msgrcv.c
--- a/tests/lib/libc/sys/t_msgrcv.c Sun Oct 08 08:29:57 2017 +0000
+++ b/tests/lib/libc/sys/t_msgrcv.c Sun Oct 08 08:31:05 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_msgrcv.c,v 1.4 2017/01/13 20:44:45 christos Exp $ */
+/* $NetBSD: t_msgrcv.c,v 1.5 2017/10/08 08:31:05 kre Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_msgrcv.c,v 1.4 2017/01/13 20:44:45 christos Exp $");
+__RCSID("$NetBSD: t_msgrcv.c,v 1.5 2017/10/08 08:31:05 kre Exp $");
#include <sys/msg.h>
#include <sys/stat.h>
@@ -329,15 +329,56 @@
clean();
}
+static volatile int sig_caught;
+
+static void
+sigsys_handler(int signum)
+{
+
+ sig_caught = signum;
+}
+
+static int
+no_kernel_sysvmsg(void)
+{
+ int id;
+ void (*osig)(int);
+
+ sig_caught = 0;
+ osig = signal(SIGSYS, sigsys_handler);
+ id = msgget(MSG_KEY, IPC_CREAT | 0600);
+ if (sig_caught || id == -1)
+ return 1;
+
+ (void)msgctl(id, IPC_RMID, 0);
+ (void)signal(SIGSYS, osig);
+
+ return 0;
+}
+
+ATF_TC(msgrcv_query);
+ATF_TC_HEAD(msgrcv_query, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Skip msgrcv_* tests - no SYSVMSG");
+}
+ATF_TC_BODY(msgrcv_query, tc)
+{
+ atf_tc_skip("No SYSVMSG in kernel");
+}
+
ATF_TP_ADD_TCS(tp)
{
- ATF_TP_ADD_TC(tp, msgrcv_basic);
- ATF_TP_ADD_TC(tp, msgrcv_block);
- ATF_TP_ADD_TC(tp, msgrcv_err);
- ATF_TP_ADD_TC(tp, msgrcv_mtype);
- ATF_TP_ADD_TC(tp, msgrcv_nonblock);
- ATF_TP_ADD_TC(tp, msgrcv_truncate);
+ if (no_kernel_sysvmsg()) {
+ ATF_TP_ADD_TC(tp, msgrcv_query);
+ } else {
+ ATF_TP_ADD_TC(tp, msgrcv_basic);
+ ATF_TP_ADD_TC(tp, msgrcv_block);
+ ATF_TP_ADD_TC(tp, msgrcv_err);
+ ATF_TP_ADD_TC(tp, msgrcv_mtype);
+ ATF_TP_ADD_TC(tp, msgrcv_nonblock);
+ ATF_TP_ADD_TC(tp, msgrcv_truncate);
+ }
return atf_no_error();
}
diff -r 2aff19c665ba -r 120ec9ab9a2a tests/lib/libc/sys/t_msgsnd.c
--- a/tests/lib/libc/sys/t_msgsnd.c Sun Oct 08 08:29:57 2017 +0000
+++ b/tests/lib/libc/sys/t_msgsnd.c Sun Oct 08 08:31:05 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_msgsnd.c,v 1.3 2017/01/13 20:44:45 christos Exp $ */
+/* $NetBSD: t_msgsnd.c,v 1.4 2017/10/08 08:31:05 kre Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_msgsnd.c,v 1.3 2017/01/13 20:44:45 christos Exp $");
+__RCSID("$NetBSD: t_msgsnd.c,v 1.4 2017/10/08 08:31:05 kre Exp $");
#include <sys/msg.h>
#include <sys/stat.h>
@@ -326,14 +326,55 @@
clean();
}
+static volatile int sig_caught;
+
+static void
+sigsys_handler(int signum)
+{
+
+ sig_caught = signum;
+}
+
+static int
+no_kernel_sysvmsg(void)
+{
+ int id;
+ void (*osig)(int);
+
+ sig_caught = 0;
+ osig = signal(SIGSYS, sigsys_handler);
+ id = msgget(MSG_KEY, IPC_CREAT | 0600);
+ if (sig_caught || id == -1)
+ return 1;
+
+ (void)msgctl(id, IPC_RMID, 0);
+ (void)signal(SIGSYS, osig);
+
+ return 0;
+}
+
+ATF_TC(msgsnd_query);
+ATF_TC_HEAD(msgsnd_query, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Skip msgsnd_* tests - no SYSVMSG");
+}
+ATF_TC_BODY(msgsnd_query, tc)
+{
+ atf_tc_skip("No SYSVMSG in kernel");
+}
+
ATF_TP_ADD_TCS(tp)
{
- ATF_TP_ADD_TC(tp, msgsnd_block);
- ATF_TP_ADD_TC(tp, msgsnd_count);
- ATF_TP_ADD_TC(tp, msgsnd_err);
- ATF_TP_ADD_TC(tp, msgsnd_nonblock);
- ATF_TP_ADD_TC(tp, msgsnd_perm);
+ if (no_kernel_sysvmsg()) {
+ ATF_TP_ADD_TC(tp, msgsnd_query);
+ } else {
+ ATF_TP_ADD_TC(tp, msgsnd_block);
+ ATF_TP_ADD_TC(tp, msgsnd_count);
+ ATF_TP_ADD_TC(tp, msgsnd_err);
+ ATF_TP_ADD_TC(tp, msgsnd_nonblock);
+ ATF_TP_ADD_TC(tp, msgsnd_perm);
+ }
return atf_no_error();
}
Home |
Main Index |
Thread Index |
Old Index