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; | |
20 | ||
21 | unlink('testout/bigtest.txt'); | |
22 | my $total = 0; | |
23 | my $good = 0; | |
24 | system("$make clean") if -e 'Makefile' && !$opts{d}; | |
25 | for my $set (0..$top) { | |
26 | ++$total; | |
27 | $ENV{IM_ENABLE} = join(' ', grep($set & $bits{$_}, @opts)); | |
3799c4d1 | 28 | print STDERR $opts{v} ? "$set/$top Enable: $ENV{IM_ENABLE}\n" : '.'; |
02d1d628 AMH |
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 | } | |
59 | print STDERR "\n"; | |
60 | printf("%-20s %-50s\n", "Result", "Options"); | |
61 | printf("%-20s %-50s\n", "-" x 20, "-" x 50); | |
62 | foreach my $row (@results) { | |
63 | printf("%-20s %-50s\n", @$row[1,0]); | |
64 | } | |
65 | print "-" x 71, "\n"; | |
66 | print "Total: $total Successes: $good Failures: ",$total-$good,"\n"; | |
67 | print "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 | ||
82 | bigtest.perl uses the new IM_ENABLE environment variable of | |
83 | Makefile.PL to built Imager for all possible combinations of libraries | |
84 | that Imager uses. | |
85 | ||
86 | At the time of writing this is 128 combinations, which takes quite a | |
87 | while. | |
88 | ||
89 | =head1 OPTIONS | |
90 | ||
91 | -v - verbose output | |
92 | ||
93 | -d - perform disttest for each combination | |
94 | ||
95 | =head1 ENVIRONMENT VARIABLES | |
96 | ||
97 | PERLBIN - the perl binary to use | |
98 | ||
99 | MAKEBIN - the make binary to use | |
100 | ||
101 | Any other variables used by Imager's Makefile.PL, except for IM_MANUAL | |
102 | or IM_ENABLE. | |
103 | ||
104 | =head1 BUGS | |
105 | ||
106 | Doesn't test other possible options, like IM_NOLOG or IM_DEBUG_MALLOC. | |
107 | ||
108 | =head1 AUTHOR | |
109 | ||
110 | Tony Cook <tony@develop-help.com> | |
111 | ||
112 | =cut | |
113 |