Subject: | Testing on Windows Platform |
Could not run tests in Windows to completion ... debugged the test via
command line and fixed what I could. Of course then my security would
not run properly because I changed distribution files.
However, it would be nice if you didn't require diff, and GnuPG, or give
some documentation on where to find them -- on the other hand, a
signature is great.
I'm surprised this is Titanium and alpha so I tried to make sure it was
testable on Windows. We need Titanium badly to be consistent across
platforms.
Issues: file tainting on Windows differs ... added untaint list -- may
not be the list you want ... or the regular expression you want but it
does pass the test.
Could not get the Environment variable to run properly, must be a
windows shell thing. So I deleted it and it seemed to run fine.
Maybe it would be better to find a windows shell fix.
Also perl requires a -Iblib/lib and -Iblib/arch for the tests to
find the modules installed for testing. The perl test harness
does it correctly but when perl is put back on the command line
it leaves this off. I'm surprised unix would not need the same.
Added two files for module-install.t t/pod.t and t/pod-coverage.t
I would suggest a Windows OS check to place the untaint properly
in the windows environment.
If you would like a sample of that let me know, thanks for some
excellent work here ... David Scott
Subject: | extutils-makemaker.t |
#!perl -T
#
# $Id$
#
use warnings;
use strict;
use Cwd qw(cwd);
use English qw( -no_match_vars );
use File::Find qw();
use File::Path qw( rmtree );
use Test::More;
$ENV{PATH} = undef;
my $dir = untaint_path( cwd . '/t', '$dir' );
my $perl = untaint_path( $EXECUTABLE_NAME, '$perl' );
qx{ MODULE_STARTER_DIR=$dir $perl ./script/cgiapp-starter --module=Foo --author="Jaldhar H. Vyas" --email=jaldhar\@braincells.com --dir="$dir/Foo" --eumm };
my $text = qx{ $perl -Iblib/lib -Iblib/arch ./script/cgiapp-starter --module=Foo --author="Jaldhar H. Vyas" --email=jaldhar\@braincells.com --dir="$dir/Foo" --eumm };
my @expected_files = (
'Foo/lib/Foo.pm', 'Foo/lib/Foo/templates/runmode1.html',
'Foo/t/pod-coverage.t', 'Foo/t/pod.t',
'Foo/t/test-app.t', 'Foo/t/01-load.t',
'Foo/t/perl-critic.t', 'Foo/t/boilerplate.t',
'Foo/t/00-signature.t', 'Foo/t/perlcriticrc',
'Foo/Makefile.PL', 'Foo/Changes',
'Foo/README', 'Foo/MANIFEST.SKIP',
'Foo/MANIFEST', 'Foo/server.pl',
);
my %got_files;
foreach my $file (@expected_files) {
$got_files{$file} = -1;
}
File::Find::find(
{ untaint => 1,
untaint_pattern => qr|^([-\\:+@\w./]+)$|,
wanted => sub {
if ( -f $File::Find::name ) {
my $name = $File::Find::name;
$name =~ s{^$dir/}{}msx;
$got_files{$name} = grep { $_ eq $name } @expected_files;
}
return;
}
},
"$dir/Foo"
);
plan tests => ( scalar keys %got_files ) * 2;
foreach my $file ( keys %got_files ) {
ok( $got_files{$file} > -1, "Missing file $file" );
}
foreach my $file ( keys %got_files ) {
ok( $got_files{$file}, "Extra file $file" );
}
sub untaint_path {
my ( $path, $description ) = @_;
if ( !( $path =~ m{ (\A[-\\:+@\w./]+\z) }msx ) ) {
die "$description is tainted.\n";
}
return $1;
}
END {
if ( -d "$dir/Foo" ) {
rmtree "$dir/Foo" || die "$OS_ERROR\n";
}
}
Subject: | module-install.t |
#!perl -T
#
# $Id$
#
use warnings;
use strict;
use Cwd qw(cwd);
use English qw( -no_match_vars );
use File::Find qw();
use File::Path qw( rmtree );
use Test::More;
$ENV{PATH} = undef;
my $dir = untaint_path( cwd . '/t', '$dir' );
my $perl = untaint_path( $EXECUTABLE_NAME, '$perl' );
my $text = qx{ $perl -Iblib/lib -Iblib/arch ./script/cgiapp-starter --module=Foo --author="Jaldhar H. Vyas" --email=jaldhar\@braincells.com --dir="$dir/Foo" --mi };
# qx{ MODULE_STARTER_DIR=$dir $perl -Iblib/lib -Iblib/arch ./script/cgiapp-starter --module=Foo --author="Jaldhar H. Vyas" --email=jaldhar\@braincells.com --dir="$dir/Foo" --mi };
my $root_foo = untaint_path( "$dir/Foo", '$root_foo');
my @expected_files = (
'Foo/lib/Foo.pm', 'Foo/lib/Foo/templates/runmode1.html',
'Foo/t/test-app.t', 'Foo/t/01-load.t',
'Foo/t/perl-critic.t', 'Foo/t/boilerplate.t',
'Foo/t/00-signature.t', 'Foo/t/perlcriticrc',
'Foo/t/pod.t', 'Foo/t/pod-coverage.t',
'Foo/Makefile.PL', 'Foo/Changes',
'Foo/README', 'Foo/MANIFEST.SKIP',
'Foo/MANIFEST', 'Foo/server.pl',
);
my %got_files;
foreach my $file (@expected_files) {
$got_files{$file} = -1;
}
File::Find::find(
{ untaint => 1,
untaint_pattern => qr|^([-\\:+@\w./]+)$|,
wanted => sub {
if ( -f $File::Find::name ) {
my $name = $File::Find::name;
$name =~ s{^$dir/}{}msx;
$got_files{$name} = grep { $_ eq $name } @expected_files;
}
return;
}
},
"$root_foo"
);
plan tests => ( scalar keys %got_files ) * 2;
foreach my $file ( keys %got_files ) {
ok( $got_files{$file} > -1, "Missing file $file" );
}
foreach my $file ( keys %got_files ) {
ok( $got_files{$file}, "Extra file $file" );
}
sub untaint_path {
my ( $path, $description ) = @_;
if ( !( $path =~ m{ (\A[-\\:+@\w./]+\z) }msx ) ) {
die "$description is tainted.\n";
}
return $1;
}
END {
if ( -d "$dir/Foo" ) {
rmtree "$dir/Foo" || die "$OS_ERROR\n";
}
}
Subject: | module-build.t |
#!perl -T
#
# $Id$
#
use warnings;
use strict;
use Cwd qw(cwd);
use English qw( -no_match_vars );
use File::Find qw();
use File::Path qw( rmtree );
use Test::More;
$ENV{PATH} = undef;
my $dir = untaint_path( cwd . '/t', '$dir' );
my $perl = untaint_path( $EXECUTABLE_NAME, '$perl' );
# qx{ MODULE_STARTER_DIR=$dir $perl ./script/cgiapp-starter --module=Foo --author="Jaldhar H. Vyas" --email=jaldhar\@braincells.com --dir="$dir/Foo" --mb };
my $text = qx{ $perl -Iblib/lib -Iblib/arch ./script/cgiapp-starter --module=Foo --author="Jaldhar H. Vyas" --email=jaldhar\@braincells.com --dir="$dir/Foo" --mb };
my @expected_files = (
'Foo/lib/Foo.pm', 'Foo/lib/Foo/templates/runmode1.html',
'Foo/t/pod-coverage.t', 'Foo/t/pod.t',
'Foo/t/test-app.t', 'Foo/t/01-load.t',
'Foo/t/perl-critic.t', 'Foo/t/boilerplate.t',
'Foo/t/00-signature.t', 'Foo/t/perlcriticrc',
'Foo/Build.PL', 'Foo/Changes',
'Foo/README', 'Foo/MANIFEST.SKIP',
'Foo/MANIFEST', 'Foo/server.pl',
);
my %got_files;
foreach my $file (@expected_files) {
$got_files{$file} = -1;
}
File::Find::find(
{ untaint => 1,
untaint_pattern => qr|^([-\\:+@\w./]+)$|,
wanted => sub {
if ( -f $File::Find::name ) {
my $name = $File::Find::name;
$name =~ s{^$dir/}{}msx;
$got_files{$name} = grep { $_ eq $name } @expected_files;
}
return;
}
},
"$dir/Foo"
);
plan tests => ( scalar keys %got_files ) * 2;
foreach my $file ( keys %got_files ) {
ok( $got_files{$file} > -1, "Missing file $file" );
}
foreach my $file ( keys %got_files ) {
ok( $got_files{$file}, "Extra file $file" );
}
sub untaint_path {
my ( $path, $description ) = @_;
if ( !( $path =~ m{ (\A[-\\:+@\w./]+\z) }msx ) ) {
die "$description is tainted.\n";
}
return $1;
}
END {
if ( -d "$dir/Foo" ) {
rmtree "$dir/Foo" || die "$OS_ERROR\n";
}
}