3 # Last change: Fri Jan 10 09:57:03 WET 1997
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 #$ENV{PERL_DESTRUCT_LEVEL} = '2';
21 $ENV{EMXSHELL} = 'sh'; # For OS/2
24 @ARGV = split(/[ \n]/,
25 `echo base/*.t comp/*.t cmd/*.t io/*.t; echo op/*.t pragma/*.t lib/*.t`);
28 if ($^O eq 'os2' || $^O eq 'qnx') {
32 open(CONFIG, "../config.sh");
34 if (/sharpbang='(.*)'/) {
35 $sharpbang = ($1 eq '#!');
42 %infinite = ( 'comp/require.t', 1, 'op/bop.t', 1, 'lib/hostname.t', 1 );
44 _testprogs('perl', @ARGV);
45 _testprogs('compile', @ARGV) if (-e "../testcompile");
52 print <<'EOT' if ($type eq 'compile');
53 --------------------------------------------------------------------------------
55 --------------------------------------------------------------------------------
58 $ENV{PERLCC_TIMEOUT} = 120
59 if ($type eq 'compile' && !$ENV{PERLCC_TIMEOUT});
66 while ($test = shift @tests) {
68 if ( $infinite{$test} && $type eq 'compile' ) {
69 print STDERR "$test creates infinite loop! Skipping.\n";
77 print "$te" . '.' x (18 - length($te));
79 -x $test || (print "isn't executable.\n");
81 if ($type eq 'perl') {
82 my $run = "./$test |";
83 open(RESULTS, $run) || (print "can't run '$run': $!\n");
87 "./perl -I../lib ../utils/perlcc -o ./$test.plc ./$test "
89 open(RESULTS, $compile)
90 or print "can't compile '$compile': $!.\n";
95 open(SCRIPT,"$test") or die "Can't run $test.\n";
101 # Must protect uppercase switches with "" on command line
102 $switch =~ s/-([A-Z]\S*)/"-$1"/g;
109 if ($type eq 'perl') {
110 my $run = "./perl$switch -I../lib -Mutf8 $test |";
111 open(RESULTS, $run) or
112 print "can't run '$run': $!.\n";
115 my $compile = "./perl -I../lib ../utils/perlcc -Mutf8 ./$test -run -verbose dcf -log ../compilelog |";
116 open(RESULTS, $compile) or
117 print "can't compile '$compile': $!.\n";
127 if (/^1\.\.([0-9]+)/) {
135 $next = $1, $ok = 0, last if /^not ok ([0-9]*)/;
136 if (/^ok (\d+)(\s*#.*)?$/ && $1 == $next) {
139 elsif (/^Bail out!\s*(.*)/i) { # magic words
140 die "FAILED--Further testing stopped" . ($1 ? ": $1\n" : ".\n");
150 if ($ok && $next == $max) {
156 print "skipping test on this platform\n";
162 print "FAILED at test $next\n";
166 die "Failed a basic test--cannot continue.\n";
173 print "All tests successful.\n";
174 # XXX add mention of 'perlbug -ok' ?
177 die "FAILED--no tests were run for some reason.\n";
181 $pct = sprintf("%.2f", $good / $total * 100);
183 warn "Failed 1 test script out of $total, $pct% okay.\n";
186 warn "Failed $bad test scripts out of $total, $pct% okay.\n";
189 ### Since not all tests were successful, you may want to run some
190 ### of them individually and examine any diagnostic messages they
191 ### produce. See the INSTALL document's section on "make test".
192 ### If you are testing the compiler, then ignore this message
195 ### in the directory ./t.
197 warn <<'SHRDLU' if $good / $total > 0.8;
199 ### Since most tests were successful, you have a good chance to
200 ### get information with better granularity by running
202 ### in directory ./t.
205 ($user,$sys,$cuser,$csys) = times;
206 print sprintf("u=%g s=%g cu=%g cs=%g scripts=%d tests=%d\n",
207 $user,$sys,$cuser,$csys,$files,$totmax);