[libgearman-client-perl] 01/04: add a patch usiing random ports for the test servers Closes: #723940 -- test fail when port 9050 is in use

Damyan Ivanov dmn at moszumanska.debian.org
Thu Jan 9 15:05:54 UTC 2014


This is an automated email from the git hooks/post-receive script.

dmn pushed a commit to branch master
in repository libgearman-client-perl.

commit 8221b4a0d54a9c2d47ec075ef9bed260394379fd
Author: Damyan Ivanov <dmn at debian.org>
Date:   Thu Jan 9 15:00:45 2014 +0000

    add a patch usiing random ports for the test servers Closes: #723940 -- test fail when port 9050 is in use
---
 debian/changelog                       |  7 ++++
 debian/patches/series                  |  1 +
 debian/patches/test-random-ports.patch | 61 ++++++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index cd8b835..d1a6f9b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+libgearman-client-perl (1.11-3) UNRELEASED; urgency=medium
+
+  * add a patch usiing random ports for the test servers
+    Closes: #723940 -- test fail when port 9050 is in use
+
+ -- Damyan Ivanov <dmn at debian.org>  Thu, 09 Jan 2014 15:54:33 +0200
+
 libgearman-client-perl (1.11-2) unstable; urgency=low
 
   * Team upload.
diff --git a/debian/patches/series b/debian/patches/series
index ce8069f..79caf13 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 fix-pod-errors.patch
 fix-server-connection-error.patch
+test-random-ports.patch
diff --git a/debian/patches/test-random-ports.patch b/debian/patches/test-random-ports.patch
new file mode 100644
index 0000000..5c0d5c4
--- /dev/null
+++ b/debian/patches/test-random-ports.patch
@@ -0,0 +1,61 @@
+Description: use random ports when starting test gearman server
+ The defailt port of 9050 may be already taken, e.g. by tor, leading to test
+ hangs.
+Author: Damyan Ivanov <dmn at debian.org>
+Bug-Debian: http://bugs.debian.org/723940
+Bug: https://rt.cpan.org/Ticket/Display.html?id=91973
+
+--- a/t/TestGearman.pm
++++ b/t/TestGearman.pm
+@@ -9,8 +9,40 @@ use POSIX qw( :sys_wait_h );
+ our $Bin;
+ use FindBin qw( $Bin );
+ 
+-# TODO: use a variation of t/lib/GearTestLib::free_port to find 3 free ports
+-use constant PORT => 9050;
++our $_PORT;
++# find a sequence of three free ports and return the first
++sub PORT() {
++    #use Carp;
++    if ($_PORT) {
++        #Carp::cluck "# returning cached port $_PORT";
++        return $_PORT;
++    }
++
++    my $port = shift;
++    my $type = shift || "tcp";
++    my $sock;
++    SEQ:
++    while (1) {
++        for my $offset ( 0..2 ) {
++            $sock = IO::Socket::INET->new(
++                LocalAddr => '127.0.0.1',
++                LocalPort => $port + $offset,
++                Proto     => $type,
++                ReuseAddr => 1
++            );
++
++            unless ($sock) {
++                $port = int(rand(20000)) + 30000;
++                next SEQ;
++            }
++
++            undef($sock);
++        }
++
++        #Carp::cluck "# PORT = $port";
++        return $_PORT = $port;
++    }
++}
+ 
+ our $NUM_SERVERS = 1;
+ 
+@@ -33,6 +65,8 @@ sub start_server {
+         $ready = 1;
+     };
+ 
++    #use Carp;
++    #Carp::cluck "# Starting test server on port $port";
+     my $pid = start_child([ $server, '-p' => $port, '-n' => $$ ]);
+     $Children{$pid} = 'S';
+     while (!$ready) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libgearman-client-perl.git



More information about the Pkg-perl-cvs-commits mailing list