From: Lennart Poettering Date: Thu, 25 Feb 2021 11:04:49 +0000 (+0100) Subject: test-signal-util: add test for signal_is_blocked() X-Git-Tag: v248-rc3~90 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=35f4b6d8ba6644679370abd7205a35be44a6e1a9;p=thirdparty%2Fsystemd.git test-signal-util: add test for signal_is_blocked() --- diff --git a/src/test/test-signal-util.c b/src/test/test-signal-util.c index 51e604f7236..76ab9b8ad28 100644 --- a/src/test/test-signal-util.c +++ b/src/test/test-signal-util.c @@ -105,28 +105,21 @@ static void test_signal_from_string(void) { } static void test_block_signals(void) { - sigset_t ss; - - assert_se(sigprocmask(0, NULL, &ss) >= 0); - - assert_se(sigismember(&ss, SIGUSR1) == 0); - assert_se(sigismember(&ss, SIGALRM) == 0); - assert_se(sigismember(&ss, SIGVTALRM) == 0); + assert_se(signal_is_blocked(SIGUSR1) == 0); + assert_se(signal_is_blocked(SIGALRM) == 0); + assert_se(signal_is_blocked(SIGVTALRM) == 0); { BLOCK_SIGNALS(SIGUSR1, SIGVTALRM); - assert_se(sigprocmask(0, NULL, &ss) >= 0); - assert_se(sigismember(&ss, SIGUSR1) == 1); - assert_se(sigismember(&ss, SIGALRM) == 0); - assert_se(sigismember(&ss, SIGVTALRM) == 1); - + assert_se(signal_is_blocked(SIGUSR1) > 0); + assert_se(signal_is_blocked(SIGALRM) == 0); + assert_se(signal_is_blocked(SIGVTALRM) > 0); } - assert_se(sigprocmask(0, NULL, &ss) >= 0); - assert_se(sigismember(&ss, SIGUSR1) == 0); - assert_se(sigismember(&ss, SIGALRM) == 0); - assert_se(sigismember(&ss, SIGVTALRM) == 0); + assert_se(signal_is_blocked(SIGUSR1) == 0); + assert_se(signal_is_blocked(SIGALRM) == 0); + assert_se(signal_is_blocked(SIGVTALRM) == 0); } static void test_ignore_signals(void) {