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