This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Documenting coderef @INC (Re: CPAN "make this script work" feature)
[perl5.git] / t / harness
CommitLineData
a5f75d66
AD
1#!./perl
2
3# We suppose that perl _mostly_ works at this moment, so may use
4# sophisticated testing.
5
aa689395
PP
6BEGIN {
7 chdir 't' if -d 't';
93430cb4 8 unshift @INC, '../lib';
ef712cf7 9 $ENV{PERL5LIB} = '../lib'; # so children will see it too
aa689395 10}
a5f75d66 11use lib '../lib';
aa689395 12
a5f75d66
AD
13use Test::Harness;
14
ef712cf7 15$Test::Harness::switches = ""; # Too much noise otherwise
90ce63d5 16$Test::Harness::verbose = shift if @ARGV && $ARGV[0] eq '-v';
a5f75d66 17
0ca04487
VB
18#fudge DATA for now.
19%datahandle = qw(
20 lib/bigint.t 1
21 lib/bigintpm.t 1
22 lib/bigfloat.t 1
23 lib/bigfloatpm.t 1
24 op/gv.t 1
25 lib/complex.t 1
26 lib/ph.t 1
27 lib/soundex.t 1
28 op/misc.t 1
29 op/runlevel.t 1
30 op/tie.t 1
31 op/lex_assign.t 1
32 pragma/subs.t 1
33 );
34
35foreach (keys %datahandle) {
36 unlink "$_.t";
37}
38
a5f75d66 39@tests = @ARGV;
04c8f6e4 40@tests = <base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t lib/*.t> unless @tests;
52cebf5e 41
a5f75d66 42Test::Harness::runtests @tests;
56eca212
GS
43exit(0) unless -e "../testcompile";
44
ef712cf7 45%infinite = qw (
0ca04487
VB
46 op/bop.t 1
47 lib/hostname.t 1
48 op/lex_assign.t 1
49 lib/ph.t 1
ef712cf7 50 );
56eca212
GS
51
52my $dhwrapper = <<'EOT';
53open DATA,"<".__FILE__;
54until (($_=<DATA>) =~ /^__END__/) {};
55EOT
52cebf5e
EP
56
57@tests = grep (!$infinite{$_}, @tests);
56eca212 58@tests = map {
ef712cf7 59 my $new = $_;
adac82c7 60 if ($datahandle{$_} && !( -f "$new.t") ) {
ef712cf7
EP
61 $new .= '.t';
62 local(*F, *T);
63 open(F,"<$_") or die "Can't open $_: $!";
64 open(T,">$new") or die "Can't open $new: $!";
65 print T $dhwrapper, <F>;
66 close F;
67 close T;
68 }
69 $new;
70 } @tests;
71
72print "The tests ", join(' ', keys(%infinite)),
73 " generate infinite loops! Skipping!\n";
74
9636a016
GS
75$ENV{'HARNESS_COMPILE_TEST'} = 1;
76$ENV{'PERLCC_TIMEOUT'} = 120 unless $ENV{'PERLCC_TIMEOUT'};
ef712cf7
EP
77
78Test::Harness::runtests @tests;
56eca212
GS
79foreach (keys %datahandle) {
80 unlink "$_.t";
52cebf5e 81}