| 1 |
#!perl -w |
| 2 |
use strict; |
| 3 |
# tests Imager with every combination of options |
| 4 |
my @opts = qw(jpeg tiff png gif ungif T1-fonts TT-fonts freetype2); |
| 5 |
|
| 6 |
# each option gets a bit |
| 7 |
my %bits; |
| 8 |
@bits{@opts} = map { 1 << $_ } 0..(@opts-1); |
| 9 |
|
| 10 |
my $perl = $ENV{PERLBIN} || "perl"; |
| 11 |
my $make = $ENV{MAKEBIN} || "make"; |
| 12 |
my $makeopts = $ENV{MAKEOPTS} || ''; |
| 13 |
use Getopt::Std; |
| 14 |
my %opts; |
| 15 |
getopts('vd', \%opts); |
| 16 |
|
| 17 |
my $top = (1 << @opts)-1; |
| 18 |
|
| 19 |
my @results; |
| 20 |
my $testlog = "bigtest.txt"; |
| 21 |
|
| 22 |
unlink $testlog; |
| 23 |
my $total = 0; |
| 24 |
my $good = 0; |
| 25 |
system("$make clean") if -e 'Makefile' && !$opts{d}; |
| 26 |
for my $set (0..$top) { |
| 27 |
++$total; |
| 28 |
$ENV{IM_ENABLE} = join(' ', grep($set & $bits{$_}, @opts)); |
| 29 |
print STDERR $opts{v} ? "$set/$top Enable: $ENV{IM_ENABLE}\n" : '.'; |
| 30 |
system("echo '****' \$IM_ENABLE >>$testlog"); |
| 31 |
if ($opts{d}) { |
| 32 |
if (system("$make $makeopts disttest >>$testlog.txt 2>&1")) { |
| 33 |
push(@results, [ $ENV{IM_ENABLE}, 'disttest failed' ]); |
| 34 |
next; |
| 35 |
} |
| 36 |
} |
| 37 |
else { |
| 38 |
unlink 'Makefile'; |
| 39 |
if (system("$perl Makefile.PL >>$testlog 2>&1")) { |
| 40 |
push(@results, [ $ENV{IM_ENABLE}, 'Makefile.PL failed' ]); |
| 41 |
next; |
| 42 |
} |
| 43 |
if (system("$make $makeopts >>$testlog 2>&1")) { |
| 44 |
push(@results, [ $ENV{IM_ENABLE}, 'make failed' ]); |
| 45 |
next; |
| 46 |
} |
| 47 |
if (system("$make test >>$testlog 2>&1")) { |
| 48 |
push(@results, [ $ENV{IM_ENABLE}, 'test failed' ]); |
| 49 |
next; |
| 50 |
} |
| 51 |
if (system("$make clean >>$testlog 2>&1")) { |
| 52 |
push(@results, [ $ENV{IM_ENABLE}, 'clean failed' ]); |
| 53 |
next; |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
push(@results, [ $ENV{IM_ENABLE}, 'success' ]); |
| 58 |
++$good; |
| 59 |
} |
| 60 |
print STDERR "\n"; |
| 61 |
printf("%-20s %-50s\n", "Result", "Options"); |
| 62 |
printf("%-20s %-50s\n", "-" x 20, "-" x 50); |
| 63 |
foreach my $row (@results) { |
| 64 |
printf("%-20s %-50s\n", @$row[1,0]); |
| 65 |
} |
| 66 |
print "-" x 71, "\n"; |
| 67 |
print "Total: $total Successes: $good Failures: ",$total-$good,"\n"; |
| 68 |
print "Output in $testlog\n"; |
| 69 |
|
| 70 |
__END__ |
| 71 |
|
| 72 |
=head1 NAME |
| 73 |
|
| 74 |
bigtest.perl - tests combinations of libraries usable by Imager |
| 75 |
|
| 76 |
=head1 SYNOPSYS |
| 77 |
|
| 78 |
perl bigtest.perl |
| 79 |
# grab a cup of coffee or four - this takes a while |
| 80 |
|
| 81 |
=head1 DESCRIPTION |
| 82 |
|
| 83 |
bigtest.perl uses the new IM_ENABLE environment variable of |
| 84 |
Makefile.PL to built Imager for all possible combinations of libraries |
| 85 |
that Imager uses. |
| 86 |
|
| 87 |
At the time of writing this is 128 combinations, which takes quite a |
| 88 |
while. |
| 89 |
|
| 90 |
=head1 OPTIONS |
| 91 |
|
| 92 |
-v - verbose output |
| 93 |
|
| 94 |
-d - perform disttest for each combination |
| 95 |
|
| 96 |
=head1 ENVIRONMENT VARIABLES |
| 97 |
|
| 98 |
PERLBIN - the perl binary to use |
| 99 |
|
| 100 |
MAKEBIN - the make binary to use |
| 101 |
|
| 102 |
Any other variables used by Imager's Makefile.PL, except for IM_MANUAL |
| 103 |
or IM_ENABLE. |
| 104 |
|
| 105 |
=head1 BUGS |
| 106 |
|
| 107 |
Doesn't test other possible options, like IM_NOLOG or IM_DEBUG_MALLOC. |
| 108 |
|
| 109 |
=head1 AUTHOR |
| 110 |
|
| 111 |
Tony Cook <[email protected]> |
| 112 |
|
| 113 |
=cut |
| 114 |
|