port unit tests to FreeBSD 8.0-STABLE

git-svn-id: svn://svn.code.sf.net/p/libkqueue/code/trunk@90 fb4e3144-bc1c-4b72-a658-5bcd248dd7f7
This commit is contained in:
mheily 2009-11-14 19:13:12 +00:00
parent 75957fe980
commit 2a0180a9de
2 changed files with 17 additions and 0 deletions

View File

@ -155,6 +155,10 @@ kevent_to_str(struct kevent *kev)
void
kevent_cmp(struct kevent *k1, struct kevent *k2)
{
/* Workaround for inconsistent implementation of kevent(2) */
#ifdef __FreeBSD__
k2->flags |= EV_ADD;
#endif
if (memcmp(k1, k2, sizeof(*k1)) != 0) {
printf("kevent_cmp: mismatch:\n %s !=\n %s\n",
kevent_to_str(k1), kevent_to_str(k2));

View File

@ -55,6 +55,8 @@ event_wait(void)
if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0)
err(1, "%s", test_id);
kev.fflags &= ~NOTE_FFCTRLMASK;
kev.fflags &= ~NOTE_TRIGGER;
kevent_cmp(&kev, kevent_get(kqfd));
success(test_id);
@ -84,6 +86,8 @@ disable_and_enable(void)
if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0)
err(1, "%s", test_id);
kev.flags = EV_ADD;
kev.fflags &= ~NOTE_FFCTRLMASK;
kev.fflags &= ~NOTE_TRIGGER;
kevent_cmp(&kev, kevent_get(kqfd));
success(test_id);
@ -105,8 +109,15 @@ oneshot(void)
kev.fflags |= NOTE_TRIGGER;
if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0)
err(1, "%s", test_id);
kev.flags = EV_ADD; // FIXME: Should have ONESHOT flag also
kev.fflags &= ~NOTE_FFCTRLMASK;
kev.fflags &= ~NOTE_TRIGGER;
kevent_cmp(&kev, kevent_get(kqfd));
#ifndef __FreeBSD__
/* FIXME: This does not actually produce an error */
/* Try to trigger the event again. It is deleted, so that
should be an error.
*/
@ -116,6 +127,8 @@ oneshot(void)
if (kevent(kqfd, &kev, 1, NULL, 0, NULL) == 0)
err(1, "%s", test_id);
#endif
success(test_id);
}