1#!/usr/bin/perl -w 2use strict; 3use Test::More; 4use autodie; 5 6use constant SYSINIT => 1; 7 8if (not CORE::kill(0,$$)) { 9 plan skip_all => "Can't send signals to own process on this system."; 10} 11 12if (CORE::kill(0, SYSINIT)) { 13 plan skip_all => "Can unexpectedly signal process 1. Won't run as root."; 14} 15 16plan tests => 4; 17 18eval { kill(0, $$); }; 19is($@, '', "Signalling self is fine"); 20 21eval { kill(0, SYSINIT ) }; 22isa_ok($@, 'autodie::exception', "Signalling init is not allowed."); 23 24eval { kill(0, $$, SYSINIT) }; 25isa_ok($@, 'autodie::exception', 'kill exception on single failure.'); 26is($@->return, 1, "kill fails correctly on a 'true' failure."); 27