Skip to content

Commit

Permalink
tests: add test for EV_SIGNAL with timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
azat committed Feb 18, 2024
1 parent 92ea847 commit 1d08c72
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/regress.c
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,23 @@ test_immediatesignal(void)
cleanup_test();
}

static void
test_signal_timeout(void)
{
struct event ev;
struct timeval tv = { 0, 10 };

test_ok = 0;
evsignal_set(&ev, SIGUSR1, signal_cb, &ev);
tt_int_op(evsignal_add(&ev, &tv), ==, 0);
event_loop(EVLOOP_ONCE);
evsignal_del(&ev);
tt_int_op(test_ok, ==, 1);

end:
cleanup_test();
}

static void
test_signal_dealloc(void)
{
Expand Down Expand Up @@ -3621,6 +3638,7 @@ struct testcase_t signal_testcases[] = {
LEGACY(multiplesignal, TT_ISOLATED|RETRY_ON_DARWIN),
LEGACY(immediatesignal, TT_ISOLATED),
LEGACY(signal_dealloc, TT_ISOLATED),
LEGACY(signal_timeout, TT_ISOLATED),
LEGACY(signal_pipeloss, TT_ISOLATED),
LEGACY(signal_switchbase, TT_ISOLATED|TT_NO_LOGS),
LEGACY(signal_restore, TT_ISOLATED),
Expand Down

0 comments on commit 1d08c72

Please sign in to comment.