Subject: | [PATCH] Fix new syncer_rsync.t test failures |
The changes made to t/syncer_rsync.t in 1.46 break the tests on Windows.
Firstly, the use of abs_path() on 'perl-current' in %df_rsync causes the
complaint "perl-current: No such file or directory" because the folder
doesn't actually exist within the current working directory and
abs_path() (unlike rel2abs()) does filesystem checks, so the patch
simply reverts that change.
Secondly, the other two changes to use abs_path() cause failures like
got "C:\Dev\Smoke\Test-Smoke-1.46" when expected
"C:/Dev/Smoke/Test-Smoke-1.46" because abs_path() doesn't canonicalize
its return value (i.e. it returns forward slashes rather than the
Windows-style backslashes), so the patch applies canonpath() to the
values returned by abs_path().
The patch also fixes the warning "Use of uninitialized value in lc"
emanating from Test::Smoke::Syncer::new() when no sync type has been
specified.
Subject: | syncer_rsync.patch |
diff -ruN Test-Smoke-1.46.orig\lib\Test\Smoke\Syncer.pm Test-Smoke-1.46\lib\Test\Smoke\Syncer.pm
--- Test-Smoke-1.46.orig\lib\Test\Smoke\Syncer.pm Thu Nov 04 18:07:10 2010
+++ Test-Smoke-1.46\lib\Test\Smoke\Syncer.pm Sat Mar 17 12:00:30 2012
@@ -154,7 +154,7 @@
my $proto = shift;
my $class = ref $proto ? ref $proto : $proto;
- my $sync_type = lc shift || $CONFIG{df_sync};
+ my $sync_type = lc(shift || $CONFIG{df_sync});
unless ( exists $CONFIG{valid_type}->{$sync_type} ) {
require Carp;
diff -ruN Test-Smoke-1.46.orig\t\syncer_rsync.t Test-Smoke-1.46\t\syncer_rsync.t
--- Test-Smoke-1.46.orig\t\syncer_rsync.t Tue Nov 15 10:39:58 2011
+++ Test-Smoke-1.46\t\syncer_rsync.t Sat Mar 17 11:58:26 2012
@@ -5,6 +5,7 @@
use Data::Dumper;
use Cwd;
+use File::Spec;
use Test::More tests => 33;
use_ok( 'Test::Smoke::Syncer' );
@@ -13,7 +14,7 @@
rsync => 'rsync',
source => 'public.activestate.com::perl-current',
opts => '-az --delete',
- ddir => Cwd::abs_path('perl-current'),
+ ddir => File::Spec->rel2abs( 'perl-current', File::Spec->curdir ),
);
{
@@ -29,7 +30,7 @@
{
my %rsync = %df_rsync;
$rsync{source} = 'ftp.linux.ActiveState.com::perl-current';
- $rsync{ddir} = Cwd::abs_path(cwd());
+ $rsync{ddir} = File::Spec->canonpath(Cwd::abs_path(cwd()));
my $sync = eval {
Test::Smoke::Syncer->new( 'rsync',
source => $rsync{source},
@@ -49,7 +50,7 @@
{
my %rsync = %df_rsync;
$rsync{source} = 'ftp.linux.ActiveState.com::perl-current';
- $rsync{ddir} = Cwd::abs_path(cwd());
+ $rsync{ddir} = File::Spec->canonpath(Cwd::abs_path(cwd()));
my $sync = eval {
Test::Smoke::Syncer->new( rsync => {
source => $rsync{source},