Commit | Line | Data |
0a7c7f4f |
1 | |
dbda3434 |
2 | |
0a7c7f4f |
3 | use strict ; |
dbda3434 |
4 | use ExtUtils::MakeMaker; |
0a7c7f4f |
5 | |
dbda3434 |
6 | $| = 1 ; |
0a7c7f4f |
7 | my $verbose = 0 ; |
8 | |
dbda3434 |
9 | # TODO -- Get MM->new to output less MakeMaker progress guff |
10 | my $mm = MM->new( { NAME => 'dummy' }); |
11 | |
12 | # TODO -- determine what "make" program to run. |
13 | my $MAKE = 'make'; |
14 | |
15 | |
16 | # TODO -- need to decide how far back we go. |
17 | |
0a7c7f4f |
18 | # find all version of Perl that are available |
19 | my @PerlBinaries = qw( |
dbda3434 |
20 | 5.004 |
21 | 5.00401 |
22 | 5.00402 |
23 | 5.00403 |
24 | 5.00404 |
25 | 5.00405 |
26 | 5.005 |
27 | 5.00501 |
28 | 5.00502 |
29 | 5.00503 |
30 | 5.6.0 |
31 | 5.6.1 |
32 | 5.7.0 |
33 | 5.7.1 |
34 | 5.7.2 |
0a7c7f4f |
35 | ); |
36 | |
dbda3434 |
37 | print "Searching for Perl binaries...\n" ; |
38 | my @GoodPerls = (); |
39 | my $maxlen = 0; |
40 | my @path = $mm->path(); |
41 | foreach my $perl (@PerlBinaries) { |
42 | # TODO -- find_perl will send a warning to STDOUT if it can't find |
43 | # the requested perl, so need to temporarily close STDOUT. |
44 | |
45 | if (my $abs = $mm->find_perl($perl, ["perl$perl"], [@path], 0)) { |
46 | push @GoodPerls, $abs ; |
47 | $maxlen = length $abs |
48 | if length $abs > $maxlen ; |
49 | } |
50 | } |
51 | print "\n\nFound "; |
52 | foreach (@GoodPerls) { print "$_\n" } |
53 | print "\n\n"; |
0a7c7f4f |
54 | $maxlen += 3 ; |
55 | |
56 | # run each through the test harness |
57 | |
58 | my $bad = 0 ; |
59 | my $good = 0 ; |
60 | my $total = 0 ; |
61 | |
dbda3434 |
62 | # prime the pump, so the first "make clean" will work. |
63 | runit("perl Makefile.PL") || die "Cannot run perl Makefile.PL\n" ; |
64 | |
65 | foreach my $perl (@GoodPerls) |
0a7c7f4f |
66 | { |
dbda3434 |
67 | my $prefix = "$perl -- " if $verbose ; |
0a7c7f4f |
68 | print "Testing $perl " . ('.' x ($maxlen - length $perl)) ; |
dbda3434 |
69 | |
70 | my $ok = runit("$MAKE clean") && |
71 | runit("$perl Makefile.PL") && |
72 | runit("$MAKE test") ; |
0a7c7f4f |
73 | |
74 | ++ $total; |
75 | if ($ok) { |
76 | ++ $good ; |
dbda3434 |
77 | print "${prefix}ok\n"; |
0a7c7f4f |
78 | } |
79 | else { |
80 | ++ $bad ; |
dbda3434 |
81 | print "${prefix}not ok\n" ; |
0a7c7f4f |
82 | } |
83 | |
84 | } |
85 | |
86 | print "\n\nPassed with $good of $total versions of Perl.\n"; |
87 | exit $bad ; |
88 | |
89 | |
90 | sub runit |
91 | { |
dbda3434 |
92 | # TODO -- portability alert!! |
93 | |
0a7c7f4f |
94 | my $cmd = shift ; |
dbda3434 |
95 | print "\n Running [$cmd]\n" if $verbose ; |
0a7c7f4f |
96 | my $file = "/tmp/abc.$$" ; |
97 | unlink $file ; |
dbda3434 |
98 | my $output = `$cmd 2>&1` ; |
99 | $output =~ s/^/ /gm; |
100 | print " Output\n$output\n" if $verbose || $? ; |
0a7c7f4f |
101 | if ($?) |
102 | { |
103 | return 0 unless $verbose ; |
dbda3434 |
104 | warn " $cmd failed: $?\n" ; |
0a7c7f4f |
105 | exit ; |
106 | } |
107 | unlink $file ; |
108 | return 1 ; |
109 | } |