[Bps-public-commit] TAP-Harness-Remote branch, master, updated. 1bbff13f756cc8ef81dd17f8dd5492dfd901aef1
clkao at bestpractical.com
clkao at bestpractical.com
Fri Jan 15 04:54:09 EST 2010
The branch, master has been updated
via 1bbff13f756cc8ef81dd17f8dd5492dfd901aef1 (commit)
via aa37e03b49d8df87a67cd04c146e240b6ba5d4b2 (commit)
via f116436ad9eb1c0e1df4feff04a5e7219d3f1b06 (commit)
from 9835fefd7f2e607df7cc68c999c58ea4369e05b0 (commit)
Summary of changes:
lib/TAP/Harness/Remote.pm | 68 +++++++++++++++++++++++++--------------------
1 files changed, 38 insertions(+), 30 deletions(-)
- Log -----------------------------------------------------------------
commit f116436ad9eb1c0e1df4feff04a5e7219d3f1b06
Author: Chia-liang Kao <clkao at clkao.org>
Date: Fri Jan 15 17:35:12 2010 +0800
Use the exec generic TAP::Source rather than Perl source which turns -I switches into PERL5LIB too late for us.
diff --git a/lib/TAP/Harness/Remote.pm b/lib/TAP/Harness/Remote.pm
index 80cdbf8..e503dc2 100644
--- a/lib/TAP/Harness/Remote.pm
+++ b/lib/TAP/Harness/Remote.pm
@@ -118,15 +118,28 @@ sub new {
unless -e $self->remote_config("ssh")
and -x $self->remote_config("ssh");
- $ENV{HARNESS_PERL} = $self->remote_config("ssh");
+ $self->exec( \&_get_cmd );
$self->jobs( $self->jobs * @{ $self->remote_config("host") } );
$self->callback( before_runtests => sub { $self->setup(@_) } );
- $self->callback( parser_args => sub { $self->change_switches(@_) } );
+
return $self;
}
+sub _get_cmd {
+ my $self = shift;
+ my @switches;
+ @switches = $self->lib if $self->lib;
+ push @switches => $self->switches if $self->switches;
+ my %args;
+ $args{switches} = \@switches;
+ $self->change_switches(\%args);
+
+ return [ $self->remote_config("ssh"), @{ $args{switches} }, @_ ];
+
+}
+
=head2 config_path
Returns the path to the configuration file; this is usually
commit aa37e03b49d8df87a67cd04c146e240b6ba5d4b2
Author: Chia-liang Kao <clkao at clkao.org>
Date: Fri Jan 15 17:42:27 2010 +0800
Merge change_switches into _get_cmd.
diff --git a/lib/TAP/Harness/Remote.pm b/lib/TAP/Harness/Remote.pm
index e503dc2..c56923a 100644
--- a/lib/TAP/Harness/Remote.pm
+++ b/lib/TAP/Harness/Remote.pm
@@ -128,16 +128,27 @@ sub new {
}
sub _get_cmd {
- my $self = shift;
+ my ($self, $test_file) = @_;
my @switches;
@switches = $self->lib if $self->lib;
push @switches => $self->switches if $self->switches;
- my %args;
- $args{switches} = \@switches;
- $self->change_switches(\%args);
- return [ $self->remote_config("ssh"), @{ $args{switches} }, @_ ];
+ my @other = grep { not /^-I/ } @switches;
+ my @inc = map {"-I$_"} grep {defined $_} map { s/^-I//; $self->rewrite_path($_) }
+ grep {/^-I/} @switches;
+
+ my $host = $self->remote_config("host")
+ ->[ $self->{hostno}++ % @{ $self->remote_config("host") } ];
+ my $userhost = $self->userhost($host);
+ return [ $self->remote_config("ssh"),
+ @{ $self->remote_config("ssh_args") }, $userhost,
+ "cd", $self->rewrite_path( Cwd::cwd ),
+ "&&", "PERL5LIB='@{[$self->{perl5lib}]}'",
+ @{$self->{env}},
+ $self->remote_config("perl"), @other,
+ @inc, $test_file,
+ ];
}
=head2 config_path
@@ -366,34 +377,6 @@ sub DESTROY {
}
}
-=head2 change_switches
-
-Changes the switches around, such that the remote perl is called, via
-ssh. This code is called once per test file.
-
-=cut
-
-sub change_switches {
- my ( $self, $args, $test ) = @_;
-
- my $remote = $self->remote_config("root");
-
- my @other = grep { not /^-I/ } @{ $args->{switches} };
- my @inc = map {"-I$_"} grep {defined $_} map { s/^-I//; $self->rewrite_path($_) }
- grep {/^-I/} @{ $args->{switches} };
-
- my $host = $self->remote_config("host")
- ->[ $self->{hostno}++ % @{ $self->remote_config("host") } ];
- my $userhost = $self->userhost($host);
- $args->{switches} = [
- @{ $self->remote_config("ssh_args") }, $userhost,
- "cd", $self->rewrite_path( Cwd::cwd ),
- "&&", "PERL5LIB='@{[$self->{perl5lib}]}'",
- @{$self->{env}},
- $self->remote_config("perl"), @other,
- @inc
- ];
-}
=head1 CONFIGURATION AND ENVIRONMENT
commit 1bbff13f756cc8ef81dd17f8dd5492dfd901aef1
Author: Chia-liang Kao <clkao at clkao.org>
Date: Fri Jan 15 17:53:37 2010 +0800
env_foward config item.
diff --git a/lib/TAP/Harness/Remote.pm b/lib/TAP/Harness/Remote.pm
index c56923a..57399a6 100644
--- a/lib/TAP/Harness/Remote.pm
+++ b/lib/TAP/Harness/Remote.pm
@@ -314,6 +314,13 @@ sub setup {
$val =~ s/'/'"'"'/g;
push @{$self->{env}}, "$k='$val'";
}
+ # env_forward to pass through from %ENV
+ for my $regex (@{$self->remote_config("env_forward")}) {
+ for (keys %ENV) {
+ push @{$self->{env}}, "$_='$ENV{$_}'"
+ if m/$regex/;
+ }
+ }
}
=head2 rsync
@@ -439,6 +446,11 @@ creating new F<.remote_test> files. See L<rsync(1)> for more details.
A hash reference of environment variable names and values, to be
used on the remote host.
+=item env_forward
+
+An array reference of regex, local envionrment variables matching them
+will be used on the remote host.
+
=back
=head1 DEPENDENCIES
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list