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