Replace system by print in strictures/parsing regression test
[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 ($test, $type) = @_;
272
273     my $options = _scan_test($test, $type);
274     # $test might have changed if we're in ext/Foo, so don't use it anymore
275     # from now on. Use $options->{test} instead.
276
277     _before_fork($options);
278
279     my $cmd = _cmd($options, $type);
280
281     open(my $results, "$cmd |") or print "can't run '$cmd': $!.\n";
282
283     _after_fork($options);
284
285     # Our environment may force us to use UTF-8, but we can't be sure that
286     # anything we're reading from will be generating (well formed) UTF-8
287     # This may not be the best way - possibly we should unset ${^OPEN} up
288     # top?
289     binmode $results;
290
291     return $results;
292 }
293
294 sub _quote_args {
295     my ($args) = @_;
296     my $argstring = '';
297
298     foreach (split(/\s+/,$args)) {
299        # In VMS protect with doublequotes because otherwise
300        # DCL will lowercase -- unless already doublequoted.
301        $_ = q(").$_.q(") if ($^O eq 'VMS') && !/^\"/ && length($_) > 0;
302        $argstring .= ' ' . $_;
303     }
304     return $argstring;
305 }
306
307 sub _populate_hash {
308     return unless defined $_[0];
309     return map {$_, 1} split /\s+/, $_[0];
310 }
311
312 sub _tests_from_manifest {
313     my ($extensions, $known_extensions) = @_;
314     my %skip;
315     my %extensions = _populate_hash($extensions);
316     my %known_extensions = _populate_hash($known_extensions);
317
318     foreach (keys %known_extensions) {
319         $skip{$_}++ unless $extensions{$_};
320     }
321
322     my @results;
323     my $mani = '../MANIFEST';
324     if (open(MANI, $mani)) {
325         while (<MANI>) {
326             if (m!^(ext/(\S+)/+(?:[^/\s]+\.t|test\.pl)|lib/\S+?(?:\.t|test\.pl))\s!) {
327                 my $t = $1;
328                 my $extension = $2;
329                 if (!$::core || $t =~ m!^lib/[a-z]!) {
330                     if (defined $extension) {
331                         $extension =~ s!/t$!!;
332                         # XXX Do I want to warn that I'm skipping these?
333                         next if $skip{$extension};
334                         my $flat_extension = $extension;
335                         $flat_extension =~ s!-!/!g;
336                         next if $skip{$flat_extension}; # Foo/Bar may live in Foo-Bar
337                     }
338                     my $path = "../$t";
339                     push @results, $path;
340                     $::path_to_name{$path} = $t;
341                 }
342             }
343         }
344         close MANI;
345     } else {
346         warn "$0: cannot open $mani: $!\n";
347     }
348     return @results;
349 }
350
351 unless (@ARGV) {
352     # base first, as TEST bails out if that can't run
353     # then comp, to validate that require works
354     # then run, to validate that -M works
355     # then we know we can -MTestInit for everything else, making life simpler
356     foreach my $dir (qw(base comp run cmd io op uni mro)) {
357         _find_tests($dir);
358     }
359     _find_tests("lib") unless $::core;
360     # Config.pm may be broken for make minitest. And this is only a refinement
361     # for skipping tests on non-default builds, so it is allowed to fail.
362     # What we want to to is make a list of extensions which we did not build.
363     my $configsh = '../config.sh';
364     my ($extensions, $known_extensions);
365     if (-f $configsh) {
366         open FH, $configsh or die "Can't open $configsh: $!";
367         while (<FH>) {
368             if (/^extensions=['"](.*)['"]$/) {
369                 $extensions = $1;
370             }
371             elsif (/^known_extensions=['"](.*)['"]$/) {
372                 $known_extensions = $1;
373             }
374         }
375         if (!defined $known_extensions) {
376             warn "No known_extensions line found in $configsh";
377         }
378         if (!defined $extensions) {
379             warn "No extensions line found in $configsh";
380         }
381     }
382     # The "complex" constructions of list return from a subroutine, and push of
383     # a list, might fail if perl is really hosed, but they aren't needed for
384     # make minitest, and the building of extensions will likely also fail if
385     # something is that badly wrong.
386     push @ARGV, _tests_from_manifest($extensions, $known_extensions);
387     unless ($::core) {
388         _find_tests('pod');
389         _find_tests('x2p');
390         _find_tests('porting');
391         _find_tests('japh') if $::torture;
392         _find_tests('t/benchmark') if $::benchmark or $ENV{PERL_BENCHMARK};
393     }
394 }
395
396 if ($::deparse) {
397     _testprogs('deparse', '',   @ARGV);
398 }
399 elsif ($::with_utf16) {
400     for my $e (0, 1) {
401         for my $b (0, 1) {
402             print STDERR "# ENDIAN $e BOM $b\n";
403             my @UARGV;
404             for my $a (@ARGV) {
405                 my $u = $a . "." . ($e ? "l" : "b") . "e" . ($b ? "b" : "");
406                 my $f = $e ? "v" : "n";
407                 push @UARGV, $u;
408                 unlink($u);
409                 if (open(A, $a)) {
410                     if (open(U, ">$u")) {
411                         print U pack("$f", 0xFEFF) if $b;
412                         while (<A>) {
413                             print U pack("$f*", unpack("C*", $_));
414                         }
415                         close(U);
416                     }
417                     close(A);
418                 }
419             }
420             _testprogs('perl', '', @UARGV);
421             unlink(@UARGV);
422         }
423     }
424 }
425 else {
426     _testprogs('perl',    '',   @ARGV);
427 }
428
429 sub _testprogs {
430     my ($type, $args, @tests) = @_;
431
432     print <<'EOT' if ($type eq 'deparse');
433 ------------------------------------------------------------------------------
434 TESTING DEPARSER
435 ------------------------------------------------------------------------------
436 EOT
437
438     $::bad_files = 0;
439
440     foreach my $t (@tests) {
441       unless (exists $::path_to_name{$t}) {
442         my $tname = "t/$t";
443         $::path_to_name{$t} = $tname;
444       }
445     }
446     my $maxlen = 0;
447     foreach (@::path_to_name{@tests}) {
448         s/\.\w+\z/./;
449         my $len = length ;
450         $maxlen = $len if $len > $maxlen;
451     }
452     # + 3 : we want three dots between the test name and the "ok"
453     my $dotdotdot = $maxlen + 3 ;
454     my $valgrind = 0;
455     my $total_files = @tests;
456     my $good_files = 0;
457     my $tested_files  = 0;
458     my $totmax = 0;
459     my %failed_tests;
460
461     while (my $test = shift @tests) {
462         my $test_start_time = $show_elapsed_time ? Time::HiRes::time() : 0;
463
464         if ($test =~ /^$/) {
465             next;
466         }
467         if ($type eq 'deparse') {
468             if ($test eq "comp/redef.t") {
469                 # Redefinition happens at compile time
470                 next;
471             }
472             elsif ($test =~ m{lib/Switch/t/}) {
473                 # B::Deparse doesn't support source filtering
474                 next;
475             }
476         }
477         my $te = $::path_to_name{$test} . '.'
478                     x ($dotdotdot - length($::path_to_name{$test}));
479
480         if ($^O ne 'VMS') {  # defer printing on VMS due to piping bug
481             print $te;
482             $te = '';
483         }
484
485         my $results = _run_test($test, $type);
486
487         my $failure;
488         my $next = 0;
489         my $seen_leader = 0;
490         my $seen_ok = 0;
491         my $trailing_leader = 0;
492         my $max;
493         my %todo;
494         while (<$results>) {
495             next if /^\s*$/; # skip blank lines
496             if (/^1..$/ && ($^O eq 'VMS')) {
497                 # VMS pipe bug inserts blank lines.
498                 my $l2 = <RESULTS>;
499                 if ($l2 =~ /^\s*$/) {
500                     $l2 = <RESULTS>;
501                 }
502                 $_ = '1..' . $l2;
503             }
504             if ($::verbose) {
505                 print $_;
506             }
507             unless (/^\#/) {
508                 if ($trailing_leader) {
509                     # shouldn't be anything following a postfix 1..n
510                     $failure = 'FAILED--extra output after trailing 1..n';
511                     last;
512                 }
513                 if (/^1\.\.([0-9]+)( todo ([\d ]+))?/) {
514                     if ($seen_leader) {
515                         $failure = 'FAILED--seen duplicate leader';
516                         last;
517                     }
518                     $max = $1;
519                     %todo = map { $_ => 1 } split / /, $3 if $3;
520                     $totmax += $max;
521                     $tested_files++;
522                     if ($seen_ok) {
523                         # 1..n appears at end of file
524                         $trailing_leader = 1;
525                         if ($next != $max) {
526                             $failure = "FAILED--expected $max tests, saw $next";
527                             last;
528                         }
529                     }
530                     else {
531                         $next = 0;
532                     }
533                     $seen_leader = 1;
534                 }
535                 else {
536                     if (/^(not )?ok(?: (\d+))?[^\#]*(\s*\#.*)?/) {
537                         unless ($seen_leader) {
538                             unless ($seen_ok) {
539                                 $next = 0;
540                             }
541                         }
542                         $seen_ok = 1;
543                         $next++;
544                         my($not, $num, $extra, $istodo) = ($1, $2, $3, 0);
545                         $num = $next unless $num;
546
547                         if ($num == $next) {
548
549                             # SKIP is essentially the same as TODO for t/TEST
550                             # this still conforms to TAP:
551                             # http://search.cpan.org/dist/TAP/TAP.pod
552                             $extra and $istodo = $extra =~ /#\s*(?:TODO|SKIP)\b/;
553                             $istodo = 1 if $todo{$num};
554
555                             if( $not && !$istodo ) {
556                                 $failure = "FAILED at test $num";
557                                 last;
558                             }
559                         }
560                         else {
561                             $failure ="FAILED--expected test $next, saw test $num";
562                             last;
563                         }
564                     }
565                     elsif (/^Bail out!\s*(.*)/i) { # magic words
566                         die "FAILED--Further testing stopped" . ($1 ? ": $1\n" : ".\n");
567                     }
568                     else {
569                         # module tests are allowed extra output,
570                         # because Test::Harness allows it
571                         next if $test =~ /^\W*(ext|lib)\b/;
572                         $failure = "FAILED--unexpected output at test $next";
573                         last;
574                     }
575                 }
576             }
577         }
578         close $results;
579
580         if (not defined $failure) {
581             $failure = 'FAILED--no leader found' unless $seen_leader;
582         }
583
584         if ($ENV{PERL_VALGRIND}) {
585             my @valgrind;
586             if (-e $Valgrind_Log) {
587                 if (open(V, $Valgrind_Log)) {
588                     @valgrind = <V>;
589                     close V;
590                 } else {
591                     warn "$0: Failed to open '$Valgrind_Log': $!\n";
592                 }
593             }
594             if ($ENV{VG_OPTS} =~ /cachegrind/) {
595                 if (rename $Valgrind_Log, "$test.valgrind") {
596                     $valgrind++;
597                 } else {
598                     warn "$0: Failed to create '$test.valgrind': $!\n";
599                 }
600             }
601             elsif (@valgrind) {
602                 my $leaks = 0;
603                 my $errors = 0;
604                 for my $i (0..$#valgrind) {
605                     local $_ = $valgrind[$i];
606                     if (/^==\d+== ERROR SUMMARY: (\d+) errors? /) {
607                         $errors += $1;   # there may be multiple error summaries
608                     } elsif (/^==\d+== LEAK SUMMARY:/) {
609                         for my $off (1 .. 4) {
610                             if ($valgrind[$i+$off] =~
611                                 /(?:lost|reachable):\s+\d+ bytes in (\d+) blocks/) {
612                                 $leaks += $1;
613                             }
614                         }
615                     }
616                 }
617                 if ($errors or $leaks) {
618                     if (rename $Valgrind_Log, "$test.valgrind") {
619                         $valgrind++;
620                     } else {
621                         warn "$0: Failed to create '$test.valgrind': $!\n";
622                     }
623                 }
624             } else {
625                 warn "No valgrind output?\n";
626             }
627             if (-e $Valgrind_Log) {
628                 unlink $Valgrind_Log
629                     or warn "$0: Failed to unlink '$Valgrind_Log': $!\n";
630             }
631         }
632         if ($type eq 'deparse') {
633             unlink "./$test.dp";
634         }
635         if ($ENV{PERL_3LOG}) {
636             my $tpp = $test;
637             $tpp =~ s:^\.\./::;
638             $tpp =~ s:/:_:g;
639             $tpp =~ s:\.t$:.3log:;
640             rename("perl.3log", $tpp) ||
641                 die "rename: perl3.log to $tpp: $!\n";
642         }
643         if (not defined $failure and $next != $max) {
644             $failure="FAILED--expected $max tests, saw $next";
645         }
646
647         if( !defined $failure  # don't mask a test failure
648             and $? )
649         {
650             $failure = "FAILED--non-zero wait status: $?";
651         }
652
653         if (defined $failure) {
654             print "${te}$failure\n";
655             $::bad_files++;
656             if ($test =~ /^base/) {
657                 die "Failed a basic test ($test) -- cannot continue.\n";
658             }
659             ++$failed_tests{$test};
660         }
661         else {
662             if ($max) {
663                 my $elapsed;
664                 if ( $show_elapsed_time ) {
665                     $elapsed = sprintf( " %8.0f ms", (Time::HiRes::time() - $test_start_time) * 1000 );
666                 }
667                 else {
668                     $elapsed = "";
669                 }
670                 print "${te}ok$elapsed\n";
671                 $good_files++;
672             }
673             else {
674                 print "${te}skipped\n";
675                 $tested_files -= 1;
676             }
677         }
678     } # while tests
679
680     if ($::bad_files == 0) {
681         if ($good_files) {
682             print "All tests successful.\n";
683             # XXX add mention of 'perlbug -ok' ?
684         }
685         else {
686             die "FAILED--no tests were run for some reason.\n";
687         }
688     }
689     else {
690         my $pct = $tested_files ? sprintf("%.2f", ($tested_files - $::bad_files) / $tested_files * 100) : "0.00";
691         my $s = $::bad_files == 1 ? "" : "s";
692         warn "Failed $::bad_files test$s out of $tested_files, $pct% okay.\n";
693         for my $test ( sort keys %failed_tests ) {
694             print "\t$test\n";
695         }
696         warn <<'SHRDLU_1';
697 ### Since not all tests were successful, you may want to run some of
698 ### them individually and examine any diagnostic messages they produce.
699 ### See the INSTALL document's section on "make test".
700 SHRDLU_1
701         warn <<'SHRDLU_2' if $good_files / $total_files > 0.8;
702 ### You have a good chance to get more information by running
703 ###   ./perl harness
704 ### in the 't' directory since most (>=80%) of the tests succeeded.
705 SHRDLU_2
706         if (eval {require Config; import Config; 1}) {
707             if ($::Config{usedl} && (my $p = $::Config{ldlibpthname})) {
708                 warn <<SHRDLU_3;
709 ### You may have to set your dynamic library search path,
710 ### $p, to point to the build directory:
711 SHRDLU_3
712                 if (exists $ENV{$p} && $ENV{$p} ne '') {
713                     warn <<SHRDLU_4a;
714 ###   setenv $p `pwd`:\$$p; cd t; ./perl harness
715 ###   $p=`pwd`:\$$p; export $p; cd t; ./perl harness
716 ###   export $p=`pwd`:\$$p; cd t; ./perl harness
717 SHRDLU_4a
718                 } else {
719                     warn <<SHRDLU_4b;
720 ###   setenv $p `pwd`; cd t; ./perl harness
721 ###   $p=`pwd`; export $p; cd t; ./perl harness
722 ###   export $p=`pwd`; cd t; ./perl harness
723 SHRDLU_4b
724                 }
725                 warn <<SHRDLU_5;
726 ### for csh-style shells, like tcsh; or for traditional/modern
727 ### Bourne-style shells, like bash, ksh, and zsh, respectively.
728 SHRDLU_5
729             }
730         }
731     }
732     my ($user,$sys,$cuser,$csys) = times;
733     print sprintf("u=%.2f  s=%.2f  cu=%.2f  cs=%.2f  scripts=%d  tests=%d\n",
734         $user,$sys,$cuser,$csys,$tested_files,$totmax);
735     if ($ENV{PERL_VALGRIND}) {
736         my $s = $valgrind == 1 ? '' : 's';
737         print "$valgrind valgrind report$s created.\n", ;
738     }
739 }
740 exit ($::bad_files != 0);
741
742 # ex: set ts=8 sts=4 sw=4 noet: