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