Changeset 71f66e7 in rtems-libbsd


Ignore:
Timestamp:
Jun 10, 2016, 11:05:16 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
647dd08ae2aa69b935c2847ea450fb824322ecae, freebsd-9.3, c6261f97870562d4c797cfb1ff1ba0affb85a916
Children:
68d406b
Parents:
17232fe
git-author:
Sebastian Huber <sebastian.huber@…> (06/10/16 11:05:16)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/10/16 12:03:34)
Message:

selectpollkqueue01: Add EVFILT_USER test case

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuite/selectpollkqueue01/test_main.c

    r17232fe r71f66e7  
    958958
    959959static void
     960test_kqueue_user(test_context *ctx)
     961{
     962        int kq;
     963        uintptr_t ident;
     964        u_int flag;
     965        struct kevent change;
     966        struct kevent trigger;
     967        struct kevent event;
     968        const struct timespec *timeout = NULL;
     969        int rv;
     970        ssize_t n;
     971
     972        puts("test kqueue user");
     973
     974        ident = 0xabc;
     975        flag = 0x1;
     976
     977        kq = kqueue();
     978        assert(kq >= 0);
     979
     980        EV_SET(&change, ident, EVFILT_USER, EV_ADD | EV_ENABLE, NOTE_FFNOP, 0,
     981            TEST_UDATA);
     982
     983        rv = kevent(kq, &change, 1, NULL, 0, timeout);
     984        assert(rv == 0);
     985
     986        ident = 0xabc;
     987        EV_SET(&trigger, ident, EVFILT_USER, 0, NOTE_TRIGGER | NOTE_FFCOPY |
     988            flag, 0, TEST_UDATA);
     989
     990        rv = kevent(kq, &trigger, 1, NULL, 0, timeout);
     991        assert(rv == 0);
     992
     993        memset(&event, 0, sizeof(event));
     994        rv = kevent(kq, NULL, 0, &event, 1, timeout);
     995        assert(rv == 1);
     996        assert(event.ident == ident);
     997        assert(event.filter == EVFILT_USER);
     998        assert(event.flags == 0);
     999        assert(event.fflags == flag);
     1000        assert(event.data == 0);
     1001        assert(event.udata == TEST_UDATA);
     1002
     1003        rv = close(kq);
     1004        assert(rv == 0);
     1005}
     1006
     1007static void
    9601008test_main(void)
    9611009{
     
    9861034        test_kqueue_write(ctx);
    9871035        test_kqueue_close(ctx);
     1036        test_kqueue_user(ctx);
    9881037
    9891038        exit(0);
Note: See TracChangeset for help on using the changeset viewer.