Commit | Line | Data |
---|---|---|
02d1d628 AMH |
1 | #!perl -w |
2 | use strict; | |
3 | # tests Imager with every combination of options | |
51e70909 | 4 | my @opts = qw(jpeg tiff png gif ungif T1-fonts TT-fonts freetype2); |
02d1d628 AMH |
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; | |
7aa0b8d4 | 20 | my $testlog = "bigtest.txt"; |
02d1d628 | 21 | |
7aa0b8d4 | 22 | unlink $testlog; |
02d1d628 AMH |
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)); | |
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 | } | |
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"; | |
7aa0b8d4 | 68 | print "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 | ||
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 <tony@develop-help.com> | |
112 | ||
113 | =cut | |
114 |