]> granicus.if.org Git - libevent/commitdiff
test/regress: cover existing signal callbacks and fork() + event_reinit()
authorAzat Khuzhin <a3at.mail@gmail.com>
Sat, 26 Dec 2015 23:48:40 +0000 (02:48 +0300)
committerAzat Khuzhin <a3at.mail@gmail.com>
Sun, 27 Dec 2015 06:30:10 +0000 (09:30 +0300)
Regression-for: 88640aa ("event_reinit: make signals works after fork() without
evsig_add()")

test/regress.c

index 7d785904776d077490b9c3f2500c89ee85b42e37..ae5486963740f1c62bf35e47c62eb13765fd0acb 100644 (file)
@@ -832,7 +832,7 @@ static void
 test_fork(void)
 {
        int status;
-       struct event ev, sig_ev, usr_ev;
+       struct event ev, sig_ev, usr_ev, existing_ev;
        pid_t pid;
 
        setup_test("After fork: ");
@@ -851,6 +851,9 @@ test_fork(void)
        evsignal_set(&sig_ev, SIGCHLD, fork_signal_cb, &sig_ev);
        evsignal_add(&sig_ev, NULL);
 
+       evsignal_set(&existing_ev, SIGUSR2, fork_signal_cb, &existing_ev);
+       evsignal_add(&existing_ev, NULL);
+
        event_base_assert_ok_(current_base);
        TT_BLATHER(("Before fork"));
        if ((pid = regress_fork()) == 0) {
@@ -870,6 +873,7 @@ test_fork(void)
                evsignal_set(&usr_ev, SIGUSR1, fork_signal_cb, &usr_ev);
                evsignal_add(&usr_ev, NULL);
                raise(SIGUSR1);
+               raise(SIGUSR2);
 
                called = 0;
 
@@ -915,6 +919,7 @@ test_fork(void)
        evsignal_set(&usr_ev, SIGUSR1, fork_signal_cb, &usr_ev);
        evsignal_add(&usr_ev, NULL);
        raise(SIGUSR1);
+       raise(SIGUSR2);
 
        event_dispatch();