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