8f6882b8f91f846cf371c8195b0c7ed773a9fa1e
[p5sagit/p5-mst-13.2.git] / t / TEST
1 #!./perl
2
3 # This is written in a peculiar style, since we're trying to avoid
4 # most of the constructs we'll be testing for.  (This comment is
5 # probably obsolete on the avoidance side, though still currrent
6 # on the peculiarity side.)
7
8 # t/TEST and t/harness need to share code. The logical way to do this would be
9 # to have the common code in a file both require or use. However, t/TEST needs
10 # to still work, to generate test results, even if require isn't working, so
11 # we cannot do that. t/harness has no such restriction, so it is quite
12 # acceptable to have it require t/TEST.
13
14 # In which case, we need to stop t/TEST actually running tests, as all
15 # t/harness needs are its subroutines.
16
17
18 # directories with special sets of test switches
19 my %dir_to_switch =
20     (base => '',
21      comp => '',
22      run => '',
23      '../ext/File-Glob/t' => '-I.. -MTestInit', # FIXME - tests assume t/
24      );
25
26 my %temp_no_core =
27     ('../ext/B-Debug' => 1,
28      '../ext/Compress-Raw-Bzip2' => 1,
29      '../ext/Compress-Raw-Zlib' => 1,
30      '../ext/Devel-PPPort' => 1,
31      '../ext/Encode' => 1,
32      '../ext/IO-Compress' => 1,
33      '../ext/IPC-SysV' => 1,
34      '../ext/MIME-Base64' => 1,
35      '../ext/Time-HiRes' => 1,
36      '../ext/Unicode-Normalize' => 1,
37     );
38
39 if ($::do_nothing) {
40     return 1;
41 }
42
43 # Location to put the Valgrind log.
44 my $Valgrind_Log = 'current.valgrind';
45
46 $| = 1;
47
48 # for testing TEST only
49 #BEGIN { require '../lib/strict.pm'; "strict"->import() };
50 #BEGIN { require '../lib/warnings.pm'; "warnings"->import() };
51
52 delete $ENV{PERL5LIB};
53 delete $ENV{PERLLIB};
54 delete $ENV{PERL5OPT};
55
56 # remove empty elements due to insertion of empty symbols via "''p1'" syntax
57 @ARGV = grep($_,@ARGV) if $^O eq 'VMS';
58 our $show_elapsed_time = $ENV{HARNESS_TIMER} || 0;
59
60 # Cheesy version of Getopt::Std.  We can't replace it with that, because we
61 # can't rely on require working.
62 {
63     my @argv = ();
64     foreach my $idx (0..$#ARGV) {
65         push( @argv, $ARGV[$idx] ), next unless $ARGV[$idx] =~ /^-(\S+)$/;
66         $::benchmark = 1 if $1 eq 'benchmark';
67         $::core    = 1 if $1 eq 'core';
68         $::verbose = 1 if $1 eq 'v';
69         $::torture = 1 if $1 eq 'torture';
70         $::with_utf8 = 1 if $1 eq 'utf8';
71         $::with_utf16 = 1 if $1 eq 'utf16';
72         $::taintwarn = 1 if $1 eq 'taintwarn';
73         $ENV{PERL_CORE_MINITEST} = 1 if $1 eq 'minitest';
74         if ($1 =~ /^deparse(,.+)?$/) {
75             $::deparse = 1;
76             $::deparse_opts = $1;
77         }
78     }
79     @ARGV = @argv;
80 }
81
82 chdir 't' if -f 't/TEST';
83
84 die "You need to run \"make test\" first to set things up.\n"
85   unless -e 'perl' or -e 'perl.exe' or -e 'perl.pm';
86
87 if ($ENV{PERL_3LOG}) { # Tru64 third(1) tool, see perlhack
88     unless (-x 'perl.third') {
89         unless (-x '../perl.third') {
90             die "You need to run \"make perl.third first.\n";
91         }
92         else {
93             print "Symlinking ../perl.third as perl.third...\n";
94             die "Failed to symlink: $!\n"
95                 unless symlink("../perl.third", "perl.third");
96             die "Symlinked but no executable perl.third: $!\n"
97                 unless -x 'perl.third';
98         }
99     }
100 }
101
102 # check leakage for embedders
103 $ENV{PERL_DESTRUCT_LEVEL} = 2 unless exists $ENV{PERL_DESTRUCT_LEVEL};
104
105 $ENV{EMXSHELL} = 'sh';        # For OS/2
106
107 if ($show_elapsed_time) { require Time::HiRes }
108
109 my %skip = (
110             '.' => 1,
111             '..' => 1,
112             'CVS' => 1,
113             'RCS' => 1,
114             'SCCS' => 1,
115             '.svn' => 1,
116            );
117
118 # Roll your own File::Find!
119 sub _find_tests {
120     my($dir) = @_;
121     opendir DIR, $dir or die "Trouble opening $dir: $!";
122     foreach my $f (sort { $a cmp $b } readdir DIR) {
123         next if $skip{$f};
124
125         my $fullpath = "$dir/$f";
126
127         if (-d $fullpath) {
128             _find_tests($fullpath);
129         } elsif ($f =~ /\.t$/) {
130             push @ARGV, $fullpath;
131         }
132     }
133 }
134
135
136 # Scan the text of the test program to find switches and special options
137 # we might need to apply.
138 sub _scan_test {
139     my($test, $type) = @_;
140
141     open(my $script, "<", $test) or die "Can't read $test.\n";
142     my $first_line = <$script>;
143
144     $first_line =~ tr/\0//d if $::with_utf16;
145
146     my $switch = "";
147     if ($first_line =~ /#!.*\bperl.*\s-\w*([tT])/) {
148         $switch = "-$1";
149     } else {
150         if ($::taintwarn) {
151             # not all tests are expected to pass with this option
152             $switch = '-t';
153         } else {
154             $switch = '';
155         }
156     }
157
158     my $file_opts = "";
159     if ($type eq 'deparse') {
160         # Look for #line directives which change the filename
161         while (<$script>) {
162             $file_opts .= ",-f$3$4"
163               if /^#\s*line\s+(\d+)\s+((\w+)|"([^"]+)")/;
164         }
165     }
166
167     close $script;
168
169     my $perl = './perl';
170     my $lib  = '../lib';
171     my $run_dir;
172     my $return_dir;
173
174     $test =~ /^(.+)\/[^\/]+/;
175     my $dir = $1;
176     my $testswitch = $dir_to_switch{$dir};
177     if (!defined $testswitch) {
178         if ($test =~ s!^(\.\./ext/[^/]+)/t!t!) {
179             $run_dir = $1;
180             $return_dir = '../../t';
181             $lib = '../../lib';
182             $perl = '../../t/perl';
183             $testswitch = "-I../.. -MTestInit=U2T,A";
184             if ($temp_no_core{$run_dir}) {
185                 $testswitch = $testswitch . ',NC';
186             }
187         } else {
188             $testswitch = '-I.. -MTestInit';  # -T will remove . from @INC
189         }
190     }
191
192     my $utf8 = $::with_utf8 ? "-I$lib -Mutf8" : '';
193
194     my %options = (
195         perl => $perl,
196         lib => $lib,
197         test => $test,
198         run_dir => $run_dir,
199         return_dir => $return_dir,
200         testswitch => $testswitch,
201         utf8 => $utf8,
202         file => $file_opts,
203         switch => $switch,
204     );
205
206     return \%options;
207 }
208
209 sub _cmd {
210     my($options, $type) = @_;
211
212     my $test = $options->{test};
213
214     my $cmd;
215     if ($type eq 'deparse') {
216         my $perl = "$options->{perl} $options->{testswitch}";
217         my $lib = $options->{lib};
218
219         $cmd = (
220           "$perl $options->{switch} -I$lib -MO=-qq,Deparse,-sv1.,".
221           "-l$::deparse_opts$options->{file} ".
222           "$test > $test.dp ".
223           "&& $perl $options->{switch} -I$lib $test.dp"
224         );
225     }
226     elsif ($type eq 'perl') {
227         my $perl = $options->{perl};
228         my $redir = $^O eq 'VMS' ? '2>&1' : '';
229
230         if ($ENV{PERL_VALGRIND}) {
231             my $valgrind = $ENV{VALGRIND} // 'valgrind';
232             my $vg_opts = $ENV{VG_OPTS}
233               //  "--suppressions=perl.supp --leak-check=yes "
234                 . "--leak-resolution=high --show-reachable=yes "
235                   . "--num-callers=50";
236             $perl = "$valgrind --log-fd=3 $vg_opts $perl";
237             $redir = "3>$Valgrind_Log";
238         }
239
240         my $args = "$options->{testswitch} $options->{switch} $options->{utf8}";
241         $cmd = $perl . _quote_args($args) . " $test $redir";
242     }
243
244     return $cmd;
245 }
246
247 sub _before_fork {
248     my ($options) = @_;
249
250     if ($options->{run_dir}) {
251         my $run_dir = $options->{run_dir};
252         chdir $run_dir or die "Can't chdir to '$run_dir': $!";
253     }
254
255     return;
256 }
257
258 sub _after_fork {
259     my ($options) = @_;
260
261     if ($options->{return_dir}) {
262         my $return_dir = $options->{return_dir};
263         chdir $return_dir
264            or die "Can't chdir from '$options->{run_dir}' to '$return_dir': $!";
265     }
266
267     return;
268 }
269
270 sub _run_test {
271     my($harness, $test, $type) = @_;
272     if (!defined $type) {
273         # To conform to the interface expected by exec in TAP::Harness
274         $type = 'perl';
275     }
276
277     my $options = _scan_test($test, $type);
278
279     $test = $options->{test}; # Might have changed if we're in ext/Foo
280
281     _before_fork($options);
282
283     my $cmd = _cmd($options, $type);
284
285     open(my $results, "$cmd |") or print "can't run '$cmd': $!.\n";
286
287     _after_fork($options);
288
289     # Our environment may force us to use UTF-8, but we can't be sure that
290     # anything we're reading from will be generating (well formed) UTF-8
291     # This may not be the best way - possibly we should unset ${^OPEN} up
292     # top?
293     binmode $results;
294
295     return $results;
296 }
297
298 sub _quote_args {
299     my ($args) = @_;
300     my $argstring = '';
301
302     foreach (split(/\s+/,$args)) {
303        # In VMS protect with doublequotes because otherwise
304        # DCL will lowercase -- unless already doublequoted.
305        $_ = q(").$_.q(") if ($^O eq 'VMS') && !/^\"/ && length($_) > 0;
306        $argstring .= ' ' . $_;
307     }
308     return $argstring;
309 }
310
311 sub _populate_hash {
312     return unless defined $_[0];
313     return map {$_, 1} split /\s+/, $_[0];
314 }
315
316 sub _tests_from_manifest {
317     my ($extensions, $known_extensions) = @_;
318     my %skip;
319     my %extensions = _populate_hash($extensions);
320     my %known_extensions = _populate_hash($known_extensions);
321
322     foreach (keys %known_extensions) {
323         $skip{$_}++ unless $extensions{$_};
324     }
325
326     my @results;
327     my $mani = '../MANIFEST';
328     if (open(MANI, $mani)) {
329         while (<MANI>) {
330             if (m!^(ext/(\S+)/+(?:[^/\s]+\.t|test\.pl)|lib/\S+?(?:\.t|test\.pl))\s!) {
331                 my $t = $1;
332                 my $extension = $2;
333                 if (!$::core || $t =~ m!^lib/[a-z]!) {
334                     if (defined $extension) {
335                         $extension =~ s!/t$!!;
336                         # XXX Do I want to warn that I'm skipping these?
337                         next if $skip{$extension};
338                         my $flat_extension = $extension;
339                         $flat_extension =~ s!-!/!g;
340                         next if $skip{$flat_extension}; # Foo/Bar may live in Foo-Bar
341                     }
342                     my $path = "../$t";
343                     push @results, $path;
344                     $::path_to_name{$path} = $t;
345                 }
346             }
347         }
348         close MANI;
349     } else {
350         warn "$0: cannot open $mani: $!\n";
351     }
352     return @results;
353 }
354
355 unless (@ARGV) {
356     # base first, as TEST bails out if that can't run
357     # then comp, to validate that require works
358     # then run, to validate that -M works
359     # then we know we can -MTestInit for everything else, making life simpler
360     foreach my $dir (qw(base comp run cmd io op uni mro)) {
361         _find_tests($dir);
362     }
363     _find_tests("lib") unless $::core;
364     # Config.pm may be broken for make minitest. And this is only a refinement
365     # for skipping tests on non-default builds, so it is allowed to fail.
366     # What we want to to is make a list of extensions which we did not build.
367     my $configsh = '../config.sh';
368     my ($extensions, $known_extensions);
369     if (-f $configsh) {
370         open FH, $configsh or die "Can't open $configsh: $!";
371         while (<FH>) {
372             if (/^extensions=['"](.*)['"]$/) {
373                 $extensions = $1;
374             }
375             elsif (/^known_extensions=['"](.*)['"]$/) {
376                 $known_extensions = $1;
377             }
378         }
379         if (!defined $known_extensions) {
380             warn "No known_extensions line found in $configsh";
381         }
382         if (!defined $extensions) {
383             warn "No extensions line found in $configsh";
384         }
385     }
386     # The "complex" constructions of list return from a subroutine, and push of
387     # a list, might fail if perl is really hosed, but they aren't needed for
388     # make minitest, and the building of extensions will likely also fail if
389     # something is that badly wrong.
390     push @ARGV, _tests_from_manifest($extensions, $known_extensions);
391     unless ($::core) {
392         _find_tests('pod');
393         _find_tests('x2p');
394         _find_tests('porting');
395         _find_tests('japh') if $::torture;
396         _find_tests('t/benchmark') if $::benchmark or $ENV{PERL_BENCHMARK};
397     }
398 }
399
400 if ($::deparse) {
401     _testprogs('deparse', '',   @ARGV);
402 }
403 elsif ($::with_utf16) {
404     for my $e (0, 1) {
405         for my $b (0, 1) {
406             print STDERR "# ENDIAN $e BOM $b\n";
407             my @UARGV;
408             for my $a (@ARGV) {
409                 my $u = $a . "." . ($e ? "l" : "b") . "e" . ($b ? "b" : "");
410                 my $f = $e ? "v" : "n";
411                 push @UARGV, $u;
412                 unlink($u);
413                 if (open(A, $a)) {
414                     if (open(U, ">$u")) {
415                         print U pack("$f", 0xFEFF) if $b;
416                         while (<A>) {
417                             print U pack("$f*", unpack("C*", $_));
418                         }
419                         close(U);
420                     }
421                     close(A);
422                 }
423             }
424             _testprogs('perl', '', @UARGV);
425             unlink(@UARGV);
426         }
427     }
428 }
429 else {
430     _testprogs('perl',    '',   @ARGV);
431 }
432
433 sub _testprogs {
434     my ($type, $args, @tests) = @_;
435
436     print <<'EOT' if ($type eq 'deparse');
437 ------------------------------------------------------------------------------
438 TESTING DEPARSER
439 ------------------------------------------------------------------------------
440 EOT
441
442     $::bad_files = 0;
443
444     foreach my $t (@tests) {
445       unless (exists $::path_to_name{$t}) {
446         my $tname = "t/$t";
447         $::path_to_name{$t} = $tname;
448       }
449     }
450     my $maxlen = 0;
451     foreach (@::path_to_name{@tests}) {
452         s/\.\w+\z/./;
453         my $len = length ;
454         $maxlen = $len if $len > $maxlen;
455     }
456     # + 3 : we want three dots between the test name and the "ok"
457     my $dotdotdot = $maxlen + 3 ;
458     my $valgrind = 0;
459     my $total_files = @tests;
460     my $good_files = 0;
461     my $tested_files  = 0;
462     my $totmax = 0;
463     my %failed_tests;
464
465     while (my $test = shift @tests) {
466         my $test_start_time = $show_elapsed_time ? Time::HiRes::time() : 0;
467
468         if ($test =~ /^$/) {
469             next;
470         }
471         if ($type eq 'deparse') {
472             if ($test eq "comp/redef.t") {
473                 # Redefinition happens at compile time
474                 next;
475             }
476             elsif ($test =~ m{lib/Switch/t/}) {
477                 # B::Deparse doesn't support source filtering
478                 next;
479             }
480         }
481         my $te = $::path_to_name{$test} . '.'
482                     x ($dotdotdot - length($::path_to_name{$test}));
483
484         if ($^O ne 'VMS') {  # defer printing on VMS due to piping bug
485             print $te;
486             $te = '';
487         }
488
489         my $results = _run_test(undef, $test, $type);
490
491         my $failure;
492         my $next = 0;
493         my $seen_leader = 0;
494         my $seen_ok = 0;
495         my $trailing_leader = 0;
496         my $max;
497         my %todo;
498         while (<$results>) {
499             next if /^\s*$/; # skip blank lines
500             if (/^1..$/ && ($^O eq 'VMS')) {
501                 # VMS pipe bug inserts blank lines.
502                 my $l2 = <RESULTS>;
503                 if ($l2 =~ /^\s*$/) {
504                     $l2 = <RESULTS>;
505                 }
506                 $_ = '1..' . $l2;
507             }
508             if ($::verbose) {
509                 print $_;
510             }
511             unless (/^\#/) {
512                 if ($trailing_leader) {
513                     # shouldn't be anything following a postfix 1..n
514                     $failure = 'FAILED--extra output after trailing 1..n';
515                     last;
516                 }
517                 if (/^1\.\.([0-9]+)( todo ([\d ]+))?/) {
518                     if ($seen_leader) {
519                         $failure = 'FAILED--seen duplicate leader';
520                         last;
521                     }
522                     $max = $1;
523                     %todo = map { $_ => 1 } split / /, $3 if $3;
524                     $totmax += $max;
525                     $tested_files++;
526                     if ($seen_ok) {
527                         # 1..n appears at end of file
528                         $trailing_leader = 1;
529                         if ($next != $max) {
530                             $failure = "FAILED--expected $max tests, saw $next";
531                             last;
532                         }
533                     }
534                     else {
535                         $next = 0;
536                     }
537                     $seen_leader = 1;
538                 }
539                 else {
540                     if (/^(not )?ok(?: (\d+))?[^\#]*(\s*\#.*)?/) {
541                         unless ($seen_leader) {
542                             unless ($seen_ok) {
543                                 $next = 0;
544                             }
545                         }
546                         $seen_ok = 1;
547                         $next++;
548                         my($not, $num, $extra, $istodo) = ($1, $2, $3, 0);
549                         $num = $next unless $num;
550
551                         if ($num == $next) {
552
553                             # SKIP is essentially the same as TODO for t/TEST
554                             # this still conforms to TAP:
555                             # http://search.cpan.org/dist/TAP/TAP.pod
556                             $extra and $istodo = $extra =~ /#\s*(?:TODO|SKIP)\b/;
557                             $istodo = 1 if $todo{$num};
558
559                             if( $not && !$istodo ) {
560                                 $failure = "FAILED at test $num";
561                                 last;
562                             }
563                         }
564                         else {
565                             $failure ="FAILED--expected test $next, saw test $num";
566                             last;
567                         }
568                     }
569                     elsif (/^Bail out!\s*(.*)/i) { # magic words
570                         die "FAILED--Further testing stopped" . ($1 ? ": $1\n" : ".\n");
571                     }
572                     else {
573                         # module tests are allowed extra output,
574                         # because Test::Harness allows it
575                         next if $test =~ /^\W*(ext|lib)\b/;
576                         $failure = "FAILED--unexpected output at test $next";
577                         last;
578                     }
579                 }
580             }
581         }
582         close $results;
583
584         if (not defined $failure) {
585             $failure = 'FAILED--no leader found' unless $seen_leader;
586         }
587
588         if ($ENV{PERL_VALGRIND}) {
589             my @valgrind;
590             if (-e $Valgrind_Log) {
591                 if (open(V, $Valgrind_Log)) {
592                     @valgrind = <V>;
593                     close V;
594                 } else {
595                     warn "$0: Failed to open '$Valgrind_Log': $!\n";
596                 }
597             }
598             if ($ENV{VG_OPTS} =~ /cachegrind/) {
599                 if (rename $Valgrind_Log, "$test.valgrind") {
600                     $valgrind++;
601                 } else {
602                     warn "$0: Failed to create '$test.valgrind': $!\n";
603                 }
604             }
605             elsif (@valgrind) {
606                 my $leaks = 0;
607                 my $errors = 0;
608                 for my $i (0..$#valgrind) {
609                     local $_ = $valgrind[$i];
610                     if (/^==\d+== ERROR SUMMARY: (\d+) errors? /) {
611                         $errors += $1;   # there may be multiple error summaries
612                     } elsif (/^==\d+== LEAK SUMMARY:/) {
613                         for my $off (1 .. 4) {
614                             if ($valgrind[$i+$off] =~
615                                 /(?:lost|reachable):\s+\d+ bytes in (\d+) blocks/) {
616                                 $leaks += $1;
617                             }
618                         }
619                     }
620                 }
621                 if ($errors or $leaks) {
622                     if (rename $Valgrind_Log, "$test.valgrind") {
623                         $valgrind++;
624                     } else {
625                         warn "$0: Failed to create '$test.valgrind': $!\n";
626                     }
627                 }
628             } else {
629                 warn "No valgrind output?\n";
630             }
631             if (-e $Valgrind_Log) {
632                 unlink $Valgrind_Log
633                     or warn "$0: Failed to unlink '$Valgrind_Log': $!\n";
634             }
635         }
636         if ($type eq 'deparse') {
637             unlink "./$test.dp";
638         }
639         if ($ENV{PERL_3LOG}) {
640             my $tpp = $test;
641             $tpp =~ s:^\.\./::;
642             $tpp =~ s:/:_:g;
643             $tpp =~ s:\.t$:.3log:;
644             rename("perl.3log", $tpp) ||
645                 die "rename: perl3.log to $tpp: $!\n";
646         }
647         if (not defined $failure and $next != $max) {
648             $failure="FAILED--expected $max tests, saw $next";
649         }
650
651         if( !defined $failure  # don't mask a test failure
652             and $? )
653         {
654             $failure = "FAILED--non-zero wait status: $?";
655         }
656
657         if (defined $failure) {
658             print "${te}$failure\n";
659             $::bad_files++;
660             if ($test =~ /^base/) {
661                 die "Failed a basic test ($test) -- cannot continue.\n";
662             }
663             ++$failed_tests{$test};
664         }
665         else {
666             if ($max) {
667                 my $elapsed;
668                 if ( $show_elapsed_time ) {
669                     $elapsed = sprintf( " %8.0f ms", (Time::HiRes::time() - $test_start_time) * 1000 );
670                 }
671                 else {
672                     $elapsed = "";
673                 }
674                 print "${te}ok$elapsed\n";
675                 $good_files++;
676             }
677             else {
678                 print "${te}skipped\n";
679                 $tested_files -= 1;
680             }
681         }
682     } # while tests
683
684     if ($::bad_files == 0) {
685         if ($good_files) {
686             print "All tests successful.\n";
687             # XXX add mention of 'perlbug -ok' ?
688         }
689         else {
690             die "FAILED--no tests were run for some reason.\n";
691         }
692     }
693     else {
694         my $pct = $tested_files ? sprintf("%.2f", ($tested_files - $::bad_files) / $tested_files * 100) : "0.00";
695         my $s = $::bad_files == 1 ? "" : "s";
696         warn "Failed $::bad_files test$s out of $tested_files, $pct% okay.\n";
697         for my $test ( sort keys %failed_tests ) {
698             print "\t$test\n";
699         }
700         warn <<'SHRDLU_1';
701 ### Since not all tests were successful, you may want to run some of
702 ### them individually and examine any diagnostic messages they produce.
703 ### See the INSTALL document's section on "make test".
704 SHRDLU_1
705         warn <<'SHRDLU_2' if $good_files / $total_files > 0.8;
706 ### You have a good chance to get more information by running
707 ###   ./perl harness
708 ### in the 't' directory since most (>=80%) of the tests succeeded.
709 SHRDLU_2
710         if (eval {require Config; import Config; 1}) {
711             if ($::Config{usedl} && (my $p = $::Config{ldlibpthname})) {
712                 warn <<SHRDLU_3;
713 ### You may have to set your dynamic library search path,
714 ### $p, to point to the build directory:
715 SHRDLU_3
716                 if (exists $ENV{$p} && $ENV{$p} ne '') {
717                     warn <<SHRDLU_4a;
718 ###   setenv $p `pwd`:\$$p; cd t; ./perl harness
719 ###   $p=`pwd`:\$$p; export $p; cd t; ./perl harness
720 ###   export $p=`pwd`:\$$p; cd t; ./perl harness
721 SHRDLU_4a
722                 } else {
723                     warn <<SHRDLU_4b;
724 ###   setenv $p `pwd`; cd t; ./perl harness
725 ###   $p=`pwd`; export $p; cd t; ./perl harness
726 ###   export $p=`pwd`; cd t; ./perl harness
727 SHRDLU_4b
728                 }
729                 warn <<SHRDLU_5;
730 ### for csh-style shells, like tcsh; or for traditional/modern
731 ### Bourne-style shells, like bash, ksh, and zsh, respectively.
732 SHRDLU_5
733             }
734         }
735     }
736     my ($user,$sys,$cuser,$csys) = times;
737     print sprintf("u=%.2f  s=%.2f  cu=%.2f  cs=%.2f  scripts=%d  tests=%d\n",
738         $user,$sys,$cuser,$csys,$tested_files,$totmax);
739     if ($ENV{PERL_VALGRIND}) {
740         my $s = $valgrind == 1 ? '' : 's';
741         print "$valgrind valgrind report$s created.\n", ;
742     }
743 }
744 exit ($::bad_files != 0);
745
746 # ex: set ts=8 sts=4 sw=4 noet: