summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ObsoleteFiles.inc3
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c4
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/read/t_file.c4
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c4
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c4
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_proc1.c4
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_proc2.c3
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_proc3.c3
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_sig.c17
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_vnode.c3
-rw-r--r--etc/mtree/BSD.tests.dist2
-rw-r--r--tests/sys/kqueue/Makefile28
-rw-r--r--tests/sys/kqueue/libkqueue/Makefile21
-rw-r--r--tests/sys/kqueue/libkqueue/Makefile.depend (renamed from tests/sys/kqueue/Makefile.depend)0
-rw-r--r--tests/sys/kqueue/libkqueue/common.h (renamed from tests/sys/kqueue/common.h)0
-rw-r--r--tests/sys/kqueue/libkqueue/config.h (renamed from tests/sys/kqueue/config.h)0
-rwxr-xr-xtests/sys/kqueue/libkqueue/kqueue_test.sh (renamed from tests/sys/kqueue/kqueue_test.sh)4
-rw-r--r--tests/sys/kqueue/libkqueue/main.c (renamed from tests/sys/kqueue/main.c)0
-rw-r--r--tests/sys/kqueue/libkqueue/proc.c (renamed from tests/sys/kqueue/proc.c)0
-rw-r--r--tests/sys/kqueue/libkqueue/read.c (renamed from tests/sys/kqueue/read.c)0
-rw-r--r--tests/sys/kqueue/libkqueue/signal.c (renamed from tests/sys/kqueue/signal.c)0
-rw-r--r--tests/sys/kqueue/libkqueue/timer.c (renamed from tests/sys/kqueue/timer.c)0
-rw-r--r--tests/sys/kqueue/libkqueue/user.c (renamed from tests/sys/kqueue/user.c)0
-rw-r--r--tests/sys/kqueue/libkqueue/vnode.c (renamed from tests/sys/kqueue/vnode.c)22
24 files changed, 96 insertions, 30 deletions
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index d3ceaa7..1b5cef2 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -51,6 +51,9 @@ OLD_FILES+=usr/share/man/man4/hv_vss.4.gz
OLD_FILES+=usr/share/man/man4/hv_ata_pci_disengage.4.gz
# 20161015: remove link to removed m_getclr(9) macro
OLD_FILES+=usr/share/man/man9/m_getclr.9.gz
+# 20160906: libkqueue tests moved to /usr/tests/sys/kqueue/libkqueue
+OLD_FILES+=usr/tests/sys/kqueue/kqtest
+OLD_FILES+=usr/tests/sys/kqueue/kqueue_test
# 20160703: POSIXify locales with variants
OLD_FILES+=usr/share/locale/zh_Hant_TW.UTF-8/LC_COLLATE
OLD_FILES+=usr/share/locale/zh_Hant_TW.UTF-8/LC_CTYPE
diff --git a/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c b/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c
index 5908547..19c7b02 100644
--- a/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c
+++ b/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c
@@ -78,7 +78,11 @@ ATF_TC_BODY(fifo, tc)
RL(n = kevent(kq, NULL, 0, event, 1, NULL));
(void)printf("kevent num %d filt %d flags: %#x, fflags: %#x, "
+#ifdef __FreeBSD__
+ "data: %" PRIdPTR "\n", n, event[0].filter, event[0].flags,
+#else
"data: %" PRId64 "\n", n, event[0].filter, event[0].flags,
+#endif
event[0].fflags, event[0].data);
ATF_REQUIRE_EQ(event[0].filter, EVFILT_READ);
diff --git a/contrib/netbsd-tests/kernel/kqueue/read/t_file.c b/contrib/netbsd-tests/kernel/kqueue/read/t_file.c
index 2335172..80479af 100644
--- a/contrib/netbsd-tests/kernel/kqueue/read/t_file.c
+++ b/contrib/netbsd-tests/kernel/kqueue/read/t_file.c
@@ -111,7 +111,11 @@ ATF_TC_BODY(file, tc)
num += n;
(void)printf("kevent num %d flags: %#x, fflags: %#x, data: "
+#ifdef __FreeBSD__
+ "%" PRIdPTR "\n", n, event[0].flags, event[0].fflags,
+#else
"%" PRId64 "\n", n, event[0].flags, event[0].fflags,
+#endif
event[0].data);
if (event[0].data < 0)
diff --git a/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c b/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c
index d8e05f2..2cdd015 100644
--- a/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c
+++ b/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c
@@ -67,7 +67,11 @@ ATF_TC_BODY(pipe, tc)
RL(n = kevent(kq, NULL, 0, event, 1, NULL));
(void)printf("kevent num %d flags: %#x, fflags: %#x, data: "
+#ifdef __FreeBSD__
+ "%" PRIdPTR "\n", n, event[0].flags, event[0].fflags, event[0].data);
+#else
"%" PRId64 "\n", n, event[0].flags, event[0].fflags, event[0].data);
+#endif
RL(n = read(fds[0], buffer, event[0].data));
buffer[n] = '\0';
diff --git a/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c b/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c
index 3a42fd3..57ccf92 100644
--- a/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c
+++ b/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c
@@ -103,7 +103,11 @@ h_check(bool check_master)
RL(n = kevent(kq, NULL, 0, event, 1, NULL));
(void)printf("kevent num %d filt %d flags: %#x, fflags: %#x, "
+#ifdef __FreeBSD__
+ "data: %" PRIdPTR "\n", n, event[0].filter, event[0].flags,
+#else
"data: %" PRId64 "\n", n, event[0].filter, event[0].flags,
+#endif
event[0].fflags, event[0].data);
ATF_REQUIRE_EQ(event[0].filter, EVFILT_READ);
diff --git a/contrib/netbsd-tests/kernel/kqueue/t_proc1.c b/contrib/netbsd-tests/kernel/kqueue/t_proc1.c
index 07d5a3c..aa806ba 100644
--- a/contrib/netbsd-tests/kernel/kqueue/t_proc1.c
+++ b/contrib/netbsd-tests/kernel/kqueue/t_proc1.c
@@ -139,7 +139,11 @@ ATF_TC_BODY(proc1, tc)
printf(" NOTE_FORK");
}
if (event[0].fflags & NOTE_CHILD)
+#ifdef __FreeBSD__
+ printf(" NOTE_CHILD, parent = %" PRIdPTR, event[0].data);
+#else
printf(" NOTE_CHILD, parent = %" PRId64, event[0].data);
+#endif
printf("\n");
}
diff --git a/contrib/netbsd-tests/kernel/kqueue/t_proc2.c b/contrib/netbsd-tests/kernel/kqueue/t_proc2.c
index e70fcb2..2d8d7f7 100644
--- a/contrib/netbsd-tests/kernel/kqueue/t_proc2.c
+++ b/contrib/netbsd-tests/kernel/kqueue/t_proc2.c
@@ -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>
diff --git a/contrib/netbsd-tests/kernel/kqueue/t_proc3.c b/contrib/netbsd-tests/kernel/kqueue/t_proc3.c
index b77510b..eac2f9c 100644
--- a/contrib/netbsd-tests/kernel/kqueue/t_proc3.c
+++ b/contrib/netbsd-tests/kernel/kqueue/t_proc3.c
@@ -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>
diff --git a/contrib/netbsd-tests/kernel/kqueue/t_sig.c b/contrib/netbsd-tests/kernel/kqueue/t_sig.c
index 4fc0758..ebbd76e 100644
--- a/contrib/netbsd-tests/kernel/kqueue/t_sig.c
+++ b/contrib/netbsd-tests/kernel/kqueue/t_sig.c
@@ -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));
@@ -117,7 +130,11 @@ ATF_TC_BODY(sig, tc)
if (n == 0)
continue;
+#ifdef __FreeBSD__
+ (void)printf("sig: kevent flags: 0x%x, data: %" PRIdPTR " (# "
+#else
(void)printf("sig: kevent flags: 0x%x, data: %" PRId64 " (# "
+#endif
"times signal posted)\n", event[0].flags, event[0].data);
}
diff --git a/contrib/netbsd-tests/kernel/kqueue/t_vnode.c b/contrib/netbsd-tests/kernel/kqueue/t_vnode.c
index e87c2b2..06ef683 100644
--- a/contrib/netbsd-tests/kernel/kqueue/t_vnode.c
+++ b/contrib/netbsd-tests/kernel/kqueue/t_vnode.c
@@ -1,3 +1,6 @@
+#ifdef __FreeBSD__
+#include <sys/types.h>
+#endif
#include <sys/event.h>
#include <sys/stat.h>
#include <sys/time.h>
diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist
index ae17129..6cd0e85 100644
--- a/etc/mtree/BSD.tests.dist
+++ b/etc/mtree/BSD.tests.dist
@@ -419,6 +419,8 @@
..
..
kqueue
+ libkqueue
+ ..
..
mac
bsdextended
diff --git a/tests/sys/kqueue/Makefile b/tests/sys/kqueue/Makefile
index 43277ca..40f892d 100644
--- a/tests/sys/kqueue/Makefile
+++ b/tests/sys/kqueue/Makefile
@@ -1,26 +1,20 @@
# $FreeBSD$
-#
-# svn://mark.heily.com/libkqueue/trunk/test
-# Last update: r114
-#
-# libkqueue and test suite by Mark Heily <mark@heily.com>
-#
-TAP_TESTS_SH= kqueue_test
+TESTSRC= ${SRCTOP}/contrib/netbsd-tests/kernel/kqueue
TESTSDIR= ${TESTSBASE}/sys/kqueue
BINDIR= ${TESTSDIR}
-PROGS= kqtest
+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
-SRCS.kqtest= \
- main.c \
- read.c \
- timer.c \
- vnode.c \
- proc.c \
- signal.c \
- user.c
-WARNS?= 2
+WARNS?= 3
+TESTS_SUBDIRS+= libkqueue
+
+.include <netbsd-tests.test.mk>
.include <bsd.test.mk>
diff --git a/tests/sys/kqueue/libkqueue/Makefile b/tests/sys/kqueue/libkqueue/Makefile
new file mode 100644
index 0000000..94d198b
--- /dev/null
+++ b/tests/sys/kqueue/libkqueue/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/sys/kqueue/libkqueue
+BINDIR= ${TESTSDIR}
+
+# libkqueue and test suite by Mark Heily <mark@heily.com>
+TAP_TESTS_SH= kqueue_test
+
+PROGS= kqtest
+
+SRCS.kqtest= \
+ main.c \
+ read.c \
+ timer.c \
+ vnode.c \
+ proc.c \
+ signal.c \
+ user.c
+WARNS?= 2
+
+.include <bsd.test.mk>
diff --git a/tests/sys/kqueue/Makefile.depend b/tests/sys/kqueue/libkqueue/Makefile.depend
index 3646e2e..3646e2e 100644
--- a/tests/sys/kqueue/Makefile.depend
+++ b/tests/sys/kqueue/libkqueue/Makefile.depend
diff --git a/tests/sys/kqueue/common.h b/tests/sys/kqueue/libkqueue/common.h
index 89a4029..89a4029 100644
--- a/tests/sys/kqueue/common.h
+++ b/tests/sys/kqueue/libkqueue/common.h
diff --git a/tests/sys/kqueue/config.h b/tests/sys/kqueue/libkqueue/config.h
index a204092..a204092 100644
--- a/tests/sys/kqueue/config.h
+++ b/tests/sys/kqueue/libkqueue/config.h
diff --git a/tests/sys/kqueue/kqueue_test.sh b/tests/sys/kqueue/libkqueue/kqueue_test.sh
index 62a7e23..3185d82 100755
--- a/tests/sys/kqueue/kqueue_test.sh
+++ b/tests/sys/kqueue/libkqueue/kqueue_test.sh
@@ -1,8 +1,8 @@
#!/bin/sh
+# $FreeBSD$
-cd $(dirname $0)
i=1
-./kqtest | while read line; do
+"$(dirname $0)/kqtest" | while read line; do
echo $line | grep -q passed
if [ $? -eq 0 ]; then
echo "ok - $i $line"
diff --git a/tests/sys/kqueue/main.c b/tests/sys/kqueue/libkqueue/main.c
index 553478a..553478a 100644
--- a/tests/sys/kqueue/main.c
+++ b/tests/sys/kqueue/libkqueue/main.c
diff --git a/tests/sys/kqueue/proc.c b/tests/sys/kqueue/libkqueue/proc.c
index 79b8d35..79b8d35 100644
--- a/tests/sys/kqueue/proc.c
+++ b/tests/sys/kqueue/libkqueue/proc.c
diff --git a/tests/sys/kqueue/read.c b/tests/sys/kqueue/libkqueue/read.c
index 2837144..2837144 100644
--- a/tests/sys/kqueue/read.c
+++ b/tests/sys/kqueue/libkqueue/read.c
diff --git a/tests/sys/kqueue/signal.c b/tests/sys/kqueue/libkqueue/signal.c
index 14e751d..14e751d 100644
--- a/tests/sys/kqueue/signal.c
+++ b/tests/sys/kqueue/libkqueue/signal.c
diff --git a/tests/sys/kqueue/timer.c b/tests/sys/kqueue/libkqueue/timer.c
index 766125d..766125d 100644
--- a/tests/sys/kqueue/timer.c
+++ b/tests/sys/kqueue/libkqueue/timer.c
diff --git a/tests/sys/kqueue/user.c b/tests/sys/kqueue/libkqueue/user.c
index 9ba25f9..9ba25f9 100644
--- a/tests/sys/kqueue/user.c
+++ b/tests/sys/kqueue/libkqueue/user.c
diff --git a/tests/sys/kqueue/vnode.c b/tests/sys/kqueue/libkqueue/vnode.c
index dfa0b5e..55d5b3f 100644
--- a/tests/sys/kqueue/vnode.c
+++ b/tests/sys/kqueue/libkqueue/vnode.c
@@ -25,12 +25,12 @@ void
test_kevent_vnode_add(void)
{
const char *test_id = "kevent(EVFILT_VNODE, EV_ADD)";
- const char *testfile = "/tmp/kqueue-test.tmp";
+ const char *testfile = "./kqueue-test.tmp";
struct kevent kev;
test_begin(test_id);
- system("touch /tmp/kqueue-test.tmp");
+ system("touch ./kqueue-test.tmp");
vnode_fd = open(testfile, O_RDONLY);
if (vnode_fd < 0)
err(1, "open of %s", testfile);
@@ -57,7 +57,7 @@ test_kevent_vnode_note_delete(void)
if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0)
err(1, "%s", test_id);
- if (unlink("/tmp/kqueue-test.tmp") < 0)
+ if (unlink("./kqueue-test.tmp") < 0)
err(1, "unlink");
kevent_cmp(&kev, kevent_get(kqfd));
@@ -77,7 +77,7 @@ test_kevent_vnode_note_write(void)
if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0)
err(1, "%s", test_id);
- if (system("echo hello >> /tmp/kqueue-test.tmp") < 0)
+ if (system("echo hello >> ./kqueue-test.tmp") < 0)
err(1, "system");
/* BSD kqueue adds NOTE_EXTEND even though it was not requested */
@@ -102,7 +102,7 @@ test_kevent_vnode_note_attrib(void)
if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0)
err(1, "%s", test_id);
- if (system("touch /tmp/kqueue-test.tmp") < 0)
+ if (system("touch ./kqueue-test.tmp") < 0)
err(1, "system");
nfds = kevent(kqfd, NULL, 0, &kev, 1, NULL);
@@ -130,7 +130,7 @@ test_kevent_vnode_note_rename(void)
if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0)
err(1, "%s", test_id);
- if (system("mv /tmp/kqueue-test.tmp /tmp/kqueue-test2.tmp") < 0)
+ if (system("mv ./kqueue-test.tmp ./kqueue-test2.tmp") < 0)
err(1, "system");
nfds = kevent(kqfd, NULL, 0, &kev, 1, NULL);
@@ -142,7 +142,7 @@ test_kevent_vnode_note_rename(void)
err(1, "%s - incorrect event (sig=%u; filt=%d; flags=%d)",
test_id, (unsigned int)kev.ident, kev.filter, kev.flags);
- if (system("mv /tmp/kqueue-test2.tmp /tmp/kqueue-test.tmp") < 0)
+ if (system("mv ./kqueue-test2.tmp ./kqueue-test.tmp") < 0)
err(1, "system");
success();
@@ -183,7 +183,7 @@ test_kevent_vnode_disable_and_enable(void)
err(1, "%s", test_id);
/* Confirm that the watch is disabled */
- if (system("touch /tmp/kqueue-test.tmp") < 0)
+ if (system("touch ./kqueue-test.tmp") < 0)
err(1, "system");
test_no_kevents();
@@ -191,7 +191,7 @@ test_kevent_vnode_disable_and_enable(void)
kev.flags = EV_ENABLE;
if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0)
err(1, "%s", test_id);
- if (system("touch /tmp/kqueue-test.tmp") < 0)
+ if (system("touch ./kqueue-test.tmp") < 0)
err(1, "system");
nfds = kevent(kqfd, NULL, 0, &kev, 1, NULL);
if (nfds < 1)
@@ -221,7 +221,7 @@ test_kevent_vnode_dispatch(void)
if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0)
err(1, "%s", test_id);
- if (system("touch /tmp/kqueue-test.tmp") < 0)
+ if (system("touch ./kqueue-test.tmp") < 0)
err(1, "system");
nfds = kevent(kqfd, NULL, 0, &kev, 1, NULL);
@@ -235,7 +235,7 @@ test_kevent_vnode_dispatch(void)
/* Confirm that the watch is disabled automatically */
puts("-- checking that watch is disabled");
- if (system("touch /tmp/kqueue-test.tmp") < 0)
+ if (system("touch ./kqueue-test.tmp") < 0)
err(1, "system");
test_no_kevents();
OpenPOWER on IntegriCloud