This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
%OVER was removed in October 2001 with 6ff868ee and 73ddec28.
[perl5.git] / t / TEST
CommitLineData
8d063cd8
LW
1#!./perl
2
8d063cd8 3# This is written in a peculiar style, since we're trying to avoid
1de9afcd
RGS
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.)
8d063cd8 7
84650816
MS
8# Location to put the Valgrind log.
9my $Valgrind_Log = 'current.valgrind';
10
a687059c
LW
11$| = 1;
12
80ed0dea 13# for testing TEST only
0c3906b8
MS
14#BEGIN { require '../lib/strict.pm'; "strict"->import() };
15#BEGIN { require '../lib/warnings.pm'; "warnings"->import() };
80ed0dea 16
104393a7 17delete $ENV{PERL5LIB};
60e23f2f 18
cc6ae9e5
CB
19# remove empty elements due to insertion of empty symbols via "''p1'" syntax
20@ARGV = grep($_,@ARGV) if $^O eq 'VMS';
551405c4 21our $show_elapsed_time = $ENV{HARNESS_TIMER} || 0;
cc6ae9e5 22
5d9a6404 23# Cheesy version of Getopt::Std. Maybe we should replace it with that.
80ed0dea
DM
24{
25 my @argv = ();
5d9a6404 26 foreach my $idx (0..$#ARGV) {
b326da91 27 push( @argv, $ARGV[$idx] ), next unless $ARGV[$idx] =~ /^-(\S+)$/;
7019aa11 28 $::benchmark = 1 if $1 eq 'benchmark';
80ed0dea
DM
29 $::core = 1 if $1 eq 'core';
30 $::verbose = 1 if $1 eq 'v';
31 $::torture = 1 if $1 eq 'torture';
32 $::with_utf8 = 1 if $1 eq 'utf8';
33 $::with_utf16 = 1 if $1 eq 'utf16';
80ed0dea 34 $::taintwarn = 1 if $1 eq 'taintwarn';
43651d81 35 $ENV{PERL_CORE_MINITEST} = 1 if $1 eq 'minitest';
485988ae 36 if ($1 =~ /^deparse(,.+)?$/) {
80ed0dea
DM
37 $::deparse = 1;
38 $::deparse_opts = $1;
485988ae 39 }
5d9a6404 40 }
80ed0dea 41 @ARGV = @argv;
8d063cd8
LW
42}
43
378cc40b
LW
44chdir 't' if -f 't/TEST';
45
3e6e8be7 46die "You need to run \"make test\" first to set things up.\n"
196918b0 47 unless -e 'perl' or -e 'perl.exe' or -e 'perl.pm';
4633a7c4 48
7a315204 49if ($ENV{PERL_3LOG}) { # Tru64 third(1) tool, see perlhack
09187cb1
JH
50 unless (-x 'perl.third') {
51 unless (-x '../perl.third') {
52 die "You need to run \"make perl.third first.\n";
53 }
54 else {
55 print "Symlinking ../perl.third as perl.third...\n";
56 die "Failed to symlink: $!\n"
57 unless symlink("../perl.third", "perl.third");
58 die "Symlinked but no executable perl.third: $!\n"
59 unless -x 'perl.third';
60 }
61 }
62}
63
3fb91a5e
GS
64# check leakage for embedders
65$ENV{PERL_DESTRUCT_LEVEL} = 2 unless exists $ENV{PERL_DESTRUCT_LEVEL};
66
4633a7c4 67$ENV{EMXSHELL} = 'sh'; # For OS/2
748a9306 68
24c841ba 69# Roll your own File::Find!
28ffa55a 70if ($show_elapsed_time) { require Time::HiRes }
7ebf5c89
NC
71
72my %skip = (
73 '.' => 1,
74 '..' => 1,
75 'CVS' => 1,
76 'RCS' => 1,
77 'SCCS' => 1,
78 '.svn' => 1,
79 );
24c841ba
MS
80
81sub _find_tests {
82 my($dir) = @_;
93e325a7 83 opendir DIR, $dir or die "Trouble opening $dir: $!";
a1886d87 84 foreach my $f (sort { $a cmp $b } readdir DIR) {
7ebf5c89 85 next if $skip{$f};
24c841ba 86
7ebf5c89 87 my $fullpath = "$dir/$f";
24c841ba 88
7ebf5c89
NC
89 if (-d $fullpath) {
90 _find_tests($fullpath);
91 } elsif ($f =~ /\.t$/) {
92 push @ARGV, $fullpath;
93 }
24c841ba
MS
94 }
95}
96
3fd4b359
MS
97
98# Scan the text of the test program to find switches and special options
99# we might need to apply.
100sub _scan_test {
101 my($test, $type) = @_;
102
103 open(my $script, "<", $test) or die "Can't read $test.\n";
104 my $first_line = <$script>;
105
106 $first_line =~ tr/\0//d if $::with_utf16;
107
108 my $switch = "";
109 if ($first_line =~ /#!.*\bperl.*\s-\w*([tT])/) {
110 $switch = qq{"-$1"};
111 } else {
112 if ($::taintwarn) {
113 # not all tests are expected to pass with this option
114 $switch = '"-t"';
115 } else {
116 $switch = '';
117 }
118 }
119
120 my $file_opts = "";
121 if ($type eq 'deparse') {
122 # Look for #line directives which change the filename
123 while (<$script>) {
124 $file_opts .= ",-f$3$4"
125 if /^#\s*line\s+(\d+)\s+((\w+)|"([^"]+)")/;
126 }
127 }
128
129 return { file => $file_opts, switch => $switch };
130}
131
5ed59b83
NC
132# directories with special sets of test switches
133my %dir_to_switch =
134 (base => '',
135 comp => '',
136 run => '',
137 );
84650816
MS
138
139sub _run_test {
140 my($test, $type) = @_;
141
142 my $options = _scan_test($test, $type);
143
923e061d
MS
144 my $perl = './perl';
145 my $lib = '../lib';
5ed59b83
NC
146 $test =~ /^([^\/]+)/;
147
148 my $testswitch = $dir_to_switch{$1};
149 if (!defined $testswitch) {
150 $testswitch = '-I. -MTestInit'; # -T will remove . from @INC
151 }
923e061d
MS
152
153 my $utf8 = $::with_utf8 ? '-I$lib -Mutf8' : '';
84650816
MS
154
155 my $results;
156 if ($type eq 'deparse') {
157 my $deparse_cmd =
923e061d 158 "$perl $testswitch $options->{switch} -I$lib -MO=-qq,Deparse,-sv1.,".
84650816
MS
159 "-l$::deparse_opts$options->{file} ".
160 "$test > $test.dp ".
923e061d 161 "&& $perl $testswitch $options->{switch} -I$lib $test.dp |";
84650816
MS
162 open($results, $deparse_cmd)
163 or print "can't deparse '$deparse_cmd': $!.\n";
164 }
165 elsif ($type eq 'perl') {
923e061d 166 my $perl = $ENV{PERL} || $perl;
84650816
MS
167 my $redir = $^O eq 'VMS' ? '2>&1' : '';
168
169 if ($ENV{PERL_VALGRIND}) {
170 my $valgrind = $ENV{VALGRIND} // 'valgrind';
171 my $vg_opts = $ENV{VG_OPTS}
172 // "--suppressions=perl.supp --leak-check=yes "
173 . "--leak-resolution=high --show-reachable=yes "
174 . "--num-callers=50";
175 $perl = "$valgrind --log-fd=3 $vg_opts $perl";
176 $redir = "3>$Valgrind_Log";
177 }
178
923e061d 179 my $run = $perl . _quote_args("$testswitch $options->{switch} $utf8")
84650816
MS
180 . " $test $redir|";
181 open($results, $run) or print "can't run '$run': $!.\n";
182 }
183
184 # Our environment may force us to use UTF-8, but we can't be sure that
185 # anything we're reading from will be generating (well formed) UTF-8
186 # This may not be the best way - possibly we should unset ${^OPEN} up
187 # top?
188 binmode $results;
189
190 return $results;
191}
192
cc6ae9e5
CB
193sub _quote_args {
194 my ($args) = @_;
195 my $argstring = '';
196
197 foreach (split(/\s+/,$args)) {
198 # In VMS protect with doublequotes because otherwise
199 # DCL will lowercase -- unless already doublequoted.
200 $_ = q(").$_.q(") if ($^O eq 'VMS') && !/^\"/ && length($_) > 0;
201 $argstring .= ' ' . $_;
202 }
203 return $argstring;
204}
205
6234cb77
NC
206sub _populate_hash {
207 return map {$_, 1} split /\s+/, $_[0];
208}
209
24c841ba 210unless (@ARGV) {
03d95bfa
NC
211 # base first, as TEST bails out if that can't run
212 # then comp, to validate that require works
213 # then run, to validate that -M works
214 # then we know we can -MTestInit for everything else, making life simpler
215 foreach my $dir (qw(base comp run cmd io op uni mro)) {
f458b6e8 216 _find_tests($dir);
24c841ba 217 }
80ed0dea 218 _find_tests("lib") unless $::core;
6234cb77
NC
219 # Config.pm may be broken for make minitest. And this is only a refinement
220 # for skipping tests on non-default builds, so it is allowed to fail.
221 # What we want to to is make a list of extensions which we did not build.
7ebf5c89 222 my $configsh = '../config.sh';
6234cb77
NC
223 my %skip;
224 if (-f $configsh) {
225 my (%extensions, %known_extensions);
226 open FH, $configsh or die "Can't open $configsh: $!";
227 while (<FH>) {
228 if (/^extensions=['"](.*)['"]$/) {
229 # Deliberate string interpolation to avoid triggering possible
230 # $1 resetting bugs.
231 %extensions = _populate_hash ("$1");
232 }
233 elsif (/^known_extensions=['"](.*)['"]$/) {
234 %known_extensions = _populate_hash ($1);
235 }
236 }
237 if (%extensions) {
238 if (%known_extensions) {
239 foreach (keys %known_extensions) {
240 $skip{$_}++ unless $extensions{$_};
241 }
242 } else {
243 warn "No known_extensions line found in $configsh";
244 }
245 } else {
246 warn "No extensions line found in $configsh";
247 }
248 }
7ebf5c89 249 my $mani = '../MANIFEST';
7a315204 250 if (open(MANI, $mani)) {
f458b6e8 251 while (<MANI>) { # similar code in t/harness
e469beda 252 if (m!^(ext/(\S+)/+(?:[^/\s]+\.t|test\.pl)|lib/\S+?(?:\.t|test\.pl))\s!) {
80ed0dea
DM
253 my $t = $1;
254 my $extension = $2;
255 if (!$::core || $t =~ m!^lib/[a-z]!)
5a6e071d 256 {
6234cb77
NC
257 if (defined $extension) {
258 $extension =~ s!/t$!!;
259 # XXX Do I want to warn that I'm skipping these?
260 next if $skip{$extension};
142f6a0d 261 my $flat_extension = $extension;
6ebb0601
CB
262 $flat_extension =~ s!-!/!g;
263 next if $skip{$flat_extension}; # Foo/Bar may live in Foo-Bar
6234cb77 264 }
7ebf5c89 265 my $path = "../$t";
73ddec28 266 push @ARGV, $path;
80ed0dea 267 $::path_to_name{$path} = $t;
5a6e071d 268 }
7a315204
JH
269 }
270 }
35d88760 271 close MANI;
7a315204 272 } else {
f458b6e8 273 warn "$0: cannot open $mani: $!\n";
7a315204 274 }
80ed0dea 275 unless ($::core) {
d44161bf 276 _find_tests('pod');
e018f8be 277 _find_tests('x2p');
6b77813c 278 _find_tests('porting');
80ed0dea 279 _find_tests('japh') if $::torture;
7019aa11 280 _find_tests('t/benchmark') if $::benchmark or $ENV{PERL_BENCHMARK};
e018f8be 281 }
8d063cd8
LW
282}
283
80ed0dea 284if ($::deparse) {
f193aa2f
MS
285 _testprogs('deparse', '', @ARGV);
286}
80ed0dea 287elsif ($::with_utf16) {
1de9afcd
RGS
288 for my $e (0, 1) {
289 for my $b (0, 1) {
290 print STDERR "# ENDIAN $e BOM $b\n";
291 my @UARGV;
292 for my $a (@ARGV) {
293 my $u = $a . "." . ($e ? "l" : "b") . "e" . ($b ? "b" : "");
294 my $f = $e ? "v" : "n";
295 push @UARGV, $u;
296 unlink($u);
297 if (open(A, $a)) {
298 if (open(U, ">$u")) {
90f6ca78 299 print U pack("$f", 0xFEFF) if $b;
1de9afcd
RGS
300 while (<A>) {
301 print U pack("$f*", unpack("C*", $_));
302 }
80ed0dea 303 close(U);
1de9afcd 304 }
80ed0dea 305 close(A);
1de9afcd
RGS
306 }
307 }
308 _testprogs('perl', '', @UARGV);
309 unlink(@UARGV);
310 }
311 }
312}
f193aa2f 313else {
f193aa2f 314 _testprogs('perl', '', @ARGV);
485988ae 315}
6ee623d5 316
bb365837 317sub _testprogs {
80ed0dea 318 my ($type, $args, @tests) = @_;
6ee623d5 319
485988ae 320 print <<'EOT' if ($type eq 'deparse');
7a315204 321------------------------------------------------------------------------------
485988ae 322TESTING DEPARSER
7a315204 323------------------------------------------------------------------------------
485988ae
RH
324EOT
325
80ed0dea 326 $::bad_files = 0;
73ddec28 327
cc6ae9e5 328 foreach my $t (@tests) {
80ed0dea 329 unless (exists $::path_to_name{$t}) {
7ebf5c89 330 my $tname = "t/$t";
f458b6e8 331 $::path_to_name{$t} = $tname;
cc6ae9e5 332 }
73ddec28 333 }
908801fe 334 my $maxlen = 0;
80ed0dea 335 foreach (@::path_to_name{@tests}) {
73ddec28
RB
336 s/\.\w+\z/./;
337 my $len = length ;
338 $maxlen = $len if $len > $maxlen;
088b5126 339 }
908801fe 340 # + 3 : we want three dots between the test name and the "ok"
80ed0dea 341 my $dotdotdot = $maxlen + 3 ;
7a834142 342 my $valgrind = 0;
80ed0dea
DM
343 my $total_files = @tests;
344 my $good_files = 0;
345 my $tested_files = 0;
346 my $totmax = 0;
ade55ef4 347 my %failed_tests;
80ed0dea 348
551405c4 349 while (my $test = shift @tests) {
28ffa55a 350 my $test_start_time = $show_elapsed_time ? Time::HiRes::time() : 0;
bb365837 351
bb365837
GS
352 if ($test =~ /^$/) {
353 next;
6ee623d5 354 }
485988ae
RH
355 if ($type eq 'deparse') {
356 if ($test eq "comp/redef.t") {
357 # Redefinition happens at compile time
358 next;
359 }
7a834142 360 elsif ($test =~ m{lib/Switch/t/}) {
485988ae
RH
361 # B::Deparse doesn't support source filtering
362 next;
363 }
364 }
80ed0dea
DM
365 my $te = $::path_to_name{$test} . '.'
366 x ($dotdotdot - length($::path_to_name{$test}));
cc6ae9e5
CB
367
368 if ($^O ne 'VMS') { # defer printing on VMS due to piping bug
369 print $te;
370 $te = '';
371 }
bb365837 372
84650816 373 my $results = _run_test($test, $type);
d638aca2 374
f458b6e8
MS
375 my $failure;
376 my $next = 0;
377 my $seen_leader = 0;
378 my $seen_ok = 0;
20f82676 379 my $trailing_leader = 0;
80ed0dea 380 my $max;
43fe0836 381 my %todo;
84650816 382 while (<$results>) {
cc6ae9e5 383 next if /^\s*$/; # skip blank lines
615b7a35
JM
384 if (/^1..$/ && ($^O eq 'VMS')) {
385 # VMS pipe bug inserts blank lines.
386 my $l2 = <RESULTS>;
387 if ($l2 =~ /^\s*$/) {
388 $l2 = <RESULTS>;
389 }
390 $_ = '1..' . $l2;
391 }
80ed0dea 392 if ($::verbose) {
bb365837
GS
393 print $_;
394 }
21c74f43 395 unless (/^\#/) {
20f82676
DM
396 if ($trailing_leader) {
397 # shouldn't be anything following a postfix 1..n
a5890677 398 $failure = 'FAILED--extra output after trailing 1..n';
20f82676
DM
399 last;
400 }
809908f7 401 if (/^1\.\.([0-9]+)( todo ([\d ]+))?/) {
20f82676 402 if ($seen_leader) {
a5890677 403 $failure = 'FAILED--seen duplicate leader';
20f82676
DM
404 last;
405 }
bb365837 406 $max = $1;
f458b6e8 407 %todo = map { $_ => 1 } split / /, $3 if $3;
bb365837 408 $totmax += $max;
80ed0dea 409 $tested_files++;
f458b6e8 410 if ($seen_ok) {
20f82676
DM
411 # 1..n appears at end of file
412 $trailing_leader = 1;
413 if ($next != $max) {
a5890677 414 $failure = "FAILED--expected $max tests, saw $next";
20f82676
DM
415 last;
416 }
417 }
418 else {
419 $next = 0;
420 }
f458b6e8 421 $seen_leader = 1;
bb365837
GS
422 }
423 else {
f458b6e8 424 if (/^(not )?ok(?: (\d+))?[^\#]*(\s*\#.*)?/) {
21c74f43
A
425 unless ($seen_leader) {
426 unless ($seen_ok) {
20f82676 427 $next = 0;
21c74f43 428 }
37ce32a7 429 }
21c74f43 430 $seen_ok = 1;
20f82676 431 $next++;
f458b6e8
MS
432 my($not, $num, $extra, $istodo) = ($1, $2, $3, 0);
433 $num = $next unless $num;
434
435 if ($num == $next) {
436
eac7c728
MB
437 # SKIP is essentially the same as TODO for t/TEST
438 # this still conforms to TAP:
3722f0dc 439 # http://search.cpan.org/dist/TAP/TAP.pod
eac7c728 440 $extra and $istodo = $extra =~ /#\s*(?:TODO|SKIP)\b/;
21c74f43
A
441 $istodo = 1 if $todo{$num};
442
443 if( $not && !$istodo ) {
20f82676 444 $failure = "FAILED at test $num";
21c74f43
A
445 last;
446 }
20f82676
DM
447 }
448 else {
f458b6e8 449 $failure ="FAILED--expected test $next, saw test $num";
20f82676 450 last;
37ce32a7 451 }
f458b6e8
MS
452 }
453 elsif (/^Bail out!\s*(.*)/i) { # magic words
454 die "FAILED--Further testing stopped" . ($1 ? ": $1\n" : ".\n");
bb365837
GS
455 }
456 else {
dbf51d07
YST
457 # module tests are allowed extra output,
458 # because Test::Harness allows it
459 next if $test =~ /^\W*(ext|lib)\b/;
a5890677 460 $failure = "FAILED--unexpected output at test $next";
20f82676 461 last;
bb365837 462 }
8d063cd8
LW
463 }
464 }
465 }
84650816 466 close $results;
20f82676
DM
467
468 if (not defined $failure) {
a5890677 469 $failure = 'FAILED--no leader found' unless $seen_leader;
20f82676
DM
470 }
471
7a834142 472 if ($ENV{PERL_VALGRIND}) {
da51b73c 473 my @valgrind;
84650816
MS
474 if (-e $Valgrind_Log) {
475 if (open(V, $Valgrind_Log)) {
da51b73c
MHM
476 @valgrind = <V>;
477 close V;
478 } else {
84650816 479 warn "$0: Failed to open '$Valgrind_Log': $!\n";
da51b73c
MHM
480 }
481 }
3068023c 482 if ($ENV{VG_OPTS} =~ /cachegrind/) {
84650816 483 if (rename $Valgrind_Log, "$test.valgrind") {
3068023c
JC
484 $valgrind++;
485 } else {
486 warn "$0: Failed to create '$test.valgrind': $!\n";
487 }
488 }
489 elsif (@valgrind) {
d44161bf
MHM
490 my $leaks = 0;
491 my $errors = 0;
7a834142
JH
492 for my $i (0..$#valgrind) {
493 local $_ = $valgrind[$i];
d44161bf
MHM
494 if (/^==\d+== ERROR SUMMARY: (\d+) errors? /) {
495 $errors += $1; # there may be multiple error summaries
496 } elsif (/^==\d+== LEAK SUMMARY:/) {
497 for my $off (1 .. 4) {
498 if ($valgrind[$i+$off] =~
499 /(?:lost|reachable):\s+\d+ bytes in (\d+) blocks/) {
500 $leaks += $1;
501 }
502 }
7a834142
JH
503 }
504 }
d44161bf 505 if ($errors or $leaks) {
84650816 506 if (rename $Valgrind_Log, "$test.valgrind") {
d44161bf
MHM
507 $valgrind++;
508 } else {
509 warn "$0: Failed to create '$test.valgrind': $!\n";
7a834142
JH
510 }
511 }
512 } else {
513 warn "No valgrind output?\n";
514 }
84650816
MS
515 if (-e $Valgrind_Log) {
516 unlink $Valgrind_Log
517 or warn "$0: Failed to unlink '$Valgrind_Log': $!\n";
da51b73c 518 }
7a834142 519 }
485988ae
RH
520 if ($type eq 'deparse') {
521 unlink "./$test.dp";
522 }
211f317f
JH
523 if ($ENV{PERL_3LOG}) {
524 my $tpp = $test;
3716a21d 525 $tpp =~ s:^\.\./::;
9c54ecba 526 $tpp =~ s:/:_:g;
3716a21d
JH
527 $tpp =~ s:\.t$:.3log:;
528 rename("perl.3log", $tpp) ||
529 die "rename: perl3.log to $tpp: $!\n";
211f317f 530 }
20f82676 531 if (not defined $failure and $next != $max) {
a5890677 532 $failure="FAILED--expected $max tests, saw $next";
20f82676
DM
533 }
534
343bc60d
MS
535 if( !defined $failure # don't mask a test failure
536 and $? )
537 {
538 $failure = "FAILED--non-zero wait status: $?";
539 }
540
20f82676
DM
541 if (defined $failure) {
542 print "${te}$failure\n";
543 $::bad_files++;
ade55ef4
AL
544 if ($test =~ /^base/) {
545 die "Failed a basic test ($test) -- cannot continue.\n";
20f82676 546 }
ade55ef4 547 ++$failed_tests{$test};
20f82676
DM
548 }
549 else {
bb365837 550 if ($max) {
551405c4
AL
551 my $elapsed;
552 if ( $show_elapsed_time ) {
553 $elapsed = sprintf( " %8.0f ms", (Time::HiRes::time() - $test_start_time) * 1000 );
554 }
555 else {
556 $elapsed = "";
557 }
558 print "${te}ok$elapsed\n";
80ed0dea 559 $good_files++;
bb365837
GS
560 }
561 else {
6b202754 562 print "${te}skipped\n";
80ed0dea 563 $tested_files -= 1;
bb365837 564 }
bcce72a7 565 }
551405c4 566 } # while tests
8d063cd8 567
80ed0dea 568 if ($::bad_files == 0) {
20f82676 569 if ($good_files) {
bb365837
GS
570 print "All tests successful.\n";
571 # XXX add mention of 'perlbug -ok' ?
572 }
573 else {
574 die "FAILED--no tests were run for some reason.\n";
575 }
8d063cd8 576 }
bb365837 577 else {
80ed0dea 578 my $pct = $tested_files ? sprintf("%.2f", ($tested_files - $::bad_files) / $tested_files * 100) : "0.00";
ade55ef4
AL
579 my $s = $::bad_files == 1 ? "" : "s";
580 warn "Failed $::bad_files test$s out of $tested_files, $pct% okay.\n";
581 for my $test ( sort keys %failed_tests ) {
582 print "\t$test\n";
bb365837 583 }
4e4732c1 584 warn <<'SHRDLU_1';
f7d228c6
JH
585### Since not all tests were successful, you may want to run some of
586### them individually and examine any diagnostic messages they produce.
587### See the INSTALL document's section on "make test".
4e4732c1 588SHRDLU_1
80ed0dea 589 warn <<'SHRDLU_2' if $good_files / $total_files > 0.8;
f7d228c6
JH
590### You have a good chance to get more information by running
591### ./perl harness
592### in the 't' directory since most (>=80%) of the tests succeeded.
4e4732c1 593SHRDLU_2
f458b6e8 594 if (eval {require Config; import Config; 1}) {
80ed0dea 595 if ($::Config{usedl} && (my $p = $::Config{ldlibpthname})) {
4e4732c1 596 warn <<SHRDLU_3;
f7d228c6
JH
597### You may have to set your dynamic library search path,
598### $p, to point to the build directory:
4e4732c1 599SHRDLU_3
f458b6e8 600 if (exists $ENV{$p} && $ENV{$p} ne '') {
4e4732c1 601 warn <<SHRDLU_4a;
f7d228c6
JH
602### setenv $p `pwd`:\$$p; cd t; ./perl harness
603### $p=`pwd`:\$$p; export $p; cd t; ./perl harness
604### export $p=`pwd`:\$$p; cd t; ./perl harness
4e4732c1 605SHRDLU_4a
f458b6e8 606 } else {
4e4732c1 607 warn <<SHRDLU_4b;
f7d228c6
JH
608### setenv $p `pwd`; cd t; ./perl harness
609### $p=`pwd`; export $p; cd t; ./perl harness
610### export $p=`pwd`; cd t; ./perl harness
4e4732c1 611SHRDLU_4b
f458b6e8 612 }
4e4732c1 613 warn <<SHRDLU_5;
f7d228c6
JH
614### for csh-style shells, like tcsh; or for traditional/modern
615### Bourne-style shells, like bash, ksh, and zsh, respectively.
4e4732c1 616SHRDLU_5
f458b6e8 617 }
afd33fa9 618 }
bb365837 619 }
80ed0dea 620 my ($user,$sys,$cuser,$csys) = times;
f47304e9 621 print sprintf("u=%.2f s=%.2f cu=%.2f cs=%.2f scripts=%d tests=%d\n",
80ed0dea 622 $user,$sys,$cuser,$csys,$tested_files,$totmax);
7a834142
JH
623 if ($ENV{PERL_VALGRIND}) {
624 my $s = $valgrind == 1 ? '' : 's';
625 print "$valgrind valgrind report$s created.\n", ;
626 }
6ee623d5 627}
80ed0dea 628exit ($::bad_files != 0);
ade55ef4
AL
629
630# ex: set ts=8 sts=4 sw=4 noet: