Subject: | The 0.44 test suite fails when spaces are in the build path on Win32 |
The test suite uses naive quoting tricks to cope with spaces in directories, but Win32 does not use the backslash as a quoting character for path names ;-)
Thus the test suite fails every test with 200% :-)
The fix is to properly quote the paths, a diff against the current Devel/Cover/Test.pm :
C:\Dokumente und Einstellungen\Max\.cpan\build\Devel-Cover-0.44>diff lib/Devel/Cover/Test.pm lib/Devel/Cover/Test.pm.patched
46a47,62
Show quoted text
> sub shell_quote {
> my ($self,@items) = @_;
>
> for (@items) {
> # properly quote the item
> if ($^O =~ /win32/i) {
> $_ = qq{"$_"}
> if / /;
> } else {
> s/ /\\ /g;
> };
> };
>
> wantarray ? @items : $items[0];
> };
>
76,77c92,93
< $perl =~ s/ /\\ /g;
< $base =~ s/ /\\ /g;
---
Show quoted text> $perl = $self->shell_quote($perl);
> #$base = $self->shell_quote($base);
79c95,96
< $perl .= " -I$base/$_" for "", "blib/lib", "blib/arch";
---
Show quoted text> $perl .= (" " . $self->shell_quote( "-I$base/$_" ))
> for ("", "blib/lib", "blib/arch");
94,95c111
< my $t = $self->test_file;
< $t =~ s/ /\\ /g;
---
Show quoted text> my $t = $self->shell_quote( $self->test_file );
106c122
< $b =~ s/ /\\ /g;
---
Show quoted text> $b = $self->shell_quote( $b );
158c174
< close T or die "Cannot close $command: $!";
---
Show quoted text> close T or warn "Cannot close $command: $!";
With those patches, the build works 100%
Thanks for getting Devel::Cover to work on Win32 !
-max
Patch created by diff is attached
*** lib/Devel/Cover/Test.pm Tue May 18 01:31:08 2004
--- lib/Devel/Cover/Test.pm.patched Tue May 18 19:03:08 2004
***************
*** 44,49 ****
--- 44,65 ----
$self->get_params
}
+ sub shell_quote {
+ my ($self,@items) = @_;
+
+ for (@items) {
+ # properly quote the item
+ if ($^O =~ /win32/i) {
+ $_ = qq{"$_"}
+ if / /;
+ } else {
+ s/ /\\ /g;
+ };
+ };
+
+ wantarray ? @items : $items[0];
+ };
+
sub get_params
{
my $self = shift;
***************
*** 73,82 ****
my $perl = $Devel::Cover::Inc::Perl;
my $base = $Devel::Cover::Inc::Base;
! $perl =~ s/ /\\ /g;
! $base =~ s/ /\\ /g;
! $perl .= " -I$base/$_" for "", "blib/lib", "blib/arch";
$perl
}
--- 89,99 ----
my $perl = $Devel::Cover::Inc::Perl;
my $base = $Devel::Cover::Inc::Base;
! $perl = $self->shell_quote($perl);
! #$base = $self->shell_quote($base);
! $perl .= (" " . $self->shell_quote( "-I$base/$_" ))
! for ("", "blib/lib", "blib/arch");
$perl
}
***************
*** 91,98 ****
$c .= " -MDevel::Cover=" .
join(",", split ' ', $self->{test_parameters})
}
! my $t = $self->test_file;
! $t =~ s/ /\\ /g;
$c .= " $t";
$c
--- 108,114 ----
$c .= " -MDevel::Cover=" .
join(",", split ' ', $self->{test_parameters})
}
! my $t = $self->shell_quote( $self->test_file );
$c .= " $t";
$c
***************
*** 103,109 ****
my $self = shift;
my $b = $Devel::Cover::Inc::Base;
! $b =~ s/ /\\ /g;
$self->perl . " $b/cover $self->{cover_parameters}"
}
--- 119,125 ----
my $self = shift;
my $b = $Devel::Cover::Inc::Base;
! $b = $self->shell_quote( $b );
$self->perl . " $b/cover $self->{cover_parameters}"
}
***************
*** 155,161 ****
{
print if $debug;
}
! close T or die "Cannot close $command: $!";
}
sub run_test
--- 171,177 ----
{
print if $debug;
}
! close T or warn "Cannot close $command: $!";
}
sub run_test