Skip to content

Use common Check::Fork|Socket to check ability of fork and socket in system #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion perl/Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ WriteMakefile(
PM => {'FCGI.pm' => '$(INST_ARCHLIBDIR)/FCGI.pm'},
PREREQ_PM => {'XSLoader' => '0'},
TEST_REQUIRES => {
'Config' => 0,
'Check::Fork' => 0.02,
'Check::Socket' => 0.03,
'FCGI::Client' => 0.09,
'File::Temp' => 0,
'IO::Socket' => 0,
Expand Down
36 changes: 5 additions & 31 deletions perl/t/02-unix_domain_socket.t
Original file line number Diff line number Diff line change
@@ -1,43 +1,17 @@
use strict;
use warnings;

use Config;
use Check::Fork qw(check_fork);
use Check::Socket qw(check_socket);
use FCGI;
use FCGI::Client;
use File::Temp qw(tempfile);
use IO::Socket;
use Test::More 0.88;

my $can_fork = $Config{d_fork}
|| (
($^O eq 'MSWin32' || $^O eq 'NetWare')
and $Config{useithreads}
and $Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/
);
if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bSocket\b/) {
plan skip_all => 'Socket extension unavailable';
} elsif ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bIO\b/) {
plan skip_all => 'IO extension unavailable';
} elsif ($^O eq 'os2') {
eval { IO::Socket::pack_sockaddr_un('/foo/bar') || 1 };
if ($@ !~ /not implemented/) {
plan skip_all => 'compiled without TCP/IP stack v4';
}
} elsif ($^O =~ m/^(?:qnx|nto|vos)$/ ) {
plan skip_all => "UNIX domain sockets not implemented on $^O";
} elsif (! $can_fork) {
plan skip_all => 'no fork';
} elsif ($^O eq 'MSWin32') {
if ($ENV{CONTINUOUS_INTEGRATION}) {
# https://github.com/Perl/perl5/issues/17429
plan skip_all => 'Skipping on Windows CI';
} else {
# https://github.com/Perl/perl5/issues/17575
if (! eval { socket(my $sock, PF_UNIX, SOCK_STREAM, 0) }) {
plan skip_all => "AF_UNIX unavailable or disabled on this platform"
}
}
}
check_fork() || plan skip_all => $Check::Fork::ERROR_MESSAGE;
check_socket() || plan skip_all => $Check::Socket::ERROR_MESSAGE;
$^O eq 'MSWin32' && plan skip_all => 'FCGI with UNIX domain sockets not implemented on $^O';

my (undef, $unix_socket_file) = tempfile();
my $fcgi_socket = FCGI::OpenSocket($unix_socket_file, 5);
Expand Down