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 open(RESULTS,"./perl$switch $test |") or print "can't run.\n";
93 open(RESULTS, "./perl -I../lib ../utils/perlcc ./$test "
94 ."-run -verbose dcf -log ../compilelog |")
95 or print "can't compile.\n";
105 if (/^1\.\.([0-9]+)/) {
113 $next = $1, $ok = 0, last if /^not ok ([0-9]*)/;
114 if (/^ok (\d+)(\s*#.*)?$/ && $1 == $next) {
125 if ($ok && $next == $max) {
131 print "skipping test on this platform\n";
137 print "FAILED at test $next\n";
141 die "Failed a basic test--cannot continue.\n";
148 print "All tests successful.\n";
149 # XXX add mention of 'perlbug -ok' ?
152 die "FAILED--no tests were run for some reason.\n";
156 $pct = $files ? sprintf("%.2f", ($files - $bad) / $files * 100) : "0.00";
158 warn "Failed 1 test script out of $files, $pct% okay.\n";
161 warn "Failed $bad test scripts out of $files, $pct% okay.\n";
164 ### Since not all tests were successful, you may want to run some
165 ### of them individually and examine any diagnostic messages they
166 ### produce. See the INSTALL document's section on "make test".
167 ### If you are testing the compiler, then ignore this message
170 ### in the directory ./t.
172 warn <<'SHRDLU' if $good / $total > 0.8;
174 ### Since most tests were successful, you have a good chance to
175 ### get information with better granularity by running
177 ### in directory ./t.
180 ($user,$sys,$cuser,$csys) = times;
181 print sprintf("u=%g s=%g cu=%g cs=%g scripts=%d tests=%d\n",
182 $user,$sys,$cuser,$csys,$files,$totmax);