xref: /openbsd/gnu/usr.bin/perl/t/io/semctl.t (revision 3cab2bb3)
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
9use strict;
10use warnings;
11
12skip_all('no SysV semaphores on this platform') if !$Config{d_sem};
13skip_all('SysV semaphore structures not detected')
14    if !$Config{d_semctl_semid_ds} && !$Config{d_semctl_semun};
15
16my @warnings;
17{
18    local $SIG{__WARN__} = sub { push @warnings, $_[0] };
19    local $SIG{SYS} = sub { skip_all("SIGSYS caught") } if exists $SIG{SYS};
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;
28