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