Skip Menu |

This queue is for tickets about the Test-Smoke CPAN distribution.

Report information
The Basics
Id: 75842
Status: resolved
Priority: 0/
Queue: Test-Smoke

People
Owner: Nobody in particular
Requestors: shay [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.46
Fixed in: 1.47



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},
On Sat Mar 17 08:11:41 2012, SHAY wrote: Show quoted text
> 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.
I choose to use abs_path(cwd()) instead of File::Spec->curdir() and wrapped the whole thing in File::Spec->canonpath(). I hope Windows is content with that solution. (I need to keep the abs_path() thing because of symlinks) Show quoted text
> 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().
Applied as is. Show quoted text
> 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.
That should have been fixed already, weird that is... Thanks for your input! Good luck, -- Abe.