From 61fb63a65302574d277a1fad9234dfa69d968d28 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Thu, 8 Sep 2011 10:11:55 +0200 Subject: [PATCH] Add tests for POSIX::sigpending(). --- t/op/sigdispatch.t | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/t/op/sigdispatch.t b/t/op/sigdispatch.t index e08e35f..6b8c778 100644 --- a/t/op/sigdispatch.t +++ b/t/op/sigdispatch.t @@ -9,7 +9,7 @@ BEGIN { use strict; use Config; -plan tests => 17; +plan tests => 23; watchdog(15); @@ -39,12 +39,15 @@ eval { is($@, "Alarm!\n", 'after the second loop'); SKIP: { - skip('We can\'t test blocking without sigprocmask', 11) + skip('We can\'t test blocking without sigprocmask', 17) if is_miniperl() || !$Config{d_sigprocmask}; - skip('This doesn\'t work on OpenBSD threaded builds RT#88814', 11) + skip('This doesn\'t work on OpenBSD threaded builds RT#88814', 17) if $^O eq 'openbsd' && $Config{useithreads}; require POSIX; + my $pending = POSIX::SigSet->new(); + is POSIX::sigpending($pending), '0 but true', 'sigpending'; + is $pending->ismember(&POSIX::SIGUSR1), 0, 'SIGUSR1 is not pending'; my $new = POSIX::SigSet->new(&POSIX::SIGUSR1); POSIX::sigprocmask(&POSIX::SIG_BLOCK, $new); @@ -52,10 +55,14 @@ SKIP: { $SIG{USR1} = sub { $gotit++ }; kill 'SIGUSR1', $$; is $gotit, 0, 'Haven\'t received third signal yet'; + is POSIX::sigpending($pending), '0 but true', 'sigpending'; + is $pending->ismember(&POSIX::SIGUSR1), 1, 'SIGUSR1 is pending'; my $old = POSIX::SigSet->new(); POSIX::sigsuspend($old); is $gotit, 1, 'Received third signal'; + is POSIX::sigpending($pending), '0 but true', 'sigpending'; + is $pending->ismember(&POSIX::SIGUSR1), 0, 'SIGUSR1 is no longer pending'; { kill 'SIGUSR1', $$; -- 2.7.4