3 # Last change: Fri May 28 03:16:57 BST 1999
5 # This is written in a peculiar style, since we're trying to avoid
6 # most of the constructs we'll be testing for.
10 if ($#ARGV >= 0 && $ARGV[0] eq '-v') {
15 chdir 't' if -f 't/TEST';
17 die "You need to run \"make test\" first to set things up.\n"
18 unless -e 'perl' or -e 'perl.exe';
20 # check leakage for embedders
21 $ENV{PERL_DESTRUCT_LEVEL} = 2 unless exists $ENV{PERL_DESTRUCT_LEVEL};
23 $ENV{EMXSHELL} = 'sh'; # For OS/2
26 @ARGV = split(/[ \n]/,
27 `echo base/*.t comp/*.t cmd/*.t io/*.t; echo op/*.t pragma/*.t lib/*.t`);
30 %infinite = ( 'comp/require.t', 1, 'op/bop.t', 1, 'lib/hostname.t', 1 );
32 _testprogs('perl', @ARGV);
33 _testprogs('compile', @ARGV) if (-e "../testcompile");
40 print <<'EOT' if ($type eq 'compile');
41 --------------------------------------------------------------------------------
43 --------------------------------------------------------------------------------
46 $ENV{PERLCC_TIMEOUT} = 120
47 if ($type eq 'compile' && !$ENV{PERLCC_TIMEOUT});
57 $maxlen = $len if $len > $maxlen;
59 # +3 : we want three dots between the test name and the "ok"
61 $dotdotdot = $maxlen + 3 - 2;
62 while ($test = shift @tests) {
64 if ( $infinite{$test} && $type eq 'compile' ) {
65 print STDERR "$test creates infinite loop! Skipping.\n";
73 print "$te" . '.' x ($dotdotdot - length($te));
75 open(SCRIPT,"<$test") or die "Can't run $test.\n";
78 if (/#!.*perl(.*)$/) {
81 # Must protect uppercase switches with "" on command line
82 $switch =~ s/-([A-Z]\S*)/"-$1"/g;
89 if ($type eq 'perl') {
90 my $run = "./perl$switch $test |";
91 open(RESULTS,$run) or print "can't run '$run': $!.\n";
95 "./perl -I../lib ../utils/perlcc -o ./$test.plc ./$test "
97 open(RESULTS, $compile)
98 or print "can't compile '$compile': $!.\n";
109 if (/^1\.\.([0-9]+)/) {
117 $next = $1, $ok = 0, last if /^not ok ([0-9]*)/;
118 if (/^ok (\d+)(\s*#.*)?/ && $1 == $next) {
121 elsif (/^Bail out!\s*(.*)/i) { # magic words
122 die "FAILED--Further testing stopped" . ($1 ? ": $1\n" : ".\n");
132 if ($ok && $next == $max) {
138 print "skipping test on this platform\n";
144 print "FAILED at test $next\n";
148 die "Failed a basic test--cannot continue.\n";
155 print "All tests successful.\n";
156 # XXX add mention of 'perlbug -ok' ?
159 die "FAILED--no tests were run for some reason.\n";
163 $pct = $files ? sprintf("%.2f", ($files - $bad) / $files * 100) : "0.00";
165 warn "Failed 1 test script out of $files, $pct% okay.\n";
168 warn "Failed $bad test scripts out of $files, $pct% okay.\n";
171 ### Since not all tests were successful, you may want to run some
172 ### of them individually and examine any diagnostic messages they
173 ### produce. See the INSTALL document's section on "make test".
174 ### If you are testing the compiler, then ignore this message
177 ### in the directory ./t.
179 warn <<'SHRDLU' if $good / $total > 0.8;
181 ### Since most tests were successful, you have a good chance to
182 ### get information with better granularity by running
184 ### in directory ./t.
187 ($user,$sys,$cuser,$csys) = times;
188 print sprintf("u=%g s=%g cu=%g cs=%g scripts=%d tests=%d\n",
189 $user,$sys,$cuser,$csys,$files,$totmax);