Hello community, here is the log from the commit of package perl-Test-TCP for openSUSE:Factory checked in at 2015-04-18 10:39:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Test-TCP (Old) and /work/SRC/openSUSE:Factory/.perl-Test-TCP.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Test-TCP" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Test-TCP/perl-Test-TCP.changes 2013-11-26 14:42:13.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Test-TCP.new/perl-Test-TCP.changes 2015-04-18 10:39:55.000000000 +0200 @@ -1,0 +2,7 @@ +Tue Apr 14 20:19:15 UTC 2015 - co...@suse.com + +- updated to 2.11 + see /usr/share/doc/packages/perl-Test-TCP/Changes +- remove long dead test-no-note.patch + +------------------------------------------------------------------- Old: ---- Test-TCP-2.02.tar.gz test-no-note.patch New: ---- Test-TCP-2.11.tar.gz cpanspec.yml ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Test-TCP.spec ++++++ --- /var/tmp/diff_new_pack.JJTeyw/_old 2015-04-18 10:39:56.000000000 +0200 +++ /var/tmp/diff_new_pack.JJTeyw/_new 2015-04-18 10:39:56.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Test-TCP # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,30 +17,24 @@ Name: perl-Test-TCP -Version: 2.02 +Version: 2.11 Release: 0 %define cpan_name Test-TCP -Summary: Testing TCP program +Summary: Testing Tcp Program License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Test-TCP/ -Source: http://www.cpan.org/authors/id/T/TO/TOKUHIROM/%{cpan_name}-%{version}.tar.gz +Source0: http://www.cpan.org/authors/id/K/KA/KAZUHO/%{cpan_name}-%{version}.tar.gz +Source1: cpanspec.yml BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros -BuildRequires: perl(CPAN::Meta) -BuildRequires: perl(CPAN::Meta::Prereqs) -BuildRequires: perl(Module::Build) >= 0.38 +BuildRequires: perl(IO::Socket::IP) BuildRequires: perl(Test::More) >= 0.98 -BuildRequires: perl(Test::SharedFork) >= 0.19 -#BuildRequires: perl(File::Which) -#BuildRequires: perl(Net::EmptyPort) -#BuildRequires: perl(Perl::Critic) >= 1.105 -#BuildRequires: perl(Test::Perl::Critic) >= 1.02 -#BuildRequires: perl(Test::TCP) -#BuildRequires: perl(t::Server) -Requires: perl(Test::SharedFork) >= 0.19 +BuildRequires: perl(Test::SharedFork) >= 0.29 +Requires: perl(IO::Socket::IP) +Requires: perl(Test::SharedFork) >= 0.29 %{perl_requires} %description @@ -50,18 +44,19 @@ %setup -q -n %{cpan_name}-%{version} %build -%{__perl} Build.PL installdirs=vendor -./Build build flags=%{?_smp_mflags} +%{__perl} Makefile.PL INSTALLDIRS=vendor +%{__make} %{?_smp_mflags} %check -./Build test +%{__make} test %install -./Build install destdir=%{buildroot} create_packlist=0 +%perl_make_install +%perl_process_packlist %perl_gen_filelist %files -f %{name}.files %defattr(-,root,root,755) -%doc Changes cpanfile LICENSE README.md +%doc Changes LICENSE minil.toml README.md %changelog ++++++ Test-TCP-2.02.tar.gz -> Test-TCP-2.11.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/Build.PL new/Test-TCP-2.11/Build.PL --- old/Test-TCP-2.02/Build.PL 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/Build.PL 1970-01-01 01:00:00.000000000 +0100 @@ -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 }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/Changes new/Test-TCP-2.11/Changes --- old/Test-TCP-2.02/Changes 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/Changes 2015-04-07 02:07:40.000000000 +0200 @@ -1,4 +1,63 @@ -Revision history for Perl extension Test::TCP +Revision history for Perl module Test::TCP + +2.11 2015-04-07T00:07:25Z + - declare IO::Socket::IP as dependency #36 + +2.10 2015-04-06T19:23:43Z + - ensure the test object is DESTROYed when Net::EmptyPort::empty_port exits https://rt.cpan.org/Public/Bug/Display.html?id=103299 + +2.09 2015-04-02T21:55:18Z + - fix tests running for a long time on systems that do not support IPv6 #35 + +2.08 2015-04-02T04:04:33Z + - add `host` argument to various functions for binding to arbitrary address (incl. IPv6) #33 + - add function `Net::EmptyPort::can_bind` #34 + +2.07 2015-01-22T10:44:21Z + + Old versions of Test::SharedFork are incompatibles with the new Test::Builder: I had "missing TB2::History" errors. + It would be helpful to upgrade the Test::SharedFork dependency to help the user to avoid to encounter such hard to track deep errors. + (Reported by dolmen++) + + +2.06 2014-07-01T10:01:44Z + + commit 8259d5eb28919bc766c8b500151d5be7e944b7f2 + Author: Petr Písař <ppi...@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ř <ppi...@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 +66,11 @@ 2.01 2013-09-22T04:13:53Z - commit 95cd6a0669d422e10f2d3b09f35346c86f7e3257 - Author: Christian Walde <walde.christ...@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 +115,6 @@ - re-packing, again. - 1.23 2013-03-27T01:37:08Z - Just re-packaging @@ -88,40 +143,38 @@ - 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.christ...@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 + - 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". - - 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". + + This is easily fixed by having another process perform the port checking, + since that will not interfere with the internals. -1.16 +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 +182,162 @@ - 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 + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/MANIFEST new/Test-TCP-2.11/MANIFEST --- old/Test-TCP-2.02/MANIFEST 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/MANIFEST 2015-04-07 02:07:40.000000000 +0200 @@ -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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/META.json new/Test-TCP-2.11/META.json --- old/Test-TCP-2.02/META.json 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/META.json 2015-04-07 02:07:40.000000000 +0200 @@ -4,7 +4,7 @@ "Tokuhiro Matsuno <tokuhi...@gmail.com>" ], "dynamic_config" : 0, - "generated_by" : "Minilla/v0.7.5", + "generated_by" : "Minilla/v2.3.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" @@ -47,8 +46,9 @@ "runtime" : { "requires" : { "IO::Socket::INET" : "0", + "IO::Socket::IP" : "0", "Test::More" : "0", - "Test::SharedFork" : "0.19", + "Test::SharedFork" : "0.29", "Time::HiRes" : "0", "perl" : "5.008001" } @@ -67,7 +67,7 @@ }, "Test::TCP" : { "file" : "lib/Test/TCP.pm", - "version" : "2.02" + "version" : "2.11" }, "Test::TCP::CheckPort" : { "file" : "lib/Test/TCP/CheckPort.pm" @@ -84,20 +84,25 @@ "web" : "https://github.com/tokuhirom/Test-TCP" } }, - "version" : "2.02", + "version" : "2.11", "x_contributors" : [ "tokuhirom <tokuhirom@d0d07461-0603-4401-acd4-de1884942a52>", "mattn <mattn@d0d07461-0603-4401-acd4-de1884942a52>", "yappo <yappo@d0d07461-0603-4401-acd4-de1884942a52>", - "奥 ä¸ç© <kaz...@em114-48-138-123.pool.e-mobile.ne.jp>", + "奥 一穂 <kaz...@em114-48-138-123.pool.e-mobile.ne.jp>", "gfx <gf...@cpan.org>", "Kenichi Ishigaki <ishig...@cpan.org>", "lestrrat <lestrrat+git...@gmail.com>", "Masahiro Nagano <kazeb...@gmail.com>", "Thomas Klausner <d...@plix.at>", "Brendan Byrd <p...@resonatorsoft.org>", - "Pavel Shaydo <z...@cpan.org>", "Tatsuhiko Miyagawa <miyag...@bulknews.net>", - "Christian Walde <walde.christ...@googlemail.com>" + "Christian Walde <walde.christ...@googlemail.com>", + "Ivan Baidakou <d...@gmx.com>", + "Neil Bowers <n...@bowers.com>", + "Pavel Shaydo <z...@cpan.org>", + "Petr Písař <ppi...@redhat.com>", + "Bartosz Jakubski <b.jakub...@gmail.com>", + "Kazuho Oku <kazuho...@gmail.com>" ] } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/META.yml new/Test-TCP-2.11/META.yml --- old/Test-TCP-2.02/META.yml 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/META.yml 2015-04-07 02:07:40.000000000 +0200 @@ -3,19 +3,17 @@ author: - 'Tokuhiro Matsuno <tokuhi...@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.3.0, CPAN::Meta::Converter version 2.150001' 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,37 @@ file: lib/Net/EmptyPort.pm Test::TCP: file: lib/Test/TCP.pm - version: 2.02 + version: '2.11' 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' + IO::Socket::IP: '0' + Test::More: '0' + Test::SharedFork: '0.29' + 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.11' x_contributors: - 'tokuhirom <tokuhirom@d0d07461-0603-4401-acd4-de1884942a52>' - 'mattn <mattn@d0d07461-0603-4401-acd4-de1884942a52>' - 'yappo <yappo@d0d07461-0603-4401-acd4-de1884942a52>' - - '奥 ä¸ç© <kaz...@em114-48-138-123.pool.e-mobile.ne.jp>' + - '奥 一穂 <kaz...@em114-48-138-123.pool.e-mobile.ne.jp>' - 'gfx <gf...@cpan.org>' - 'Kenichi Ishigaki <ishig...@cpan.org>' - 'lestrrat <lestrrat+git...@gmail.com>' - 'Masahiro Nagano <kazeb...@gmail.com>' - 'Thomas Klausner <d...@plix.at>' - 'Brendan Byrd <p...@resonatorsoft.org>' - - 'Pavel Shaydo <z...@cpan.org>' - 'Tatsuhiko Miyagawa <miyag...@bulknews.net>' - 'Christian Walde <walde.christ...@googlemail.com>' + - 'Ivan Baidakou <d...@gmx.com>' + - 'Neil Bowers <n...@bowers.com>' + - 'Pavel Shaydo <z...@cpan.org>' + - 'Petr Písař <ppi...@redhat.com>' + - 'Bartosz Jakubski <b.jakub...@gmail.com>' + - 'Kazuho Oku <kazuho...@gmail.com>' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/Makefile.PL new/Test-TCP-2.11/Makefile.PL --- old/Test-TCP-2.02/Makefile.PL 1970-01-01 01:00:00.000000000 +0100 +++ new/Test-TCP-2.11/Makefile.PL 2015-04-07 02:07:40.000000000 +0200 @@ -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,"IO::Socket::IP" => 0,"Test::More" => 0,"Test::SharedFork" => "0.29","Time::HiRes" => 0,"perl" => "5.008001"}; +} else { + $args{PREREQ_PM} = {"ExtUtils::MakeMaker" => "6.64","File::Temp" => 0,"IO::Socket::INET" => 0,"IO::Socket::IP" => 0,"Socket" => 0,"Test::More" => "0.98","Test::SharedFork" => "0.29","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.11', + %args, +); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/README.md new/Test-TCP-2.11/README.md --- old/Test-TCP-2.02/README.md 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/README.md 2015-04-07 02:07:40.000000000 +0200 @@ -64,12 +64,11 @@ # run server }, # optional + host => '127.0.0.1', # specify '::1' to test using IPv6 port => 8080, max_wait => 3, # seconds ); - - - wait\_port wait_port(8080); @@ -100,7 +99,7 @@ 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_ @@ -190,6 +189,40 @@ done_testing; +- How do I use address other than "127.0.0.1" for testing? + + You can use the `host` paramater to specify the bind address. + + # let the server bind to "0.0.0.0" for testing + test_tcp( + client => sub { + ... + }, + server => sub { + ... + }, + host => '0.0.0.0', + ); + +- How should I write IPv6 tests? + + You should use the \`Net::EmptyPort::can\_bind\` function to check if the program can bind to the loopback address of IPv6, as well as the \`host\` parameter of the \`test\_tcp\` function to specify the same address as the bind address. + + use Net::EmptyPort qw(can_bind); + + plan skip_all => "IPv6 not available" + unless can_bind('::1'); + + test_tcp( + client => sub { + ... + }, + server => sub { + ... + }, + host => '::1', + ); + # AUTHOR Tokuhiro Matsuno <tokuhi...@gmail.com> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/cpanfile new/Test-TCP-2.11/cpanfile --- old/Test-TCP-2.02/cpanfile 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/cpanfile 2015-04-07 02:07:40.000000000 +0200 @@ -1,6 +1,7 @@ requires 'perl', 5.008_001; requires 'IO::Socket::INET'; -requires 'Test::SharedFork', '0.19'; +requires 'IO::Socket::IP'; +requires 'Test::SharedFork', '0.29'; requires 'Test::More'; requires 'Time::HiRes'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/lib/Net/EmptyPort.pm new/Test-TCP-2.11/lib/Net/EmptyPort.pm --- old/Test-TCP-2.02/lib/Net/EmptyPort.pm 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/lib/Net/EmptyPort.pm 2015-04-07 02:07:40.000000000 +0200 @@ -2,57 +2,67 @@ use strict; use warnings; use base qw/Exporter/; -use IO::Socket::INET; +use IO::Socket::IP; use Time::HiRes (); -our @EXPORT = qw/ empty_port check_port wait_port /; +our @EXPORT = qw/ can_bind empty_port check_port wait_port /; + +sub can_bind { + my ($host, $port, $proto) = @_; + $port ||= 0; + $proto ||= 'tcp'; + my $s = IO::Socket::IP->new( + (($proto eq 'udp') ? () : (Listen => 5)), + LocalAddr => $host, + LocalPort => $port, + Proto => $proto, + V6Only => 1, + (($^O eq 'MSWin32') ? () : (ReuseAddr => 1)), + ); + defined $s; +} # get a empty port on 49152 .. 65535 # http://www.iana.org/assignments/port-numbers sub empty_port { - my $port = do { - if (defined $_[0]) { - my $p = $_[0]; - $p = 49152 unless $p =~ /^[0-9]+$/ && $p < 49152; - $p; - } else { - 50000 + int(rand()*1000); - } - }; - my $proto = $_[1] ? lc($_[1]) : 'tcp'; + my ($host, $port, $proto) = @_ && ref $_[0] eq 'HASH' ? ($_[0]->{host}, $_[0]->{port}, $_[0]->{proto}) : (undef, @_); + $host = '127.0.0.1' + unless defined $host; + if (defined $port) { + $port = 49152 unless $port =~ /^[0-9]+$/ && $port < 49152; + } else { + $port = 50000 + (int(rand()*1500) + abs($$)) % 1500; + } + $proto = $proto ? lc($proto) : '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)); - - my $sock = IO::Socket::INET->new( - (($proto eq 'udp') ? () : (Listen => 5)), - LocalAddr => '127.0.0.1', - LocalPort => $port, - Proto => $proto, - (($^O eq 'MSWin32') ? () : (ReuseAddr => 1)), - ); - return $port if $sock; + next if ($proto eq 'tcp' && check_port({ host => $host, port => $port })); + return $port if can_bind($host, $port, $proto); } die "empty port not found"; } sub check_port { - my $port = $_[0]; - my $proto = $_[1] ? lc($_[1]) : 'tcp'; + my ($host, $port, $proto) = @_ && ref $_[0] eq 'HASH' ? ($_[0]->{host}, $_[0]->{port}, $_[0]->{proto}) : (undef, @_); + $host = '127.0.0.1' + unless defined $host; + $proto = $proto ? lc($proto) : 'tcp'; # for TCP, we do a remote port check # for UDP, we do a local port check, like empty_port does my $sock = ($proto eq 'tcp') ? - IO::Socket::INET->new( + IO::Socket::IP->new( Proto => 'tcp', - PeerAddr => '127.0.0.1', + PeerAddr => $host, PeerPort => $port, + V6Only => 1, ) : - IO::Socket::INET->new( + IO::Socket::IP->new( Proto => $proto, - LocalAddr => '127.0.0.1', + LocalAddr => $host, LocalPort => $port, + V6Only => 1, (($^O eq 'MSWin32') ? () : (ReuseAddr => 1)), ) ; @@ -73,7 +83,7 @@ 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; @@ -84,21 +94,23 @@ } sub wait_port { - my ($port, $max_wait, $proto); - if (@_==4) { + my ($host, $port, $max_wait, $proto); + if (@_ && ref $_[0] eq 'HASH') { + ($host, $port, $max_wait, $proto) = ($_[0]->{host}, $_[0]->{port}, $_[0]->{max_wait}, $_[0]->{proto}); + } elsif (@_==4) { # backward compat. ($port, (my $sleep), (my $retry), $proto) = @_; - $max_wait = $max_wait*$retry; - $proto = $proto ? lc($proto) : 'tcp'; + $max_wait = $sleep * $retry; } else { ($port, $max_wait, $proto) = @_; - $proto = $proto ? lc($proto) : 'tcp'; } - + $host = '127.0.0.1' unless defined $host; + $max_wait ||= 10; + $proto = $proto ? lc($proto) : 'tcp'; my $waiter = _make_waiter($max_wait); while ( $waiter->() ) { - if ($^O eq 'MSWin32' ? `$^X -MTest::TCP::CheckPort -echeck_port $port $proto` : check_port( $port, $proto )) { + if ($^O eq 'MSWin32' ? `$^X -MTest::TCP::CheckPort -echeck_port $port $proto` : check_port({ host => $host, port => $port, proto => $proto })) { return 1; } } @@ -137,49 +149,117 @@ =item C<< empty_port() >> +=item C<< empty_port(\%args) >> + +=item C<< empty_port($port) >> + +=item C<< empty_port($port, $proto) >> + my $port = empty_port(); -Get the available port number, you can use. +Returns a port number that is NOT in use. + +The function recognizes the following keys when given a hashref as the argument. + +=over 4 + +=item C<< host >> + +specifies the address on which the search should be performed. Default is C<< 127.0.0.1 >>. + +=item C<< port >> + +Lower bound of the search for an empty port. If omitted, the function searches for an empty port within 49152..65535. -Normally, empty_port() finds empty port number from 49152..65535. See L<http://www.iana.org/assignments/port-numbers> -But you want to use another range, use a following form: +=item C<< proto >> + +Name of the protocol. Default is C<< tcp >>. You can find an empty UDP port by specifying C<< udp >>. - # 5963..65535 - my $port = empty_port(5963); +=back -You can also find an empty UDP port by specifying the protocol as +To maintain backwards compatibility, the function accepts scalar arguments as well. For example, you can also find an empty UDP port by specifying the protocol as the second parameter: my $port = empty_port(1024, 'udp'); # use 49152..65535 range my $port = empty_port(undef, 'udp'); -=item C<< check_port($port:Int) >> +=item C<< check_port(\%args) >> + +=item C<< check_port($port) >> + +=item C<< check_port($port, $proto) >> my $true_or_false = check_port(5000); Checks if the given port is already in use. Returns true if it is in use (i.e. if the port is NOT free). Returns false if the port is free. -Also works for UDP: +The function recognizes the following keys when given a hashref as the argument. + +=over 4 + +=item C<< host >> + +specifies the address on which the search should be performed. Default is C<< 127.0.0.1 >>. + +=item C<< port >> + +specifies the port to check. This argument is mandatory. + +=item C<< proto >> + +name of the protocol. Default is C<< tcp >>. + +=back + +To maintain backwards compatibility, the function accepts scalar arguments as well in the form described above. + +=item C<< wait_port(\%args) >> + +=item C<< wait_port($port) >> + +=item C<< wait_port($port, $max_wait) >> - my $true_or_false = check_port(5000, 'udp'); +=item C<< wait_port($port, $max_wait, $proto) >> -=item C<< wait_port($port:Int[, $max_wait:Number,$proto:String]) >> +Waits until a particular port becomes ready to connect to. Returns true if the port becomes ready, or false if otherwise. -Waits for a particular port is available for connect. +The function recognizes the following keys when given a hashref as the argument. -This method waits the C<< $port >> number is ready to accept a request. +=over 4 + +=item C<< host >> + +specifies the address on which the search should be performed. Default is C<< 127.0.0.1 >>. + +=item C<< port >> -C<$port> is a port number to check. +specifies the port to check. This argument is mandatory. -Sleep up to C<$max_wait> seconds for checking the port. +=item C<< max_wait >> -I<Return value> : Return true if the port is available, false otherwise. +maximum seconds to wait for (default is 10 seconds). Pass a negative value to wait infinitely. + +=item C<< proto >> + +name of the protocol. Default is C<< tcp >>. + +=back + +To maintain backwards compatibility, the function accepts scalar arguments as well in the form described above. B<Incompatible changes>: Before 2.0, C<< wait_port($port:Int[, $sleep:Number, $retry:Int, $proto:String]) >> is a signature. +=item C<< can_bind($host) >> + +=item C<< can_bind($host, $port) >> + +=item C<< can_bind($host, $port, $proto) >> + +Checks if the application is capable of binding to given port. + =back =head1 AUTHOR diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/lib/Test/TCP.pm new/Test-TCP-2.11/lib/Test/TCP.pm --- old/Test-TCP-2.02/lib/Test/TCP.pm 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/lib/Test/TCP.pm 2015-04-07 02:07:40.000000000 +0200 @@ -2,7 +2,7 @@ use strict; use warnings; use 5.00800; -our $VERSION = '2.02'; +our $VERSION = '2.11'; use base qw/Exporter/; use IO::Socket::INET; use Test::SharedFork 0.12; @@ -24,13 +24,10 @@ die "missing madatory parameter $k" unless exists $args{$k}; } my $server_code = delete $args{server}; - my $port = delete($args{port}) || empty_port(); - my $client_code = delete $args{client}; my $server = Test::TCP->new( code => $server_code, - port => $port, %args, ); $client_code->($server->port, $server->pid); @@ -38,18 +35,24 @@ } sub wait_port { - my ($port, $max_wait); - if (@_==3) { + my ($host, $port, $max_wait); + if (@_ && ref $_[0] eq 'HASH') { + $host = $_[0]->{host}; + $port = $_[0]->{port}; + $max_wait = $_[0]->{max_wait}; + } elsif (@_ == 3) { # backward compat ($port, (my $sleep), (my $retry)) = @_; $max_wait = $sleep * $retry; - } else { + } else { ($port, $max_wait) = @_; } + $host = '127.0.0.1' + unless defined $host; $max_wait ||= 10; - Net::EmptyPort::wait_port($port, $max_wait) - or die "cannot open port: $port"; + Net::EmptyPort::wait_port({ host => $host, port => $port, max_wait => $max_wait }) + or die "cannot open port: $host:$port"; } # ------------------------------------------------------------------------- @@ -62,10 +65,11 @@ my $self = bless { auto_start => 1, max_wait => 10, + host => '127.0.0.1', _my_pid => $$, %args, }, $class; - $self->{port} = empty_port() unless exists $self->{port}; + $self->{port} ||= empty_port({ host => $self->{host} }); $self->start() if $self->{auto_start}; return $self; @@ -81,7 +85,7 @@ if ( $pid ) { # parent process. $self->{pid} = $pid; - Test::TCP::wait_port($self->port, $self->{max_wait}); + Test::TCP::wait_port({ host => $self->{host}, port => $self->port, max_wait => $self->{max_wait} }); return; } else { # child process $self->{code}->($self->port); @@ -214,6 +218,7 @@ # run server }, # optional + host => '127.0.0.1', # specify '::1' to test using IPv6 port => 8080, max_wait => 3, # seconds ); @@ -351,6 +356,40 @@ done_testing; +=item How do I use address other than "127.0.0.1" for testing? + +You can use the C<< host >> paramater to specify the bind address. + + # let the server bind to "0.0.0.0" for testing + test_tcp( + client => sub { + ... + }, + server => sub { + ... + }, + host => '0.0.0.0', + ); + +=item How should I write IPv6 tests? + +You should use the `Net::EmptyPort::can_bind` function to check if the program can bind to the loopback address of IPv6, as well as the `host` parameter of the `test_tcp` function to specify the same address as the bind address. + + use Net::EmptyPort qw(can_bind); + + plan skip_all => "IPv6 not available" + unless can_bind('::1'); + + test_tcp( + client => sub { + ... + }, + server => sub { + ... + }, + host => '::1', + ); + =back =head1 AUTHOR diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/minil.toml new/Test-TCP-2.11/minil.toml --- old/Test-TCP-2.02/minil.toml 1970-01-01 01:00:00.000000000 +0100 +++ new/Test-TCP-2.11/minil.toml 2015-04-07 02:07:40.000000000 +0200 @@ -0,0 +1 @@ +module_maker="ExtUtilsMakeMaker" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/t/01_simple.t new/Test-TCP-2.11/t/01_simple.t --- old/Test-TCP-2.02/t/01_simple.t 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/t/01_simple.t 2015-04-07 02:07:40.000000000 +0200 @@ -1,41 +1,58 @@ use warnings; use strict; -use Test::More tests => 22; +use Test::More; use Test::TCP; -use IO::Socket::INET; +use Net::EmptyPort qw(can_bind); +use IO::Socket::IP; use t::Server; -test_tcp( - client => sub { - my $port = shift; - ok $port, "test case for sharedfork" for 1..10; - my $sock = IO::Socket::INET->new( - PeerPort => $port, - PeerAddr => '127.0.0.1', - Proto => 'tcp' - ) or die "Cannot open client socket: $!"; - - note "send 1"; - print {$sock} "foo\n"; - my $res = <$sock>; - is $res, "foo\n"; - - note "send 2"; - print {$sock} "bar\n"; - my $res2 = <$sock>; - is $res2, "bar\n"; - - note "finalize"; - print {$sock} "quit\n"; - }, - server => sub { - my $port = shift; - ok $port, "test case for sharedfork" for 1..10; - t::Server->new($port)->run(sub { - note "new request"; - my ($remote, $line, $sock) = @_; - print {$remote} $line; - }); - }, -); +sub doit { + my $host = shift; + ok 1, "starting the test"; + test_tcp( + client => sub { + my $port = shift; + ok $port, "test case for sharedfork" for 1..10; + my $sock = IO::Socket::IP->new( + PeerPort => $port, + PeerAddr => $host, + Proto => 'tcp', + V6Only => 1, + ) or die "Cannot open client socket: $!"; + note "send 1"; + print {$sock} "foo\n"; + my $res = <$sock>; + is $res, "foo\n"; + + note "send 2"; + print {$sock} "bar\n"; + my $res2 = <$sock>; + is $res2, "bar\n"; + + note "finalize"; + print {$sock} "quit\n"; + }, + server => sub { + my $port = shift; + ok $port, "test case for sharedfork" for 1..10; + t::Server->new($host, $port)->run(sub { + note "new request"; + my ($remote, $line, $sock) = @_; + print {$remote} $line; + }); + }, + host => $host, + ); +} + +subtest 'v4' => sub { + doit('127.0.0.1'); +}; +subtest 'v6' => sub { + plan skip_all => "IPv6 not supported" + unless can_bind("::1"); + doit('::1'); +}; + +done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/t/02_abrt.t new/Test-TCP-2.11/t/02_abrt.t --- old/Test-TCP-2.02/t/02_abrt.t 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/t/02_abrt.t 2015-04-07 02:07:40.000000000 +0200 @@ -25,7 +25,7 @@ }, server => sub { my $port = shift; - t::Server->new($port)->run(sub { + t::Server->new('127.0.0.1', $port)->run(sub { my ($remote, $line) = @_; print {$remote} $line; if ($line =~ /dump/) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/t/03_return_when_sigterm.t new/Test-TCP-2.11/t/03_return_when_sigterm.t --- old/Test-TCP-2.02/t/03_return_when_sigterm.t 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/t/03_return_when_sigterm.t 2015-04-07 02:07:40.000000000 +0200 @@ -14,7 +14,7 @@ }, server => sub { my $port = shift; - my $sock = new_sock($port); + my $sock = new_sock('127.0.0.1', $port); my $term_received = 0; $SIG{TERM} = sub { $term_received++ }; while ($term_received == 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/t/04_die.t new/Test-TCP-2.11/t/04_die.t --- old/Test-TCP-2.02/t/04_die.t 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/t/04_die.t 2015-04-07 02:07:40.000000000 +0200 @@ -16,7 +16,7 @@ }, server => sub { my $port = shift; - t::Server->new($port)->run(sub { }); + t::Server->new('127.0.0.1', $port)->run(sub { }); }, ); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/t/05_sigint.t new/Test-TCP-2.11/t/05_sigint.t --- old/Test-TCP-2.02/t/05_sigint.t 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/t/05_sigint.t 2015-04-07 02:07:40.000000000 +0200 @@ -18,6 +18,10 @@ 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"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/t/06_nest.t new/Test-TCP-2.11/t/06_nest.t --- old/Test-TCP-2.02/t/06_nest.t 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/t/06_nest.t 2015-04-07 02:07:40.000000000 +0200 @@ -14,13 +14,13 @@ }, server => sub { my $port2 = shift; - t::Server->new($port2)->run; + t::Server->new('127.0.0.1', $port2)->run; }, ); }, server => sub { my $port1 = shift; - t::Server->new($port1)->run; + t::Server->new('127.0.0.1', $port1)->run; }, ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/t/08_exit.t new/Test-TCP-2.11/t/08_exit.t --- old/Test-TCP-2.02/t/08_exit.t 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/t/08_exit.t 2015-04-07 02:07:40.000000000 +0200 @@ -44,7 +44,7 @@ note "SEVER: $$"; print {$tmp} $$; $tmp->close; - t::Server->new($port)->run(sub { + t::Server->new('127.0.0.1', $port)->run(sub { note "new request"; my ($remote, $line, $sock) = @_; print {$remote} $line; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/t/09_fork.t new/Test-TCP-2.11/t/09_fork.t --- old/Test-TCP-2.02/t/09_fork.t 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/t/09_fork.t 2015-04-07 02:07:40.000000000 +0200 @@ -42,7 +42,7 @@ }, server => sub { my $port = shift; - t::Server->new($port)->run(sub { + t::Server->new('127.0.0.1', $port)->run(sub { note "new request"; my ($remote, $line, $sock) = @_; print {$remote} $line; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/t/10_oo.t new/Test-TCP-2.11/t/10_oo.t --- old/Test-TCP-2.02/t/10_oo.t 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/t/10_oo.t 2015-04-07 02:07:40.000000000 +0200 @@ -9,7 +9,7 @@ code => sub { my $port = shift; ok $port, "test case for sharedfork" for 1..10; - t::Server->new($port)->run(sub { + t::Server->new('127.0.0.1', $port)->run(sub { note "new request"; my ($remote, $line, $sock) = @_; print {$remote} $line; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/t/11_net_empty_port.t new/Test-TCP-2.11/t/11_net_empty_port.t --- old/Test-TCP-2.02/t/11_net_empty_port.t 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/t/11_net_empty_port.t 2015-04-07 02:07:40.000000000 +0200 @@ -1,18 +1,39 @@ use strict; use warnings; +use IO::Socket::IP; use Test::More; use Net::EmptyPort; -my $port = empty_port; -ok $port, "found an empty port"; -ok !wait_port( $port, 0.1 ), "port is closed"; - -my $sock = IO::Socket::INET->new( - LocalAddr => '127.0.0.1', - LocalPort => $port, - Listen => 1, -) or die "Couldn't create socket: $!"; +sub doit { + my $host = shift; -ok wait_port( $port, 3 ), "port is open"; + my $port = empty_port(); + ok "found an empty port"; + + ok !wait_port({ host => $host, port => $port, max_wait => 0.1 }), "port is closed"; + + my $sock = IO::Socket::IP->new( + LocalAddr => $host, + LocalPort => $port, + Listen => 1, + V6Only => 1, + ) or die "Couldn't create socket: $!"; + + ok wait_port({ host => $host, port => $port, max_wait => 3 }), "port is open"; +}; + +ok can_bind('127.0.0.1'), 'bind to 127.0.0.1'; +ok ! can_bind('8.8.8.8'), 'bind to an anvailable address'; + +subtest 'v4' => sub { + doit('127.0.0.1'); +}; + +subtest 'v6' => sub { + plan skip_all => "IPv6 not supported" + unless can_bind('::1'); + ok "found an empty port"; + doit('::1'); +}; done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/t/12_pass_wait_port_options.t new/Test-TCP-2.11/t/12_pass_wait_port_options.t --- old/Test-TCP-2.02/t/12_pass_wait_port_options.t 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/t/12_pass_wait_port_options.t 2015-04-07 02:07:40.000000000 +0200 @@ -6,14 +6,14 @@ use IO::Socket::INET; use t::Server; -my ($port, $max_wait); +my %wait_port_args; my $old = \&Net::EmptyPort::wait_port; my $return = sub { 1 }; { no warnings 'redefine'; *Net::EmptyPort::wait_port = sub { - ($port, $max_wait) = @_; + %wait_port_args = %{$_[0]}; $return->(@_); }; } @@ -21,7 +21,7 @@ # Test::TCP::wait_port arguments are passed to Net::EmptyPort::wait_port. { Test::TCP::wait_port(1, 1); - is($max_wait, 1); + is($wait_port_args{max_wait}, 1); } $return = sub { $old->(@_) }; @@ -29,7 +29,7 @@ my $server = sub { my $port = shift; ok $port, "test case for sharedfork" for 1 .. 10; - t::Server->new($port)->run(sub { + t::Server->new('127.0.0.1', $port)->run(sub { note "new request"; my ($remote, $line, $sock) = @_; print {$remote} $line; @@ -63,7 +63,7 @@ { my $tcp = Test::TCP->new( code => $server, - max_wait => 3, + max_wait => -3, ); $client->($tcp->port); if ($?) { @@ -73,7 +73,7 @@ $? = 0; } - is($max_wait, 3); + is($wait_port_args{max_wait}, -3); } # test_tcp() arguments are passed to Net::EmptyPort::wait_port. @@ -81,9 +81,9 @@ test_tcp( client => $client, server => $server, - max_wait => 2, + max_wait => -2, ); - is($max_wait, 2); + is($wait_port_args{max_wait}, -2); } done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/t/13_undef_port.t new/Test-TCP-2.11/t/13_undef_port.t --- old/Test-TCP-2.02/t/13_undef_port.t 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/t/13_undef_port.t 2015-04-07 02:07:40.000000000 +0200 @@ -31,7 +31,7 @@ server => sub { my $port = shift; ok $port, "test case for sharedfork" for 1..10; - t::Server->new($port)->run(sub { + t::Server->new('127.0.0.1', $port)->run(sub { note "new request"; my ($remote, $line, $sock) = @_; print {$remote} $line; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-TCP-2.02/t/Server.pm new/Test-TCP-2.11/t/Server.pm --- old/Test-TCP-2.02/t/Server.pm 2013-10-30 04:23:09.000000000 +0100 +++ new/Test-TCP-2.11/t/Server.pm 2015-04-07 02:07:40.000000000 +0200 @@ -2,27 +2,28 @@ use strict; use warnings; use base qw/Exporter/; -use IO::Socket::INET; +use IO::Socket::IP; our @EXPORT = qw/new_sock/; sub new_sock { - my $port = shift; - my $sock = IO::Socket::INET->new( + my ($host, $port) = @_; + my $sock = IO::Socket::IP->new( LocalPort => $port, - LocalAddr => '127.0.0.1', + LocalAddr => $host, Proto => 'tcp', Listen => 5, Type => SOCK_STREAM, + V6Only => 1, (($^O eq 'MSWin32') ? () : (ReuseAddr => 1)), ) or die "Cannot open server socket: $!"; return $sock; } sub new { - my ($class, $port) = @_; + my ($class, $host, $port) = @_; - my $sock = new_sock($port); + my $sock = new_sock($host, $port); bless { sock => $sock }, $class; } ++++++ cpanspec.yml ++++++ --- #description_paragraphs: 3 #no_testing: broken upstream #sources: # - source1 # - source2 #patches: # foo.patch: -p1 # bar.patch: #preamble: |- # BuildRequires: gcc-c++ #post_prep: |- # hunspell=`pkg-config --libs hunspell | sed -e 's,-l,,; s, *,,g'` # sed -i -e "s,hunspell-X,$hunspell," t/00-prereq.t Makefile.PL #post_install: |- # sed on %{name}.files #license: SUSE-NonFree #skip_noarch: 1 #custom_build: - #./Build build flags=%{?_smp_mflags} --myflag