Lines Matching +full:test1 +full:. +full:good

2  * Copyright (c) 2003-2007 Niels Provos <provos@citi.umich.edu>
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #include "util-internal.h"
30 #include <winsock2.h>
31 #include <windows.h>
34 #include "event2/event-config.h"
36 #include <sys/types.h>
37 #include <sys/stat.h>
39 #include <sys/time.h>
41 #include <sys/queue.h>
43 #include <sys/socket.h>
44 #include <sys/wait.h>
45 #include <limits.h>
46 #include <signal.h>
47 #include <unistd.h>
48 #include <netdb.h>
50 #include <fcntl.h>
51 #include <signal.h>
52 #include <stdlib.h>
53 #include <stdio.h>
54 #include <string.h>
55 #include <errno.h>
56 #include <assert.h>
57 #include <ctype.h>
59 #include "event2/event.h"
60 #include "event2/event_struct.h"
61 #include "event2/event_compat.h"
62 #include "event2/tag.h"
63 #include "event2/buffer.h"
64 #include "event2/buffer_compat.h"
65 #include "event2/util.h"
66 #include "event-internal.h"
67 #include "evthread-internal.h"
68 #include "log-internal.h"
69 #include "time-internal.h"
71 #include "regress.h"
72 #include "regress_thread.h"
75 #include "regress.gen.h"
92 #define TEST1 "this is a test" macro
169 len = write(fd, TEST1, strlen(TEST1) + 1); in simple_write_cb()
303 if (write(pair[0], TEST1, strlen(TEST1)+1) < 0) { in test_simpleread()
348 if (write(pair[0], TEST1, strlen(TEST1)+1) < 0) { in test_simpleread_multiple()
392 /* Test that a close of FD is detected as a read and as a write. */ in test_simpleclose_rw()
437 tv.tv_sec = 0; in test_simpleclose_rw()
438 tv.tv_usec = 100*1000; /* Close pair1[0] after a little while, and make in test_simpleclose_rw()
439 * sure we get a read event. */ in test_simpleclose_rw()
443 /* Don't let the test go on too long. */ in test_simpleclose_rw()
444 tv.tv_sec = 0; in test_simpleclose_rw()
445 tv.tv_usec = 200*1000; in test_simpleclose_rw()
488 /* XXX: should this code moved to regress_et.c ? */ in test_simpleclose()
510 tv.tv_sec = 0; in test_simpleclose()
511 tv.tv_usec = 10000; in test_simpleclose()
592 w1.nread = 4096; in test_combined()
593 w2.nread = 8192; in test_combined()
595 event_set(&r1.ev, pair[0], EV_READ, combined_read_cb, &r1); in test_combined()
596 event_set(&w1.ev, pair[0], EV_WRITE, combined_write_cb, &w1); in test_combined()
597 event_set(&r2.ev, pair[1], EV_READ, combined_read_cb, &r2); in test_combined()
598 event_set(&w2.ev, pair[1], EV_WRITE, combined_write_cb, &w2); in test_combined()
599 tt_assert(event_add(&r1.ev, NULL) != -1); in test_combined()
600 tt_assert(!event_add(&w1.ev, NULL)); in test_combined()
601 tt_assert(!event_add(&r2.ev, NULL)); in test_combined()
602 tt_assert(!event_add(&w2.ev, NULL)); in test_combined()
605 if (r1.nread == 8192 && r2.nread == 4096) in test_combined()
620 tv.tv_usec = 200*1000; in test_simpletimeout()
621 tv.tv_sec = 0; in test_simpletimeout()
643 * apparently possible for this to get called twice. */ in periodic_timeout_cb()
657 tv.tv_usec = 10000; in test_persistent_timeout()
726 tv.tv_sec = 0; in test_persistent_active_timeout()
727 tv.tv_usec = 200 * 1000; in test_persistent_active_timeout()
732 tv2.tv_sec = 0; in test_persistent_active_timeout()
733 tv2.tv_usec = 100 * 1000; in test_persistent_active_timeout()
736 tv_exit.tv_sec = 0; in test_persistent_active_timeout()
737 tv_exit.tv_usec = 600 * 1000; in test_persistent_active_timeout()
746 tt_int_op(res.n, ==, 3); in test_persistent_active_timeout()
747 tt_int_op(res.events[0], ==, EV_READ); in test_persistent_active_timeout()
748 tt_int_op(res.events[1], ==, EV_TIMEOUT); in test_persistent_active_timeout()
749 tt_int_op(res.events[2], ==, EV_TIMEOUT); in test_persistent_active_timeout()
750 test_timeval_diff_eq(&start, &res.tvs[0], 100); in test_persistent_active_timeout()
751 test_timeval_diff_eq(&start, &res.tvs[1], 300); in test_persistent_active_timeout()
752 test_timeval_diff_eq(&start, &res.tvs[2], 500); in test_persistent_active_timeout()
811 info[i].which = i; in test_common_timeout()
812 event_assign(&info[i].ev, base, -1, EV_TIMEOUT|EV_PERSIST, in test_common_timeout()
817 * transition to non-common timeouts. It's in test_common_timeout()
818 * a little tricky. */ in test_common_timeout()
819 event_add(&info[i].ev, ms_200); in test_common_timeout()
820 event_add(&info[i].ev, &tmp_100_ms); in test_common_timeout()
822 /* Check heap-to-common too. */ in test_common_timeout()
823 event_add(&info[i].ev, &tmp_200_ms); in test_common_timeout()
824 event_add(&info[i].ev, ms_100); in test_common_timeout()
826 /* Also check common-to-common. */ in test_common_timeout()
827 event_add(&info[i].ev, ms_200); in test_common_timeout()
828 event_add(&info[i].ev, ms_100); in test_common_timeout()
830 event_add(&info[i].ev, ms_100); in test_common_timeout()
833 event_add(&info[i].ev, ms_200); in test_common_timeout()
844 tt_int_op(info[i].count, ==, 4); in test_common_timeout()
846 test_timeval_diff_eq(&start, &info[i].called_at, 400); in test_common_timeout()
848 test_timeval_diff_eq(&start, &info[i].called_at, 800); in test_common_timeout()
852 /* Make sure we can free the base with some events in. */ in test_common_timeout()
855 event_add(&info[i].ev, ms_100); in test_common_timeout()
857 event_add(&info[i].ev, ms_200); in test_common_timeout()
947 if (write(pair[0], TEST1, strlen(TEST1)+1) < 0) { in test_fork()
989 * to set test_ok. we just verify that the callback was in test_fork()
990 * called. */ in test_fork()
998 if (write(pair[0], TEST1, strlen(TEST1)+1) < 0) { in test_fork()
1005 if (write(pair[0], TEST1, strlen(TEST1)+1) < 0) { in test_fork()
1066 if (write(pair[0], TEST1, strlen(TEST1)+1) < 0) { in test_del_wait()
1150 itv.it_value.tv_sec = 0; in test_simplesignal_impl()
1151 itv.it_value.tv_usec = 100000; in test_simplesignal_impl()
1192 itv.it_value.tv_sec = 0; in test_multiplesignal()
1193 itv.it_value.tv_usec = 100000; in test_multiplesignal()
1232 /* If we got here without asserting, we're fine. */ in test_signal_dealloc()
1240 /* make sure that the base1 pipe is closed correctly. */ in test_signal_pipeloss()
1245 pipe1 = base1->sig.ev_signal_pair[0]; in test_signal_pipeloss()
1251 printf("signal pipe not closed. "); in test_signal_pipeloss()
1260 * make two bases to catch signals, use both of them. this only works
1261 * for event mechanisms that use our signal pipe trick. kqueue handles
1262 * signals internally, and all interested kqueues get all the signals.
1314 * removed - with no possibility of it's parent handler being fired.
1327 * will still point to evsig_handler(). in test_signal_assert()
1334 /* XXXX Now there's no longer a good way. */ in test_signal_assert()
1335 if (base->sig.evsig_caught) in test_signal_assert()
1349 * assert that we restore our previous signal handler properly.
1362 sa.sa_handler = signal_cb_sa; in test_signal_restore()
1363 sa.sa_flags = 0x0; in test_signal_restore()
1364 sigemptyset(&sa.sa_mask); in test_signal_restore()
1463 /* Make sure an active event is pending. */ in test_manipulate_active_events()
1468 /* Make sure that activating an event twice works. */ in test_manipulate_active_events()
1876 TT_BLATHER(("%d write calls, %d read calls, %d activate-other calls.", in test_active_later()
1888 active immediately. */ in test_active_later()
1889 tt_assert((ev4.ev_flags & EVLIST_ACTIVE) != 0); in test_active_later()
1890 tt_assert((ev4.ev_flags & EVLIST_ACTIVE_LATER) == 0); in test_active_later()
1893 * it. */ in test_active_later()
1975 event_add(ev[3], &ms125); /* timeout. */ in test_event_remove_timeout()
1981 tt_int_op(rntp.events, ==, EV_READ); in test_event_remove_timeout()
2000 int towrite = (int)strlen(TEST1)+1; in test_event_base_new()
2001 int len = write(data->pair[0], TEST1, towrite); in test_event_base_new()
2016 args.eb = base; in test_event_base_new()
2017 args.ev = &ev1; in test_event_base_new()
2018 args.callcount = 0; in test_event_base_new()
2041 tv.tv_usec = 0; in test_loopexit()
2042 tv.tv_sec = 60*60*24; in test_loopexit()
2046 tv.tv_usec = 300*1000; in test_loopexit()
2047 tv.tv_sec = 0; in test_loopexit()
2076 tv.tv_usec = 200*1000; in test_loopexit_multiple()
2077 tv.tv_sec = 0; in test_loopexit_multiple()
2080 tv.tv_usec = 0; in test_loopexit_multiple()
2081 tv.tv_sec = 3; in test_loopexit_multiple()
2122 tv.tv_sec = 0; in test_loopbreak()
2123 tv.tv_usec = 0; in test_loopbreak()
2181 /* At this point, we executed both callbacks. Whichever one got in test_nonpersist_readd()
2183 * deleted before its callback was called. At this point, though, it in test_nonpersist_readd()
2184 * re-added the first. in test_nonpersist_readd()
2235 timeout_set(&one.ev, test_priorities_cb, &one); in test_priorities_impl()
2236 if (event_priority_set(&one.ev, 0) == -1) { in test_priorities_impl()
2241 timeout_set(&two.ev, test_priorities_cb, &two); in test_priorities_impl()
2242 if (event_priority_set(&two.ev, npriorities - 1) == -1) { in test_priorities_impl()
2249 if (event_add(&one.ev, &tv) == -1) in test_priorities_impl()
2251 if (event_add(&two.ev, &tv) == -1) in test_priorities_impl()
2256 event_del(&one.ev); in test_priorities_impl()
2257 event_del(&two.ev); in test_priorities_impl()
2260 if (one.count == 3 && two.count == 3) in test_priorities_impl()
2264 if (one.count == 3 && two.count == 1) in test_priorities_impl()
2267 if (one.count == 3 && two.count == 0) in test_priorities_impl()
2283 * it keeps us from running a lower-priority event first. */
2294 priority with us. */ in prio_active_inversion_cb()
2297 even though we activated it second. */ in prio_active_inversion_cb()
2358 if (write(pair[1], TEST1, strlen(TEST1)+1) < 0) { in test_multiple_events_for_same_fd()
2388 if (write(pair[0], TEST1, strlen(TEST1)+1) < 0) { in read_once_cb()
2408 if (write(pair[0], TEST1, strlen(TEST1)+1) < 0) { in test_want_only_once()
2414 tv.tv_usec = 300*1000; in test_want_only_once()
2492 tv.tv_sec = 1; in evtag_fuzz()
2619 n = sscanf(vstr, "%d.%d.%d", &major, &minor, &patch); in test_version()
2700 /* See if unsetenv works before we rely on it. */ in test_base_environ()
2802 tv.tv_sec = 0; in test_event_once()
2803 tv.tv_usec = 50*1000; in test_event_once()
2816 tv.tv_sec = 0; in test_event_once()
2817 tv.tv_usec = 0; in test_event_once()
2822 if (write(data->pair[1], TEST1, strlen(TEST1)+1) < 0) { in test_event_once()
2842 tv.tv_sec = 10; in test_event_once_never()
2843 tv.tv_usec = 0; in test_event_once_never()
2848 /* But shut down the base in 75 msec. */ in test_event_once_never()
2849 tv.tv_sec = 0; in test_event_once_never()
2850 tv.tv_usec = 75*1000; in test_event_once_never()
2867 tv.tv_sec = 0; in test_event_pending()
2868 tv.tv_usec = 500 * 1000; in test_event_pending()
2932 tv.tv_sec = 0; in test_event_closed_fd_poll()
2933 tv.tv_usec = 500 * 1000; in test_event_closed_fd_poll()
2979 /* Now close and delete dfd then dispatch. We need to do the in test_dup_fd()
2981 * was an intermediate delete. */ in test_dup_fd()
2989 /* Re-duplicate the fd. We need to get the same duplicated in test_dup_fd()
2990 * value that we closed to provoke the epoll quirk. Also, we in test_dup_fd()
2993 * successful or not. */ in test_dup_fd()
3086 /* Try 70 events that should all be ready at once. This will in test_many_events()
3089 * functions. */ in test_many_events()
3111 * be ready immediately. "Send a datagram" is an easy in test_many_events()
3112 * instance of that. */ in test_many_events()
3174 /* Now make sure this doesn't crash. */ in test_get_assignment()
3229 visited[i].count = 0; in test_event_foreach()
3230 visited[i].ev = NULL; in test_event_foreach()
3242 /* Don't touch ev[4]. */ in test_event_foreach()
3246 tt_int_op(1, ==, visited[0].count); in test_event_foreach()
3247 tt_int_op(1, ==, visited[1].count); in test_event_foreach()
3248 tt_int_op(1, ==, visited[2].count); in test_event_foreach()
3249 tt_int_op(1, ==, visited[3].count); in test_event_foreach()
3250 tt_ptr_op(ev[0], ==, visited[0].ev); in test_event_foreach()
3251 tt_ptr_op(ev[1], ==, visited[1].ev); in test_event_foreach()
3252 tt_ptr_op(ev[2], ==, visited[2].ev); in test_event_foreach()
3253 tt_ptr_op(ev[3], ==, visited[3].ev); in test_event_foreach()
3255 visited[2].count = 99; in test_event_foreach()
3302 /* Try gettimeofday_cached outside of an event loop. */ in test_gettimeofday_cached()
3407 /* Ensure no crash on nonexistent FD. */ in test_active_by_fd()
3410 /* Ensure no crash on bogus FD. */ in test_active_by_fd()
3413 /* Ensure no crash on nonexistent/bogus signal. */ in test_active_by_fd()
3457 /* Mask out EV_WRITE here, since it could be genuinely writeable. */ in test_active_by_fd()
3510 /* These legacy tests may not all need all of these flags. */