diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-01-12 20:03:51 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-01-12 20:03:51 +0000 |
commit | 4a5826852ee095d233fab172b67097a331a21e42 (patch) | |
tree | 1197a71f384c6cefac3149951774a167943e17e2 /ext/Devel/PPPort/soak | |
parent | e10b8885ef748ea8a5b40bab4b29dc0de484ee94 (diff) | |
download | perl-4a5826852ee095d233fab172b67097a331a21e42.tar.gz |
Upgrade to Devel::PPPort 3.06_01
p4raw-id: //depot/perl@26809
Diffstat (limited to 'ext/Devel/PPPort/soak')
-rw-r--r-- | ext/Devel/PPPort/soak | 261 |
1 files changed, 125 insertions, 136 deletions
diff --git a/ext/Devel/PPPort/soak b/ext/Devel/PPPort/soak index 65a8fbcce8..c0b11abf01 100644 --- a/ext/Devel/PPPort/soak +++ b/ext/Devel/PPPort/soak @@ -1,15 +1,15 @@ #!/usr/bin/perl -w ################################################################################ # -# soak -- Test Devel::PPPort with multiple versions of Perl. +# soak -- Test Perl modules with multiple Perl releases. # # Original Author: Paul Marquess # ################################################################################ # -# $Revision: 7 $ +# $Revision: 8 $ # $Author: mhx $ -# $Date: 2005/01/31 08:10:55 +0100 $ +# $Date: 2005/02/27 21:16:42 +0100 $ # ################################################################################ # @@ -28,151 +28,123 @@ use strict; use warnings; use ExtUtils::MakeMaker; use Getopt::Long; +use Pod::Usage; +use List::Util qw(max); +use Config; -my $VERSION = "1.000"; +my $VERSION = do { my @r = '$Snapshot: /Devel-PPPort/3.06_01 $' =~ /(\d+\.\d+(?:_\d+)?)/; @r ? $r[0] : '9.99' }; -$| = 1 ; -my $verbose = 0 ; +$| = 1; +my $verbose = 0; +my $MAKE = $Config{make} || 'make'; +my %OPT = ( + verbose => 0, + make => $Config{make} || 'make', +); -# TODO -- determine what "make" program to run. -my $MAKE = 'make'; +GetOptions(\%OPT, qw(verbose make=s mmargs=s@)) or pod2usage(2); -my $result = GetOptions( - "verbose" => \$verbose, - "make=s" => \$MAKE, - ) or Usage(); +$OPT{mmargs} = [''] unless exists $OPT{mmargs}; -my @GoodPerls = (); - -if (@ARGV) - { @GoodPerls = @ARGV } -else - { @GoodPerls = FindPerls() } - -my $maxlen = 0; -foreach (@GoodPerls) { - $maxlen = length $_ - if length $_ > $maxlen ; -} -$maxlen += 3 ; +my @GoodPerls = @ARGV ? @ARGV : FindPerls(); +my $maxlen = max(map length, @GoodPerls) + 3; +my $mmalen = max(map length, @{$OPT{mmargs}}); +$maxlen += $mmalen+3 if $mmalen > 0; # run each through the test harness - -my $bad = 0 ; -my $good = 0 ; -my $total = 0 ; +my(@good, @bad, $total); # prime the pump, so the first "make realclean" will work. -runit("perl Makefile.PL") || die "Cannot run perl Makefile.PL\n" ; +runit("$^X Makefile.PL") && runit("$MAKE realclean") + or die "Cannot run $^X Makefile.PL && $MAKE realclean\n"; -foreach my $perl (@GoodPerls) -{ - my $prefix = $verbose ? "$perl -- " : ''; - print "Testing $perl " . ('.' x ($maxlen - length $perl)) ; +for my $perl (@GoodPerls) { + for my $mm (@{$OPT{mmargs}}) { + my $config = $mm =~ /\S+/ ? " ($mm)" : ''; + my $prefix = $verbose ? "$perl$config -- " : ''; + print "Testing $perl$config " . ('.' x ($maxlen - length($perl.$config))); - my $ok = runit("$MAKE realclean") && - runit("$perl Makefile.PL") && - # runit("$perl Makefile.PL --with-apicheck") && - runit("$MAKE test"); + my $ok = runit("$perl Makefile.PL $mm") && + # runit("$perl Makefile.PL --with-apicheck") && + runit("$MAKE test"); - ++ $total; + $total++; if ($ok) { - ++ $good ; - print "${prefix}ok\n"; + push @good, [$perl, $mm]; + print "${prefix}ok\n"; } else { - ++ $bad ; - print "${prefix}not ok\n" ; + push @bad, [$perl, $mm]; + print "${prefix}not ok\n"; } + runit("$MAKE realclean"); + } } -print "\n\nPassed with $good of $total versions of Perl.\n\n"; -exit $bad ; - +if ($verbose && @bad) { + print "\nFailed with:\n", map " $_\n", @bad; +} +print "\nPassed with ", scalar @good, " of $total versions/configurations.\n\n"; +exit scalar @bad; sub runit { - # TODO -- portability alert!! - - my $cmd = shift ; - print "\n Running [$cmd]\n" if $verbose ; - my $output = `$cmd 2>&1` ; - $output = "\n" unless defined $output; - $output =~ s/^/ /gm; - print "\n Output\n$output\n" if $verbose || $? ; - if ($?) - { - warn " Running '$cmd' failed: $?\n" ; - return 0 ; - } - return 1 ; -} - -sub Usage -{ - die <<EOM; - -usage: soak [OPT] [perl...] - - OPT - -m make - the name of the make program. Default "make" - -v - verbose - -EOM - + # TODO -- portability alert!! + + my $cmd = shift; + print "\n Running [$cmd]\n" if $verbose; + my $output = `$cmd 2>&1`; + $output = "\n" unless defined $output; + $output =~ s/^/ /gm; + print "\n Output\n$output\n" if $verbose || $?; + if ($?) { + warn " Running '$cmd' failed: $?\n"; + return 0; + } + return 1; } sub FindPerls { - # TODO -- need to decide how far back we go. - # TODO -- get list of user releases prior to 5.004 - - # find all version of Perl that are available - my @PerlBinaries = qw( - 5.000 - 5.001 - 5.002 - 5.003 - 5.004 - 5.00401 - 5.00402 - 5.00403 - 5.00404 - 5.00405 - 5.005 - 5.00501 - 5.00502 - 5.00503 - 5.6.0 - 5.6.1 - 5.7.0 - 5.7.1 - 5.7.2 - ); - - print "Searching for Perl binaries...\n" ; - my @GoodPerls = (); - my $maxlen = 0; - my $mm = MM->new( { NAME => 'dummy' }); - my @path = $mm->path(); - - # find_perl will send a warning to STDOUT if it can't find - # the requested perl, so need to temporarily silence STDOUT. - tie(*STDOUT, 'NoSTDOUT'); - - foreach my $perl (@PerlBinaries) { - if (my $abs = $mm->find_perl($perl, ["perl$perl"], [@path], 0)) { - push @GoodPerls, $abs ; - } + # TODO -- need to decide how far back we go. + # TODO -- get list of user releases prior to 5.004 + # TODO -- does not work on Windows (at least) + + # find versions of Perl that are available + my @PerlBinaries = qw( + 5.000 + 5.001 + 5.002 + 5.003 + 5.004 5.00401 5.00402 5.00403 5.00404 5.00405 + 5.005 5.00501 5.00502 5.00503 5.00504 + 5.6.0 5.6.1 5.6.2 + 5.7.0 5.7.1 5.7.2 5.7.3 + 5.8.0 5.8.1 5.8.2 5.8.3 5.8.4 5.8.5 5.8.6 + 5.9.0 5.9.1 + ); + + print "Searching for Perl binaries...\n"; + my $mm = MM->new( { NAME => 'dummy' }); + my @path = $mm->path; + my @GoodPerls; + + # find_perl will send a warning to STDOUT if it can't find + # the requested perl, so need to temporarily silence STDOUT. + tie *STDOUT, 'NoSTDOUT'; + + for my $perl (@PerlBinaries) { + if (my $abs = $mm->find_perl($perl, ["perl$perl"], \@path, 0)) { + push @GoodPerls, $abs; } - untie *STDOUT; - - print "\n\nFound\n"; - foreach (@GoodPerls) { print " $_\n" } - print "\n\n"; + } + + untie *STDOUT; - return @GoodPerls; + print "\nFound:\n", (map " $_\n", @GoodPerls), "\n"; + + return @GoodPerls; } package NoSTDOUT; @@ -180,21 +152,38 @@ package NoSTDOUT; use Tie::Handle; our @ISA = qw(Tie::Handle); -sub TIEHANDLE -{ - my ($class) = @_; - my $buf = ""; - bless \$buf, $class; -} - -sub PRINT -{ - my $self = shift; -} - -sub WRITE -{ - my $self = shift; -} +sub TIEHANDLE { bless \(my $s = ''), shift } +sub PRINT {} +sub WRITE {} + +__END__ + +=head1 NAME + +soak - Test Perl modules with multiple Perl releases + +=head1 SYNOPSIS + + soak [options] [perl ...] + + --make=program override name of make program ($Config{make}) + --mmargs=options pass options to Makefile.PL (multiple --mmargs possible) + --verbose be verbose + +=head1 COPYRIGHT + +Version 3.x, Copyright (c) 2004-2005, Marcus Holland-Moritz. + +Version 2.x, Copyright (C) 2001, Paul Marquess. + +Version 1.x, Copyright (C) 1999, Kenneth Albanowski. + +This program is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=head1 SEE ALSO + +See L<Devel::PPPort>. +=cut |