Skip to content

Commit

Permalink
When running subprocesses in client tests, use test runner's perl and…
Browse files Browse the repository at this point in the history
… gearmand instead of environment's

git-svn-id: http://code.sixapart.com/svn/gearman/trunk@484 011c6a6d-750f-0410-a5f6-93fdcd050bc4
  • Loading branch information
athomason committed May 17, 2011
1 parent 8355b57 commit 75d9508
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions t/TestGearman.pm
Expand Up @@ -5,6 +5,7 @@ use strict;
use List::Util qw(first);;
use IO::Socket::INET;
use POSIX qw( :sys_wait_h );
use File::Basename 'dirname';

our $Bin;
use FindBin qw( $Bin );
Expand All @@ -22,6 +23,7 @@ sub start_server {
my($port) = @_;
my @loc = ("$Bin/../../../../server/gearmand", # using svn
"$Bin/../../../../../server/gearmand", # using svn and 'disttest'
dirname($^X) . '/gearmand', # local installs (e.g. perlbrew)
'/usr/bin/gearmand', # where some distros might put it
'/usr/sbin/gearmand', # where other distros might put it
);
Expand Down
2 changes: 1 addition & 1 deletion t/allinone.t
Expand Up @@ -12,7 +12,7 @@ use Gearman::Server;
use Gearman::Client::Async;

my $server = Gearman::Server->new();
$server->start_worker('t/worker.pl');
$server->start_worker(sub { exec $^X, 't/worker.pl' });

my $client = Gearman::Client::Async->new(job_servers => [ $server ]);

Expand Down
4 changes: 3 additions & 1 deletion t/lib/GearTestLib.pm
Expand Up @@ -3,6 +3,7 @@ use strict;
use IO::Socket::INET;
use Exporter 'import';
use FindBin;
use File::Basename 'dirname';
use Carp qw(croak);
use vars qw(@EXPORT);

Expand Down Expand Up @@ -33,7 +34,7 @@ sub start_child {
my $pid = fork();
die $! unless defined $pid;
unless ($pid) {
exec 'perl', '-Iblib/lib', '-Ilib', @$cmd or die $!;
exec $^X, '-Iblib/lib', '-Ilib', @$cmd or die $!;
}
$pid;
}
Expand All @@ -48,6 +49,7 @@ sub new {
my $port = GearTestLib::free_port(++$requested_port);

my @loc = ("$FindBin::Bin/../../../../server/gearmand", # using svn
dirname($^X) . '/gearmand', # local installs (e.g. perlbrew)
'/usr/bin/gearmand', # where some distros might put it
'/usr/sbin/gearmand', # where other distros might put it
);
Expand Down
4 changes: 3 additions & 1 deletion t/lib/testlib.pl
Expand Up @@ -17,6 +17,7 @@
use POSIX qw( :sys_wait_h );
use List::Util qw(first);;
use IO::Socket::INET;
use File::Basename 'dirname';

Danga::Socket->SetLoopTimeout(100);

Expand All @@ -28,6 +29,7 @@ sub start_server {
my($port) = @_;
my @loc = ("$Bin/../../../../server/gearmand", # using svn
"$Bin/../../../../../server/gearmand", # using svn, with disttest
dirname($^X) . '/gearmand', # local installs (e.g. perlbrew)
'/usr/bin/gearmand', # where some distros might put it
'/usr/sbin/gearmand', # where other distros might put it
);
Expand Down Expand Up @@ -56,7 +58,7 @@ sub start_child {
my $pid = fork();
die $! unless defined $pid;
unless ($pid) {
exec 'perl', '-Iblib/lib', '-Ilib', @$cmd or die $!;
exec $^X, '-Iblib/lib', '-Ilib', @$cmd or die $!;
}
$pid;
}
Expand Down

0 comments on commit 75d9508

Please sign in to comment.