3 # This is written in a peculiar style, since we're trying to avoid
4 # most of the constructs we'll be testing for.
8 # Cheesy version of Getopt::Std. Maybe we should replace it with that.
10 foreach my $idx (0..$#ARGV) {
11 next unless $ARGV[$idx] =~ /^-(\w+)$/;
12 $verbose = 1 if $1 eq 'v';
13 $with_utf= 1 if $1 eq 'utf8';
14 splice(@ARGV, $idx, 1);
18 chdir 't' if -f 't/TEST';
20 die "You need to run \"make test\" first to set things up.\n"
21 unless -e 'perl' or -e 'perl.exe';
23 if ($ENV{PERL_3LOG}) {
24 unless (-x 'perl.third') {
25 unless (-x '../perl.third') {
26 die "You need to run \"make perl.third first.\n";
29 print "Symlinking ../perl.third as perl.third...\n";
30 die "Failed to symlink: $!\n"
31 unless symlink("../perl.third", "perl.third");
32 die "Symlinked but no executable perl.third: $!\n"
33 unless -x 'perl.third';
38 # check leakage for embedders
39 $ENV{PERL_DESTRUCT_LEVEL} = 2 unless exists $ENV{PERL_DESTRUCT_LEVEL};
41 $ENV{EMXSHELL} = 'sh'; # For OS/2
44 @ARGV = split(/[ \n]/,
45 `echo base/*.t comp/*.t cmd/*.t run/*.t io/*.t; echo op/*.t pragma/*.t lib/*.t pod/*.t camel-III/*.t`);
48 # %infinite = ( 'comp/require.t', 1, 'op/bop.t', 1, 'lib/hostname.t', 1 );
50 _testprogs('perl', @ARGV);
51 _testprogs('compile', @ARGV) if (-e "../testcompile");
58 print <<'EOT' if ($type eq 'compile');
59 --------------------------------------------------------------------------------
61 --------------------------------------------------------------------------------
64 $ENV{PERLCC_TIMEOUT} = 120
65 if ($type eq 'compile' && !$ENV{PERLCC_TIMEOUT});
75 $maxlen = $len if $len > $maxlen;
77 # +3 : we want three dots between the test name and the "ok"
79 $dotdotdot = $maxlen + 3 - 2;
80 while ($test = shift @tests) {
82 if ( $infinite{$test} && $type eq 'compile' ) {
83 print STDERR "$test creates infinite loop! Skipping.\n";
91 print "$te" . '.' x ($dotdotdot - length($te));
93 open(SCRIPT,"<$test") or die "Can't run $test.\n";
96 if (/#!.*perl(.*)$/) {
99 # Must protect uppercase switches with "" on command line
100 $switch =~ s/-([A-Z]\S*)/"-$1"/g;
107 my $utf = $with_utf ? '-I../lib -Mutf8'
109 my $testswitch = '-I. -MTestInit'; # -T will strict . from @INC
110 if ($type eq 'perl') {
111 my $run = "./perl $testswitch $switch $utf $test |";
112 open(RESULTS,$run) or print "can't run '$run': $!.\n";
116 "./perl $testswitch -I../lib ../utils/perlcc -o ".
117 "./$test.plc $utf ./$test ".
119 open(RESULTS, $compile)
120 or print "can't compile '$compile': $!.\n";
121 unlink "./$test.plc";
131 if (/^1\.\.([0-9]+)/) {
139 if (/^(not )?ok (\d+)(\s*#.*)?/ &&
142 my($not, $num, $extra) = ($1, $2, $3);
143 my($istodo) = $extra =~ /^\s*#\s*TODO/ if $extra;
145 if( $not && !$istodo ) {
154 elsif (/^Bail out!\s*(.*)/i) { # magic words
155 die "FAILED--Further testing stopped" . ($1 ? ": $1\n" : ".\n");
164 if ($ENV{PERL_3LOG}) {
168 rename("perl.3log", "perl.3log.$tpp");
171 if ($ok && $next == $max) {
177 print "skipping test on this platform\n";
183 print "FAILED at test $next\n";
187 die "Failed a basic test--cannot continue.\n";
194 print "All tests successful.\n";
195 # XXX add mention of 'perlbug -ok' ?
198 die "FAILED--no tests were run for some reason.\n";
202 $pct = $files ? sprintf("%.2f", ($files - $bad) / $files * 100) : "0.00";
204 warn "Failed 1 test script out of $files, $pct% okay.\n";
207 warn "Failed $bad test scripts out of $files, $pct% okay.\n";
210 ### Since not all tests were successful, you may want to run some
211 ### of them individually and examine any diagnostic messages they
212 ### produce. See the INSTALL document's section on "make test".
213 ### If you are testing the compiler, then ignore this message
216 ### in the directory ./t.
218 warn <<'SHRDLU' if $good / $total > 0.8;
220 ### Since most tests were successful, you have a good chance to
221 ### get information with better granularity by running
223 ### in directory ./t.
226 ($user,$sys,$cuser,$csys) = times;
227 print sprintf("u=%g s=%g cu=%g cs=%g scripts=%d tests=%d\n",
228 $user,$sys,$cuser,$csys,$files,$totmax);