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