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