Hello community,

here is the log from the commit of package perl-Test-TCP for openSUSE:Factory 
checked in at 2017-05-03 15:57:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Test-TCP (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Test-TCP.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Test-TCP"

Wed May  3 15:57:24 2017 rev:13 rq:492408 version:2.18

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Test-TCP/perl-Test-TCP.changes      
2016-08-22 10:07:21.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.perl-Test-TCP.new/perl-Test-TCP.changes 
2017-05-03 15:57:25.874183672 +0200
@@ -1,0 +2,11 @@
+Tue Apr 25 06:52:34 UTC 2017 - [email protected]
+
+- updated to 2.18
+   see /usr/share/doc/packages/perl-Test-TCP/Changes
+
+  2.18 2017-04-24T06:00:25Z
+      - let the kernel select an empty port #59
+        https://github.com/tokuhirom/Test-TCP/pull/59
+        (i110)
+
+-------------------------------------------------------------------

Old:
----
  Test-TCP-2.17.tar.gz

New:
----
  Test-TCP-2.18.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Test-TCP.spec ++++++
--- /var/tmp/diff_new_pack.mFwYRf/_old  2017-05-03 15:57:26.598081477 +0200
+++ /var/tmp/diff_new_pack.mFwYRf/_new  2017-05-03 15:57:26.602080912 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package perl-Test-TCP
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 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,14 +17,14 @@
 
 
 Name:           perl-Test-TCP
-Version:        2.17
+Version:        2.18
 Release:        0
 %define cpan_name Test-TCP
 Summary:        Testing Tcp Program
 License:        Artistic-1.0 or GPL-1.0+
 Group:          Development/Libraries/Perl
 Url:            http://search.cpan.org/dist/Test-TCP/
-Source0:        
http://www.cpan.org/authors/id/S/SY/SYOHEX/%{cpan_name}-%{version}.tar.gz
+Source0:        
https://cpan.metacpan.org/authors/id/T/TO/TOKUHIROM/%{cpan_name}-%{version}.tar.gz
 Source1:        cpanspec.yml
 BuildArch:      noarch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -57,6 +57,7 @@
 
 %files -f %{name}.files
 %defattr(-,root,root,755)
-%doc Changes LICENSE minil.toml README.md
+%doc Changes minil.toml README.md
+%license LICENSE
 
 %changelog

++++++ Test-TCP-2.17.tar.gz -> Test-TCP-2.18.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Test-TCP-2.17/Changes new/Test-TCP-2.18/Changes
--- old/Test-TCP-2.17/Changes   2016-08-18 16:43:22.000000000 +0200
+++ new/Test-TCP-2.18/Changes   2017-04-24 08:01:16.000000000 +0200
@@ -1,5 +1,10 @@
 Revision history for Perl module Test::TCP
 
+2.18 2017-04-24T06:00:25Z
+    - let the kernel select an empty port #59
+      https://github.com/tokuhirom/Test-TCP/pull/59
+      (i110)
+
 2.17 2016-08-18T14:42:56Z
     - check_port can take 'host' argument(#55)
     - Fix test on Windows issue(#55)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Test-TCP-2.17/META.json new/Test-TCP-2.18/META.json
--- old/Test-TCP-2.17/META.json 2016-08-18 16:43:22.000000000 +0200
+++ new/Test-TCP-2.18/META.json 2017-04-24 08:01:16.000000000 +0200
@@ -4,7 +4,7 @@
       "Tokuhiro Matsuno <[email protected]>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "Minilla/v3.0.4",
+   "generated_by" : "Minilla/v3.0.9",
    "license" : [
       "perl_5"
    ],
@@ -67,7 +67,7 @@
       },
       "Test::TCP" : {
          "file" : "lib/Test/TCP.pm",
-         "version" : "2.17"
+         "version" : "2.18"
       },
       "Test::TCP::CheckPort" : {
          "file" : "lib/Test/TCP/CheckPort.pm"
@@ -84,7 +84,7 @@
          "web" : "https://github.com/tokuhirom/Test-TCP";
       }
    },
-   "version" : "2.17",
+   "version" : "2.18",
    "x_contributors" : [
       "tokuhirom <tokuhirom@d0d07461-0603-4401-acd4-de1884942a52>",
       "mattn <mattn@d0d07461-0603-4401-acd4-de1884942a52>",
@@ -110,7 +110,10 @@
       "David Precious <[email protected]>",
       "Alex Vandiver <[email protected]>",
       "richard.leach <[email protected]>",
-      "Syohei YOSHIDA <[email protected]>"
+      "openstrike <[email protected]>",
+      "Pete Houston <[email protected]>",
+      "Syohei YOSHIDA <[email protected]>",
+      "Ichito Nagata <[email protected]>"
    ],
    "x_serialization_backend" : "JSON::PP version 2.27400"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Test-TCP-2.17/META.yml new/Test-TCP-2.18/META.yml
--- old/Test-TCP-2.17/META.yml  2016-08-18 16:43:22.000000000 +0200
+++ new/Test-TCP-2.18/META.yml  2017-04-24 08:01:16.000000000 +0200
@@ -9,7 +9,7 @@
 configure_requires:
   ExtUtils::MakeMaker: '6.64'
 dynamic_config: 0
-generated_by: 'Minilla/v3.0.4, CPAN::Meta::Converter version 2.150005'
+generated_by: 'Minilla/v3.0.9, CPAN::Meta::Converter version 2.150010'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -30,7 +30,7 @@
     file: lib/Net/EmptyPort.pm
   Test::TCP:
     file: lib/Test/TCP.pm
-    version: '2.17'
+    version: '2.18'
   Test::TCP::CheckPort:
     file: lib/Test/TCP/CheckPort.pm
 requires:
@@ -44,7 +44,7 @@
   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.17'
+version: '2.18'
 x_contributors:
   - 'tokuhirom <tokuhirom@d0d07461-0603-4401-acd4-de1884942a52>'
   - 'mattn <mattn@d0d07461-0603-4401-acd4-de1884942a52>'
@@ -70,5 +70,8 @@
   - 'David Precious <[email protected]>'
   - 'Alex Vandiver <[email protected]>'
   - 'richard.leach <[email protected]>'
+  - 'openstrike <[email protected]>'
+  - 'Pete Houston <[email protected]>'
   - 'Syohei YOSHIDA <[email protected]>'
+  - 'Ichito Nagata <[email protected]>'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Test-TCP-2.17/Makefile.PL 
new/Test-TCP-2.18/Makefile.PL
--- old/Test-TCP-2.17/Makefile.PL       2016-08-18 16:43:22.000000000 +0200
+++ new/Test-TCP-2.18/Makefile.PL       2017-04-24 08:01:16.000000000 +0200
@@ -12,7 +12,7 @@
 my %WriteMakefileArgs = (
     NAME     => 'Test::TCP',
     DISTNAME => 'Test-TCP',
-    VERSION  => '2.17',
+    VERSION  => '2.18',
     EXE_FILES => [glob('script/*'), glob('bin/*')],
     CONFIGURE_REQUIRES => {
   "ExtUtils::MakeMaker" => "6.64"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Test-TCP-2.17/lib/Net/EmptyPort.pm 
new/Test-TCP-2.18/lib/Net/EmptyPort.pm
--- old/Test-TCP-2.17/lib/Net/EmptyPort.pm      2016-08-18 16:43:22.000000000 
+0200
+++ new/Test-TCP-2.18/lib/Net/EmptyPort.pm      2017-04-24 08:01:16.000000000 
+0200
@@ -42,17 +42,24 @@
     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';
+
     if (defined $port) {
+        # to ensure lower bound, check one by one in order
         $port = 49152 unless $port =~ /^[0-9]+$/ && $port < 49152;
+        while ( $port++ < 65000 ) {
+            # Remote checks don't work on UDP, and Local checks would be 
redundant here...
+            next if ($proto eq 'tcp' && check_port({ host => $host, port => 
$port }));
+            return $port if can_bind($host, $port, $proto);
+        }
     } else {
-        $port = 50000 + (int(rand()*1500) + abs($$)) % 1500;
-    }
-    $proto = $proto ? lc($proto) : 'tcp';
-
-    while ( $port++ < 65000 ) {
-        # Remote checks don't work on UDP, and Local checks would be redundant 
here...
-        next if ($proto eq 'tcp' && check_port({ host => $host, port => $port 
}));
-        return $port if can_bind($host, $port, $proto);
+        # kernel will select an unused port
+        while ( my $sock = _listen_socket($host, undef, $proto) ) {
+            $port = $sock->sockport;
+            $sock->close;
+            next if ($proto eq 'tcp' && check_port({ host => $host, port => 
$port }));
+            return $port;
+        }
     }
     die "empty port not found";
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Test-TCP-2.17/lib/Test/TCP.pm 
new/Test-TCP-2.18/lib/Test/TCP.pm
--- old/Test-TCP-2.17/lib/Test/TCP.pm   2016-08-18 16:43:22.000000000 +0200
+++ new/Test-TCP-2.18/lib/Test/TCP.pm   2017-04-24 08:01:16.000000000 +0200
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use 5.00800;
-our $VERSION = '2.17';
+our $VERSION = '2.18';
 use base qw/Exporter/;
 use Test::SharedFork 0.12;
 use Test::More ();
@@ -20,7 +20,7 @@
 sub test_tcp {
     my %args = @_;
     for my $k (qw/client server/) {
-        die "missing madatory parameter $k" unless exists $args{$k};
+        die "missing mandatory parameter $k" unless exists $args{$k};
     }
     my $server_code = delete $args{server};
     my $client_code = delete $args{client};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Test-TCP-2.17/t/04_die.t new/Test-TCP-2.18/t/04_die.t
--- old/Test-TCP-2.17/t/04_die.t        2016-08-18 16:43:22.000000000 +0200
+++ new/Test-TCP-2.18/t/04_die.t        2017-04-24 08:01:16.000000000 +0200
@@ -1,6 +1,6 @@
 use warnings;
 use strict;
-use Test::More tests => 3;
+use Test::More tests => 9;
 use Test::TCP;
 use IO::Socket::INET;
 use t::Server;
@@ -33,3 +33,17 @@
     $? = 0;
 }
 
+eval { test_tcp (); };
+$e = $@;
+ok ($e, 'No client is fatal error');
+like ($e, qr/missing mandatory parameter client/, 'No client is fatal error');
+
+eval { test_tcp (client => 1); };
+$e = $@;
+ok ($e, 'No server is fatal error');
+like ($e, qr/missing mandatory parameter server/, 'No server is fatal error');
+
+eval { Test::TCP->new (); };
+$e = $@;
+ok ($e, 'No code is fatal error');
+like ($e, qr/missing mandatory parameter 'code'/, 'No code is fatal error');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Test-TCP-2.17/t/10_oo.t new/Test-TCP-2.18/t/10_oo.t
--- old/Test-TCP-2.17/t/10_oo.t 2016-08-18 16:43:22.000000000 +0200
+++ new/Test-TCP-2.18/t/10_oo.t 2017-04-24 08:01:16.000000000 +0200
@@ -1,6 +1,6 @@
 use warnings;
 use strict;
-use Test::More tests => 22;
+use Test::More tests => 24;
 use Test::TCP;
 use IO::Socket::INET;
 use t::Server;
@@ -47,5 +47,21 @@
 
 waitpid($server->pid, 0);
 
+my $s2 = Test::TCP->new (
+    code        => sub { return 1; },
+    port        => 8080,
+    auto_start  => 0
+);
+is ($s2->port, 8080, 'Specify port');
+
+$s2 = Test::TCP->new (
+    {
+        code        => sub { return 1; },
+        port        => 8080,
+        auto_start  => 0
+    }
+);
+is ($s2->port, 8080, 'Args as hashref');
+
 done_testing;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Test-TCP-2.17/t/11_net_empty_port.t 
new/Test-TCP-2.18/t/11_net_empty_port.t
--- old/Test-TCP-2.17/t/11_net_empty_port.t     2016-08-18 16:43:22.000000000 
+0200
+++ new/Test-TCP-2.18/t/11_net_empty_port.t     2017-04-24 08:01:16.000000000 
+0200
@@ -59,4 +59,28 @@
     ok $sock;
 };
 
+my $port = empty_port (8080, 'tcp');
+ok ($port, 'Non hashref arg to empty_port');
+cmp_ok ($port, '<', 49152, 'Specified low port to empty_port');
+$port = empty_port (50000, 'tcp');
+cmp_ok ($port, '>', 49151, 'Specified high port to empty_port');
+$port = empty_port ('alpha', 'tcp');
+cmp_ok ($port, '>', 49151, 'Specified non-numeric port to empty_port');
+$port = empty_port ('alpha', 'udp');
+cmp_ok ($port, '>', 49151, 'Specified non-numeric port and udp proto to 
empty_port');
+
+
+$port = empty_port ();
+ok (!wait_port ($port, 0.1, 2, 'tcp'),
+    '4 args to wait_port (backwards compat)');
+ok (!wait_port ($port, 0.2, 'tcp'),
+    '3 args to wait_port');
+eval { wait_port (); };
+like ($@, qr/Expected .PeerService./, 'No args to wait_port is fatal');
+ok (!wait_port ($port), 'No max_wait to wait_port');
+
+eval { check_port (); };
+like ($@, qr/Expected .PeerService./, 'No args to check_port is fatal');
+ok (!check_port (empty_port(), 'tcp'), '2 args to check_port');
+
 done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Test-TCP-2.17/t/12_pass_wait_port_options.t 
new/Test-TCP-2.18/t/12_pass_wait_port_options.t
--- old/Test-TCP-2.17/t/12_pass_wait_port_options.t     2016-08-18 
16:43:22.000000000 +0200
+++ new/Test-TCP-2.18/t/12_pass_wait_port_options.t     2017-04-24 
08:01:16.000000000 +0200
@@ -22,6 +22,12 @@
 {
     Test::TCP::wait_port(1, 1);
     is($wait_port_args{max_wait}, 1);
+    Test::TCP::wait_port ();
+    is($wait_port_args{max_wait}, 10, 'Default max_wait');
+    is($wait_port_args{host}, '127.0.0.1', 'Default host');
+    Test::TCP::wait_port (2, 5, 7);
+    is($wait_port_args{port}, 2, 'Backwards compatible port');
+    is($wait_port_args{max_wait}, 35, 'Backwards compatible max_wait');
 }
 
 $return = sub { $old->(@_) };


Reply via email to