Skip to content
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

Skip tests requiring fork() when no fork() is available #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

steve-m-hay
Copy link

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 several of
Test-TCP's tests fail.

This commit skips those tests in the same manner as various other CPAN
modules do in this case. This allows a normal "cpan install ..." of
Test-TCP or anything depending on it (e.g. Plack) to succeed without
having to "force" anything.

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 several of
Test-TCP's tests fail.

This commit skips those tests in the same manner as various other CPAN
modules do in this case. This allows a normal "cpan install ..." of
Test-TCP or anything depending on it (e.g. Plack) to succeed without
having to "force" anything.
@tokuhirom
Copy link
Owner

But, test case that depends on Test::TCP still fail...

@steve-m-hay
Copy link
Author

Yes, Test::TCP would need some work to be usable by perls without a fork().
This patch was just intended to allow the installation of Test::TCP so that
it doesn't stop something like "cpan install Dancer" from succeeding. I
have also sent similar patches to other modules required by Dancer (which
is what I was trying to install...). Some of those use Test::TCP, but even
if they skip such tests they may still include Test::TCP in their list of
prerequisites which cpan will try to install, so it still helps to smooth
the way if Test::TCP installs cleanly.

On 29 November 2014 at 13:50, Tokuhiro Matsuno [email protected]
wrote:

But, test case that depends on Test::TCP still fail...


Reply to this email directly or view it on GitHub
#30 (comment).

@JJ
Copy link

JJ commented Jan 2, 2015

Again, any reason why this is not merged?

@kazuho
Copy link
Collaborator

kazuho commented Apr 2, 2015

Why do you want to install Test::TCP even when it cannot be used (or is there any need to have Net::EmptyPort available for such platforms as well)?

As tokuhirom stated, each test needs to have the skip_all statement like below even if this PR gets merged.

use Test::TCP;
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/);

Considering the fact, I believe it would be more straight-forward to keep Test::TCP as-is, and modify the tests like:

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/);
use_ok("Test::TCP");

@nponeccop
Copy link
Collaborator

Do we need a mergeable version of this PR?

@JJ
Copy link

JJ commented Jul 19, 2018

Such as it is now, it can't be merged, so I guess that at least a mergeable version would be a step towards having something usable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants