@@ -1,71 +0,0 @@
-# =========================================================================
-# THIS FILE IS AUTOMATICALLY GENERATED BY MINILLA.
-# DO NOT EDIT DIRECTLY.
-# =========================================================================
-
-use 5.008_001;
-
-use strict;
-use warnings;
-use utf8;
-
-use Module::Build;
-use File::Basename;
-use File::Spec;
-use CPAN::Meta;
-use CPAN::Meta::Prereqs;
-
-my %args = (
- license => 'perl',
- dynamic_config => 0,
-
- configure_requires => {
- 'Module::Build' => 0.38,
- },
-
- name => 'Test-TCP',
- module_name => 'Test::TCP',
- allow_pureperl => 0,
-
- script_files => [glob('script/*'), glob('bin/*')],
- c_source => [qw()],
- PL_files => {},
-
- test_files => ((-d '.git' || $ENV{RELEASE_TESTING}) && -d 'xt') ? 't/ xt/' : 't/',
- recursive_test_files => 1,
-
-);
-if (-d 'share') {
- $args{share_dir} = 'share';
-}
-
-my $builder = Module::Build->subclass(
- class => 'MyBuilder',
- code => q{
- sub ACTION_distmeta {
- die "Do not run distmeta. Install Minilla and `minil install` instead.\n";
- }
- sub ACTION_installdeps {
- die "Do not run installdeps. Run `cpanm --installdeps .` instead.\n";
- }
- }
-)->new(%args);
-$builder->create_build_script();
-
-my $mbmeta = CPAN::Meta->load_file('MYMETA.json');
-my $meta = CPAN::Meta->load_file('META.json');
-my $prereqs_hash = CPAN::Meta::Prereqs->new(
- $meta->prereqs
-)->with_merged_prereqs(
- CPAN::Meta::Prereqs->new($mbmeta->prereqs)
-)->as_string_hash;
-my $mymeta = CPAN::Meta->new(
- {
- %{$meta->as_struct},
- prereqs => $prereqs_hash
- }
-);
-print "Merging cpanfile prereqs to MYMETA.yml\n";
-$mymeta->save('MYMETA.yml', { version => 1.4 });
-print "Merging cpanfile prereqs to MYMETA.json\n";
-$mymeta->save('MYMETA.json', { version => 2 });
@@ -1,4 +1,43 @@
-Revision history for Perl extension Test::TCP
+Revision history for Perl module Test::TCP
+
+2.06 2014-07-01T10:01:44Z
+
+ commit 8259d5eb28919bc766c8b500151d5be7e944b7f2
+ Author: Petr Písař <ppisar@redhat.com>
+ Date: Fri Jun 27 13:37:20 2014 +0200
+
+ Wait infinitely if max_wait is negative
+
+ The t/12_pass_wait_port_options.t will fail if the server process does not
+ start listening in max_wait limit. This can happen if the host is
+ loaded or just if the scheduler decides to postpone the process.
+
+ This patch adds possibility to wait infitely by passing a negative
+ max_wait value to the Test::TCP object and it changes the
+ t/12_pass_wait_port_options.t test to use this feature.
+
+ https://github.com/tokuhirom/Test-TCP/issues/28
+ Signed-off-by: Petr Písař <ppisar@redhat.com>
+
+2.05 2014-06-24T00:49:45Z
+
+ - Release again with latest minil.
+
+2.04 2014-06-23T23:42:28Z
+
+ - Release.
+
+2.03_02 2014-06-23T23:37:07Z
+
+ - Release to CPAN.
+
+2.03_01 2014-06-23T23:34:38Z
+
+ - Switch to ExtUtils::MakeMaker.
+
+2.03 2014-06-23T10:18:53Z
+
+ - Re-packaging with Minilla v2.0.0-TRIAL
2.02 2013-10-30T03:22:39Z
@@ -7,14 +46,11 @@ Revision history for Perl extension Test::TCP
2.01 2013-09-22T04:13:53Z
- commit 95cd6a0669d422e10f2d3b09f35346c86f7e3257
- Author: Christian Walde <walde.christian@googlemail.com>
- Date: Sat Sep 21 16:19:49 2013 +0200
-
- test waitport argument by running full code-chain, not with partial mocking
+ [Changes from MITHALDU (Christian Walde)]
+ - test waitport argument by running full code-chain, not with partial mocking
- The partial mocks cause stuck forks on win32 at times, causing the test to
- hang. With the full code chain present the test runs reliably
+ - The partial mocks cause stuck forks on win32 at times, causing the test to
+ hang. With the full code chain present the test runs reliably
2.00 2013-06-11T04:41:43Z
@@ -59,7 +95,6 @@ Revision history for Perl extension Test::TCP
- re-packing, again.
-
1.23 2013-03-27T01:37:08Z
- Just re-packaging
@@ -88,40 +123,38 @@ Revision history for Perl extension Test::TCP
- Split empty_port() function to Net::EmptyPort
(Thomas Klausner)
-1.18
+1.18 2012-10-25
- Added more documentation about empty_port()
-1.17
+1.17 2012-07-27
- commit 0f4510d83ae2f2ce112288c64289fa36d32865b3
- Author: Christian Walde <walde.christian@googlemail.com>
- Date: Sat Jul 28 07:04:40 2012 +0200
+ [Changes from MITHALDU (Christian Walde)]
- fix port checking on Win32 by performing it in another process
-
- On Win32 fork is emulating by creating another thread in the same process.
- This leads to a possible bug/race condition when a server tries to open a
- port and listen on it, while in the same process a client tries to connect
- to the same port. This manifests by the accept call of the server failing
- with an error of "Bad file descriptor".
+ - fix port checking on Win32 by performing it in another process
- This is easily fixed by having another process perform the port checking,
- since that will not interfere with the internals.
+ - On Win32 fork is emulating by creating another thread in the same process.
+ This leads to a possible bug/race condition when a server tries to open a
+ port and listen on it, while in the same process a client tries to connect
+ to the same port. This manifests by the accept call of the server failing
+ with an error of "Bad file descriptor".
-1.16
+ This is easily fixed by having another process perform the port checking,
+ since that will not interfere with the internals.
+
+1.16 2012-06-30
[TEST FIX]
- 1.15 breaks AIX fix on 1.14.
t/05_sigint.t skips on perl <= 5.8.8.
-1.15
+1.15 2012-01-31
[TEST FIX]
- ${^CHILD_ERROR_NATIVE} is only available in perl 5.8.9 and later.
- (kazeburo++)
+ - ${^CHILD_ERROR_NATIVE} is only available in perl 5.8.9 and later.
+ (kazeburo++)
-1.14
+1.14 2011-11-29
- Fixed testing issue on AIX.
https://rt.cpan.org/Public/Bug/Display.html?id=72779
@@ -129,161 +162,162 @@ Revision history for Perl extension Test::TCP
- depend to Test::SharedFork 0.19 for better TB2 support
(tokuhirom)
-1.13
+1.13 2011-05-31
- RT#67292: Tests are blocking in Windows 7.
https://rt.cpan.org/Ticket/Display.html?id=67292
- change port number range from 10000 .. 11000 to 50000 .. 60000 to respect IANA.
https://rt.cpan.org/Ticket/Display.html?id=64012
-1.12
+1.12 2011-03-03
- workaround for win32 test fails.
https://rt.cpan.org/Ticket/Display.html?id=66016
- more diagnostic messages
-1.11
+1.11 2010-12-20
- localize $@ in Test::TCP::DESTROY
-1.10
+1.10 2010-12-18
- added Test::TCP->stop method
-1.09
+1.09 2010-12-18
- added document in FAQ section
-1.08
+1.08 2010-12-16
- no feature changes
-1.07_01
+1.07_01 2010-12-16
- new OO interface!
-1.07
+1.07 2010-11-11
- allow forking in the client(lestrrat)
-1.06
+1.06 2010-09-11
- depend to Test::SharedFork 0.14. It fixes issue with Test::Builder2.
-1.05
+1.05 2010-09-10
- workaround for $@ issue in test case.
Data::Util's method modifier clears $@.
-1.04
+1.04 2010-08-24
- fixed local $@ issue. this happens on some version of perl5.
-1.03
+1.03 2010-08-23
- release to cpan
- fixed win32 issue(charsbar)
-1.02_02
+1.02_02 2010-08-23
- use randomness on finding empty port(suggested by kazuhooku)
- try to connect the port before bind(Tatsuhiko Miyagawa)
-1.02_01
+1.02_01 2010-08-23
- better cleanup code by RAII pattern.
https://rt.cpan.org/Ticket/Display.html?id=60657
(reported by dgl)
-1.02
+1.02 2010-08-17
- lazy loading issue was fixed at Test::SharedFork 0.12.
Depend to it.
https://rt.cpan.org/Public/Bug/Display.html?id=60426
(reported by J.)
-1.01
+1.01 2010-08-15
- remove unused deps for use_test_base().
-1.00
+1.00 2010-08-08
- bump up version!
-0.16_02
+0.16_02 2010-02-20
- oops. packaging miss.
-0.16_01
+0.16_01 2010-02-20
- Do not depend to IO::Socket::INET 1.31.
Test::TCP works well with older IO, I hope.
(suggested by mst)
-0.16
+0.16 2010-01-04
- check port asap(suggested by Hideki YAMAMURA)
-0.15
+0.15 2009-11-28
- fixed win32 issue(by charsbar++)
-0.14
+0.14 2009-10-18
- support win32
-0.13
+0.13 2009-10-14
- handle sigint(reported by kazuho++)
-0.12
+0.12 2009-10-04
- fixed broken test on solaris
-0.11
+0.11 2009-09-17
- fixed broken test, reported by drangon3++
-0.10
+0.10 2009-09-17
- don't leak the process when get a SIGDIE
- diag when get SIGPIPE
-0.09
+0.09 2009-09-15
- don't leak the control by SIGTERM, some tcp server return the control by SIGTERM.
(reported by kazuho++)
-0.08
+0.08 2009-09-14
- oops. I forget to remove 'use Params::Validate' statement.
-0.07
+0.07 2009-09-13
- diag when get a SIGABRT
-0.06
+0.06 2009-09-08
- pass the pid to client(kazuho)
- remove deps for Params::Validate(tokuhirom)
-0.05
+0.05 2009-06-22
- updated docs
- set ReuseAddr as true
-0.04
+0.04 2009-03-25
- Test::SharedFork 0.03 has a bug. depend to 0.04
-0.03
+0.03 2009-03-25
- do not depend to Sub::Exporter
- use Test::SharedFork
-0.02
+0.02 2008-08-28
- fixed deps for Sub::Exporter(by yappo++)
-0.01 Sun Aug 17 15:00:46 2008
- - original version
+0.01 2008-08-17
+ - original version
+
@@ -1,12 +1,13 @@
-Build.PL
Changes
LICENSE
META.json
+Makefile.PL
README.md
cpanfile
lib/Net/EmptyPort.pm
lib/Test/TCP.pm
lib/Test/TCP/CheckPort.pm
+minil.toml
t/00_compile.t
t/01_simple.t
t/02_abrt.t
@@ -4,7 +4,7 @@
"Tokuhiro Matsuno <tokuhirom@gmail.com>"
],
"dynamic_config" : 0,
- "generated_by" : "Minilla/v0.7.5",
+ "generated_by" : "Minilla/v2.1.0",
"license" : [
"perl_5"
],
@@ -28,9 +28,7 @@
"prereqs" : {
"configure" : {
"requires" : {
- "CPAN::Meta" : "0",
- "CPAN::Meta::Prereqs" : "0",
- "Module::Build" : "0.38"
+ "ExtUtils::MakeMaker" : "6.64"
}
},
"develop" : {
@@ -38,7 +36,8 @@
"File::Which" : "0",
"Perl::Critic" : "1.105",
"Test::CPAN::Meta" : "0",
- "Test::MinimumVersion" : "0.10108",
+ "Test::MinimumVersion::Fast" : "0.04",
+ "Test::PAUSE::Permissions" : "0.04",
"Test::Perl::Critic" : "1.02",
"Test::Pod" : "1.41",
"Test::Spellunker" : "v0.2.7"
@@ -67,7 +66,7 @@
},
"Test::TCP" : {
"file" : "lib/Test/TCP.pm",
- "version" : "2.02"
+ "version" : "2.06"
},
"Test::TCP::CheckPort" : {
"file" : "lib/Test/TCP/CheckPort.pm"
@@ -84,20 +83,23 @@
"web" : "https://github.com/tokuhirom/Test-TCP"
}
},
- "version" : "2.02",
+ "version" : "2.06",
"x_contributors" : [
"tokuhirom <tokuhirom@d0d07461-0603-4401-acd4-de1884942a52>",
"mattn <mattn@d0d07461-0603-4401-acd4-de1884942a52>",
"yappo <yappo@d0d07461-0603-4401-acd4-de1884942a52>",
- "奥 ä¸ç© <kazuho@EM114-48-138-123.pool.e-mobile.ne.jp>",
+ "奥 一穂 <kazuho@EM114-48-138-123.pool.e-mobile.ne.jp>",
"gfx <gfuji@cpan.org>",
"Kenichi Ishigaki <ishigaki@cpan.org>",
"lestrrat <lestrrat+github@gmail.com>",
"Masahiro Nagano <kazeburo@gmail.com>",
"Thomas Klausner <domm@plix.at>",
"Brendan Byrd <Perl@ResonatorSoft.org>",
- "Pavel Shaydo <zwon@cpan.org>",
"Tatsuhiko Miyagawa <miyagawa@bulknews.net>",
- "Christian Walde <walde.christian@googlemail.com>"
+ "Christian Walde <walde.christian@googlemail.com>",
+ "Ivan Baidakou <dmol@gmx.com>",
+ "Neil Bowers <neil@bowers.com>",
+ "Pavel Shaydo <zwon@cpan.org>",
+ "Petr Písař <ppisar@redhat.com>"
]
}
@@ -3,19 +3,17 @@ abstract: 'testing TCP program'
author:
- 'Tokuhiro Matsuno <tokuhirom@gmail.com>'
build_requires:
- File::Temp: 0
- Socket: 0
- Test::More: 0.98
+ File::Temp: '0'
+ Socket: '0'
+ Test::More: '0.98'
configure_requires:
- CPAN::Meta: 0
- CPAN::Meta::Prereqs: 0
- Module::Build: 0.38
+ ExtUtils::MakeMaker: '6.64'
dynamic_config: 0
-generated_by: 'Minilla/v0.7.5, CPAN::Meta::Converter version 2.132510'
+generated_by: 'Minilla/v2.1.0, CPAN::Meta::Converter version 2.141520'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: Test-TCP
no_index:
directory:
@@ -32,31 +30,34 @@ provides:
file: lib/Net/EmptyPort.pm
Test::TCP:
file: lib/Test/TCP.pm
- version: 2.02
+ version: '2.06'
Test::TCP::CheckPort:
file: lib/Test/TCP/CheckPort.pm
requires:
- IO::Socket::INET: 0
- Test::More: 0
- Test::SharedFork: 0.19
- Time::HiRes: 0
- perl: 5.008001
+ IO::Socket::INET: '0'
+ Test::More: '0'
+ Test::SharedFork: '0.19'
+ Time::HiRes: '0'
+ perl: '5.008001'
resources:
bugtracker: https://github.com/tokuhirom/Test-TCP/issues
homepage: https://github.com/tokuhirom/Test-TCP
repository: git://github.com/tokuhirom/Test-TCP.git
-version: 2.02
+version: '2.06'
x_contributors:
- 'tokuhirom <tokuhirom@d0d07461-0603-4401-acd4-de1884942a52>'
- 'mattn <mattn@d0d07461-0603-4401-acd4-de1884942a52>'
- 'yappo <yappo@d0d07461-0603-4401-acd4-de1884942a52>'
- - '奥 ä¸ç© <kazuho@EM114-48-138-123.pool.e-mobile.ne.jp>'
+ - '奥 一穂 <kazuho@EM114-48-138-123.pool.e-mobile.ne.jp>'
- 'gfx <gfuji@cpan.org>'
- 'Kenichi Ishigaki <ishigaki@cpan.org>'
- 'lestrrat <lestrrat+github@gmail.com>'
- 'Masahiro Nagano <kazeburo@gmail.com>'
- 'Thomas Klausner <domm@plix.at>'
- 'Brendan Byrd <Perl@ResonatorSoft.org>'
- - 'Pavel Shaydo <zwon@cpan.org>'
- 'Tatsuhiko Miyagawa <miyagawa@bulknews.net>'
- 'Christian Walde <walde.christian@googlemail.com>'
+ - 'Ivan Baidakou <dmol@gmx.com>'
+ - 'Neil Bowers <neil@bowers.com>'
+ - 'Pavel Shaydo <zwon@cpan.org>'
+ - 'Petr Písař <ppisar@redhat.com>'
@@ -0,0 +1,45 @@
+# =========================================================================
+# THIS FILE IS AUTOMATICALLY GENERATED BY MINILLA.
+# DO NOT EDIT DIRECTLY.
+# =========================================================================
+
+use 5.008_001;
+use strict;
+
+use ExtUtils::MakeMaker;
+
+
+use File::Copy;
+
+print "cp META.json MYMETA.json\n";
+copy("META.json","MYMETA.json") or die "Copy failed(META.json): $!";
+
+if (-f 'META.yml') {
+ print "cp META.yml MYMETA.yml\n";
+ copy("META.yml","MYMETA.yml") or die "Copy failed(META.yml): $!";
+} else {
+ print "There is no META.yml... You may install this module from the repository...\n";
+}
+
+my %args;
+if ($ExtUtils::MakeMaker::VERSION >= 6.64) {
+ # *_REQUIRES was supported.
+
+ $args{CONFIGURE_REQUIRES} = {"ExtUtils::MakeMaker" => "6.64"};
+ $args{BUILD_REQUIRES} = {};
+ $args{TEST_REQUIRES} = {"File::Temp" => 0,"Socket" => 0,"Test::More" => "0.98"};
+ $args{PREREQ_PM} = {"IO::Socket::INET" => 0,"Test::More" => 0,"Test::SharedFork" => "0.19","Time::HiRes" => 0,"perl" => "5.008001"};
+} else {
+ $args{PREREQ_PM} = {"ExtUtils::MakeMaker" => "6.64","File::Temp" => 0,"IO::Socket::INET" => 0,"Socket" => 0,"Test::More" => "0.98","Test::SharedFork" => "0.19","Time::HiRes" => 0,"perl" => "5.008001"};
+}
+
+if ($ExtUtils::MakeMaker::VERSION >= 6.57_01) {
+ $args{NO_MYMETA} = 1;
+}
+
+WriteMakefile(
+ NAME => 'Test::TCP',
+ DISTNAME => 'Test-TCP',
+ VERSION => '2.06',
+ %args,
+);
@@ -68,8 +68,6 @@ Test::TCP is test utilities for TCP/IP programs.
max_wait => 3, # seconds
);
-
-
- wait\_port
wait_port(8080);
@@ -100,7 +98,7 @@ Test::TCP is test utilities for TCP/IP programs.
Will wait for at most `$max_wait` seconds before checking port.
- See also [Net::EmptyPort](http://search.cpan.org/perldoc?Net::EmptyPort).
+ See also [Net::EmptyPort](https://metacpan.org/pod/Net::EmptyPort).
_Default: 10_
@@ -16,12 +16,12 @@ sub empty_port {
$p = 49152 unless $p =~ /^[0-9]+$/ && $p < 49152;
$p;
} else {
- 50000 + int(rand()*1000);
+ 50000 + (int(rand()*1500) + abs($$)) % 1500;
}
};
my $proto = $_[1] ? lc($_[1]) : 'tcp';
- while ( $port++ < 60000 ) {
+ while ( $port++ < 65000 ) {
# Remote checks don't work on UDP, and Local checks would be redundant here...
next if ($proto eq 'tcp' && check_port($port));
@@ -73,7 +73,7 @@ sub _make_waiter {
my $sleep = 0.001;
return sub {
- return 0 if $waited > $max_wait;
+ return 0 if $max_wait >= 0 && $waited > $max_wait;
Time::HiRes::sleep($sleep);
$waited += $sleep;
@@ -88,13 +88,14 @@ sub wait_port {
if (@_==4) {
# backward compat.
($port, (my $sleep), (my $retry), $proto) = @_;
- $max_wait = $max_wait*$retry;
+ $max_wait = $sleep * $retry;
$proto = $proto ? lc($proto) : 'tcp';
} else {
($port, $max_wait, $proto) = @_;
$proto = $proto ? lc($proto) : 'tcp';
}
+ $max_wait = 10 unless defined $max_wait;
my $waiter = _make_waiter($max_wait);
while ( $waiter->() ) {
@@ -174,7 +175,8 @@ This method waits the C<< $port >> number is ready to accept a request.
C<$port> is a port number to check.
-Sleep up to C<$max_wait> seconds for checking the port.
+Sleep up to C<$max_wait> seconds (10 seconds by default) for checking the
+port. Pass negative C<$max_wait> value to wait infinitely.
I<Return value> : Return true if the port is available, false otherwise.
@@ -2,7 +2,7 @@ package Test::TCP;
use strict;
use warnings;
use 5.00800;
-our $VERSION = '2.02';
+our $VERSION = '2.06';
use base qw/Exporter/;
use IO::Socket::INET;
use Test::SharedFork 0.12;
@@ -0,0 +1 @@
+module_maker="ExtUtilsMakeMaker"
@@ -18,6 +18,10 @@ if ($pid > 0) {
kill 'INT', $pid;
waitpid($pid, 0);
# NOTE. $? is broken on AIX platform. see also __END__ comments on this file.
+ diag "\$Config{sig_name}: " . $Config{sig_name};
+ diag "CHILD_ERROR_NATIVE: " . ${^CHILD_ERROR_NATIVE};
+ diag "\$?: " . $?;
+
ok POSIX::WIFSIGNALED(${^CHILD_ERROR_NATIVE});
is [split / /, $Config{sig_name}]->[POSIX::WTERMSIG(${^CHILD_ERROR_NATIVE})], 'INT', "sigint";
# ok $killed_server, "really killed";
@@ -63,7 +63,7 @@ my $client = sub {
{
my $tcp = Test::TCP->new(
code => $server,
- max_wait => 3,
+ max_wait => -3,
);
$client->($tcp->port);
if ($?) {
@@ -73,7 +73,7 @@ my $client = sub {
$? = 0;
}
- is($max_wait, 3);
+ is($max_wait, -3);
}
# test_tcp() arguments are passed to Net::EmptyPort::wait_port.
@@ -81,9 +81,9 @@ my $client = sub {
test_tcp(
client => $client,
server => $server,
- max_wait => 2,
+ max_wait => -2,
);
- is($max_wait, 2);
+ is($max_wait, -2);
}
done_testing;