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