This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #127533] only test semctl() if we have everything needed to use it
[perl5.git] / t / io / semctl.t
CommitLineData
fa367bcb
AC
1BEGIN {
2 chdir 't' if -d 't';
3 @INC = '../lib' if -d '../lib' && -d '../ext';
4
5 require "./test.pl";
6 require Config; import Config;
7}
8
0b1b7115
JH
9use strict;
10use warnings;
11
fa367bcb 12skip_all('no SysV semaphores on this platform') if !$Config{d_sem};
9234e5bd
TC
13skip_all('SysV semaphore structures not detected')
14 if !$Config{d_semctl_semid_ds} && !$Config{d_semctl_semun};
fa367bcb
AC
15
16my @warnings;
17{
18 local $SIG{__WARN__} = sub { push @warnings, $_[0] };
55228cce 19 local $SIG{SYS} = sub { skip_all("SIGSYS caught") } if exists $SIG{SYS};
fa367bcb
AC
20 my $test = (semctl(-1,0,0,0))[0];
21 ok(!defined $test, "erroneous semctl list slice yields undef");
22}
23
24is(scalar @warnings, 0, "no warnings from erroneous semctl list slice")
25 or diag("warnings found: @warnings");
26
27done_testing;