Subject: | [PATCH] Skip tests requiring fork() when no fork() is available |
If you build perl on Windows without -DPERL_IMPLICIT_SYS (which I do, in order to enable -DPEL_MALLOC, which seems faster than using the system malloc()) then you don't get the fork() emulation and two of HTTP-Server-Simple's tests fail.
The attached patch skips those tests in the same manner as various other CPAN modules do in this case.
This allows a normal "cpan install ..." of HTTP-Server-Simple or anything depending on it (e.g. Dancer) to succeed without having to "force" anything.
Subject: | HTTP-Server-Simple-0.45_02-nofork.patch |
diff -ruN HTTP-Server-Simple-0.45_02.orig/t/01live.t HTTP-Server-Simple-0.45_02/t/01live.t
--- HTTP-Server-Simple-0.45_02.orig/t/01live.t 2012-05-21 00:05:32.000000000 +0100
+++ HTTP-Server-Simple-0.45_02/t/01live.t 2014-11-29 11:40:29.095484600 +0000
@@ -1,9 +1,18 @@
# -*- perl -*-
+use Config;
use Socket;
-use Test::More tests => 34;
+use Test::More;
use strict;
+plan skip_all => "fork not supported on this platform"
+ unless $Config::Config{d_fork} || $Config::Config{d_pseudofork} ||
+ (($^O eq 'MSWin32' || $^O eq 'NetWare') and
+ $Config::Config{useithreads} and
+ $Config::Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/);
+
+plan tests => 34;
+
# This script assumes that `localhost' will resolve to a local IP
# address that may be bound to,
diff -ruN HTTP-Server-Simple-0.45_02.orig/t/04cgi.t HTTP-Server-Simple-0.45_02/t/04cgi.t
--- HTTP-Server-Simple-0.45_02.orig/t/04cgi.t 2012-05-21 00:05:32.000000000 +0100
+++ HTTP-Server-Simple-0.45_02/t/04cgi.t 2014-11-29 11:41:00.774296500 +0000
@@ -1,9 +1,16 @@
# -*- perl -*-
+use Config;
use Test::More;
use Socket;
use strict;
+plan skip_all => "fork not supported on this platform"
+ unless $Config::Config{d_fork} || $Config::Config{d_pseudofork} ||
+ (($^O eq 'MSWin32' || $^O eq 'NetWare') and
+ $Config::Config{useithreads} and
+ $Config::Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/);
+
my $PORT = 40000 + int(rand(10000));
my $host = gethostbyaddr(inet_aton('localhost'), AF_INET);