Skip to content
Browse files

Add all_versions test as a special target.

The test target will attempt to use prove to run the tests in parallel,
falling back to make test if necessary.

Also, I added the -silent option, turned on by default, to keep quiet about
all the other work going on before the tests are run.

Finally, =perl in the command will be substituted with  the current perl
version, and =v will be substituted with the current version.
  • Loading branch information...
1 parent c4bed1b commit 162e3966ec8e4664a1b45a8766d0e0c7ad268e69 @pjcj committed Aug 11, 2010
Showing with 23 additions and 3 deletions.
  1. +23 −3 all_versions
View
26 all_versions
@@ -16,16 +16,20 @@ my $Options =
{
dry_run => 0,
ignore_failure => 0,
+ silent => 1,
version => [],
};
+my $Silent = "";
+
sub get_options
{
die "Bad option" unless
GetOptions($Options, # Store the options in the Options hash.
qw(
dry_run!
ignore_failure!
+ silent!
version=s
));
$Options->{version} =
@@ -34,15 +38,18 @@ sub get_options
5.8.0 5.8.1 5.8.2 5.8.3 5.8.4 5.8.5 5.8.6 5.8.7 5.8.8 5.8.9
5.10.0 5.10.1 5.11.0 5.12.0 5.12.1 ) ]
unless @{$Options->{version}};
+ $Silent = " >/dev/null 2>&1" if $Options->{silent};
$Options->{version} =
- [ grep eval { !system "perl$_ -v" }, @{$Options->{version}} ];
+ [ grep eval { !system "perl$_ -v$Silent" }, @{$Options->{version}} ];
+ print "Testing against: @{$Options->{version}}\n";
}
sub sys
{
- my ($command) = @_;
+ my ($command, $user) = @_;
print "$command\n";
return if $Options->{dry_run};
+ $command .= $Silent if $Options->{silent} && !$user;
my $ret = system $command;
die "command failed: $?" if $ret && !$Options->{ignore_failure};
}
@@ -53,10 +60,23 @@ my $command = "@ARGV" or die "Usage: $0 [-v version] command\n";
for my $v (@{$Options->{version}})
{
my $perl = "perl$v";
+ (my $c = $command) =~ s/=perl/$perl/g;
+ $c =~ s/=v/$v/g;
sys "rm -rf t cover_db";
sys "$perl Makefile.PL";
sys "make clean";
sys "$perl Makefile.PL";
sys "make";
- sys $command;
+ if ($c eq "test")
+ {
+ my ($dir) = grep -x "$_/$perl", split /:/, $ENV{PATH};
+ eval
+ {
+ my $l = readlink "$dir/$perl";
+ ($dir) = $l =~ m|(.*)/[^/]+|;
+ };
+ my ($prove) = grep -x, "$dir/prove", "$dir/prove$v";
+ $c = $prove ? "$prove -b -r -j6 t" : "make test";
+ }
+ sys $c, 1;
}

0 comments on commit 162e396

Please sign in to comment.
Something went wrong with that request. Please try again.