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