diff options
author | Ronny Chevalier <chevalier.ronny@gmail.com> | 2016-03-02 23:36:50 +0100 |
---|---|---|
committer | Ronny Chevalier <chevalier.ronny@gmail.com> | 2016-03-03 18:46:58 +0100 |
commit | ede4edd31e9aa84a9d7fd2aa3754d4c2ec0c448c (patch) | |
tree | 8bd61201b10ae79a5962a8b4a4e85eaa22517529 /src/test/test-signal-util.c | |
parent | 7ba365a9b202b49e16391a6e2ed80a8d92c01569 (diff) |
tests: move signal-util related tests to test-signal-util.c
Diffstat (limited to 'src/test/test-signal-util.c')
-rw-r--r-- | src/test/test-signal-util.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/test-signal-util.c b/src/test/test-signal-util.c index 3083501ce9..671eb869cb 100644 --- a/src/test/test-signal-util.c +++ b/src/test/test-signal-util.c @@ -17,6 +17,10 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#include <signal.h> +#include <unistd.h> + +#include "macro.h" #include "signal-util.h" static void test_block_signals(void) { @@ -44,6 +48,20 @@ static void test_block_signals(void) { assert_se(sigismember(&ss, SIGVTALRM) == 0); } +static void test_ignore_signals(void) { + assert_se(ignore_signals(SIGINT, -1) >= 0); + assert_se(kill(getpid(), SIGINT) >= 0); + assert_se(ignore_signals(SIGUSR1, SIGUSR2, SIGTERM, SIGPIPE, -1) >= 0); + assert_se(kill(getpid(), SIGUSR1) >= 0); + assert_se(kill(getpid(), SIGUSR2) >= 0); + assert_se(kill(getpid(), SIGTERM) >= 0); + assert_se(kill(getpid(), SIGPIPE) >= 0); + assert_se(default_signals(SIGINT, SIGUSR1, SIGUSR2, SIGTERM, SIGPIPE, -1) >= 0); +} + int main(int argc, char *argv[]) { test_block_signals(); + test_ignore_signals(); + + return 0; } |