Port contrib/netbsd-tests/kernel/kqueue/... as tests/sys/kqueue/...

proc2_test must be skipped because the invariant tested
(`ke.fflags & NOTE_TRACKERR`) doesn't pass.

MFC after:	58 days
Submitted by:	kib (earlier form)
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D6172
This commit is contained in:
ngie 2016-09-06 08:50:21 +00:00
parent 0b264e28ea
commit 3fae667bdc
5 changed files with 34 additions and 0 deletions

View File

@ -34,6 +34,9 @@ __COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_proc2.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
#ifdef __FreeBSD__
#include <sys/types.h>
#endif
#include <sys/event.h>
#include <sys/time.h>
#include <sys/types.h>

View File

@ -32,6 +32,9 @@
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_proc3.c,v 1.2 2015/01/14 22:22:32 christos Exp $");
#ifdef __FreeBSD__
#include <sys/types.h>
#endif
#include <sys/event.h>
#include <sys/time.h>
#include <sys/types.h>

View File

@ -34,6 +34,9 @@ __COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_sig.c,v 1.2 2010/11/03 16:10:20 christos Exp $");
#ifdef __FreeBSD__
#include <sys/types.h>
#endif
#include <sys/event.h>
#include <sys/ioctl.h>
#include <sys/param.h>
@ -60,9 +63,13 @@ ATF_TC_HEAD(sig, tc)
ATF_TC_BODY(sig, tc)
{
struct timespec timeout;
#ifdef __NetBSD__
struct kfilter_mapping km;
#endif
struct kevent event[1];
#ifdef __NetBSD__
char namebuf[32];
#endif
pid_t pid, child;
int kq, n, num, status;
@ -84,16 +91,22 @@ ATF_TC_BODY(sig, tc)
RL(kq = kqueue());
#ifdef __NetBSD__
(void)strlcpy(namebuf, "EVFILT_SIGNAL", sizeof(namebuf));
km.name = namebuf;
RL(ioctl(kq, KFILTER_BYNAME, &km));
(void)printf("got %d as filter number for `%s'.\n", km.filter, km.name);
#endif
/* ignore the signal to avoid taking it for real */
REQUIRE_LIBC(signal(SIGUSR1, SIG_IGN), SIG_ERR);
event[0].ident = SIGUSR1;
#ifdef __NetBSD__
event[0].filter = km.filter;
#else
event[0].filter = EVFILT_SIGNAL;
#endif
event[0].flags = EV_ADD | EV_ENABLE;
RL(kevent(kq, event, 1, NULL, 0, NULL));

View File

@ -1,3 +1,6 @@
#ifdef __FreeBSD__
#include <sys/types.h>
#endif
#include <sys/event.h>
#include <sys/stat.h>
#include <sys/time.h>

View File

@ -1,8 +1,20 @@
# $FreeBSD$
TESTSRC= ${SRCTOP}/contrib/netbsd-tests/kernel/kqueue
TESTSDIR= ${TESTSBASE}/sys/kqueue
BINDIR= ${TESTSDIR}
NETBSD_ATF_TESTS_C= proc1_test
# XXX: fails `ke.fflags & NOTE_TRACKERR` invariant
#NETBSD_ATF_TESTS_C+= proc2_test
NETBSD_ATF_TESTS_C+= proc3_test
NETBSD_ATF_TESTS_C+= sig_test
NETBSD_ATF_TESTS_C+= vnode_test
WARNS?= 3
TESTS_SUBDIRS+= libkqueue
.include <netbsd-tests.test.mk>
.include <bsd.test.mk>