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 Make this test skip if running on a kerne...
details: https://anonhg.NetBSD.org/src/rev/5b5cfa7ce88f
branches: trunk
changeset: 826925:5b5cfa7ce88f
user: kre <kre%NetBSD.org@localhost>
date: Fri Oct 06 17:00:28 2017 +0000
description:
Make this test skip if running on a kernel without the SYSVMSG option.
(Assuming this behaves as intended the other tests which should behave
the same way will get upgrades as well.)
diffstat:
tests/lib/libc/sys/t_msgctl.c | 54 +++++++++++++++++++++++++++++++++++++-----
1 files changed, 47 insertions(+), 7 deletions(-)
diffs (85 lines):
diff -r 33fd8b4904f9 -r 5b5cfa7ce88f tests/lib/libc/sys/t_msgctl.c
--- a/tests/lib/libc/sys/t_msgctl.c Fri Oct 06 13:00:57 2017 +0000
+++ b/tests/lib/libc/sys/t_msgctl.c Fri Oct 06 17:00:28 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_msgctl.c,v 1.5 2017/01/13 20:44:45 christos Exp $ */
+/* $NetBSD: t_msgctl.c,v 1.6 2017/10/06 17:00:28 kre Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_msgctl.c,v 1.5 2017/01/13 20:44:45 christos Exp $");
+__RCSID("$NetBSD: t_msgctl.c,v 1.6 2017/10/06 17:00:28 kre Exp $");
#include <sys/msg.h>
#include <sys/stat.h>
@@ -40,6 +40,7 @@
#include <errno.h>
#include <limits.h>
#include <pwd.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -346,14 +347,53 @@
clean();
}
+static volatile int sig_caught;
+
+static void
+sigsys_handler(int signum)
+{
+
+ sig_caught = signum;
+}
+
+static int
+no_kernel_sysvmsg(void)
+{
+ int id;
+
+ sig_caught = 0;
+ (void) signal(SIGSYS, sigsys_handler);
+ id = msgget(MSG_KEY, IPC_CREAT | 0600);
+ if (sig_caught || id == -1)
+ return 1;
+
+ (void)msgctl(id, IPC_RMID, 0);
+
+ return 0;
+}
+
+ATF_TC(msgctl_query);
+ATF_TC_HEAD(msgctl_query, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Skip msgctl_* tests - no SYSVMSG");
+}
+ATF_TC_BODY(msgctl_query, tc)
+{
+ atf_tc_skip("No SYSVMSG in kernel");
+}
+
ATF_TP_ADD_TCS(tp)
{
- ATF_TP_ADD_TC(tp, msgctl_err);
- ATF_TP_ADD_TC(tp, msgctl_perm);
- ATF_TP_ADD_TC(tp, msgctl_pid);
- ATF_TP_ADD_TC(tp, msgctl_set);
- ATF_TP_ADD_TC(tp, msgctl_time);
+ if (no_kernel_sysvmsg()) {
+ ATF_TP_ADD_TC(tp, msgctl_query);
+ } else {
+ ATF_TP_ADD_TC(tp, msgctl_err);
+ ATF_TP_ADD_TC(tp, msgctl_perm);
+ ATF_TP_ADD_TC(tp, msgctl_pid);
+ ATF_TP_ADD_TC(tp, msgctl_set);
+ ATF_TP_ADD_TC(tp, msgctl_time);
+ }
return atf_no_error();
}
Home |
Main Index |
Thread Index |
Old Index