Go on record about the binary backward incompatibility.
[p5sagit/p5-mst-13.2.git] / t / harness
CommitLineData
a5f75d66 1#!./perl
2
3# We suppose that perl _mostly_ works at this moment, so may use
4# sophisticated testing.
5
aa689395 6BEGIN {
7 chdir 't' if -d 't';
122a0375 8 @INC = '../lib'; # pick up only this build's lib
ef712cf7 9 $ENV{PERL5LIB} = '../lib'; # so children will see it too
aa689395 10}
aa689395 11
a5f75d66 12use Test::Harness;
13
ef712cf7 14$Test::Harness::switches = ""; # Too much noise otherwise
90ce63d5 15$Test::Harness::verbose = shift if @ARGV && $ARGV[0] eq '-v';
a5f75d66 16
60e23f2f 17# Let tests know they're running in the perl core. Useful for modules
18# which live dual lives on CPAN.
19$ENV{PERL_CORE} = 1;
20
0ca04487 21#fudge DATA for now.
22%datahandle = qw(
23 lib/bigint.t 1
24 lib/bigintpm.t 1
25 lib/bigfloat.t 1
26 lib/bigfloatpm.t 1
27 op/gv.t 1
28 lib/complex.t 1
29 lib/ph.t 1
30 lib/soundex.t 1
31 op/misc.t 1
32 op/runlevel.t 1
33 op/tie.t 1
34 op/lex_assign.t 1
0ca04487 35 );
36
37foreach (keys %datahandle) {
38 unlink "$_.t";
39}
40
122a0375 41my @tests = ();
42
7a315204 43if (@ARGV) {
4efb34a6 44 if ($^O eq 'MSWin32') {
45 @tests = map(glob($_),@ARGV);
46 }
47 else {
48 @tests = @ARGV;
49 }
7a315204 50} else {
b695f709 51 unless (@tests) {
122a0375 52 push @tests, <base/*.t>;
53 push @tests, <comp/*.t>;
54 push @tests, <cmd/*.t>;
55 push @tests, <run/*.t>;
56 push @tests, <io/*.t>;
57 push @tests, <op/*.t>;
37fca15e 58 push @tests, <uni/*.t>;
122a0375 59 push @tests, <lib/*.t>;
bb27e7b6 60 push @tests, <win32/*.t> if $^O eq 'MSWin32';
b695f709 61 use File::Spec;
62 my $updir = File::Spec->updir;
122a0375 63 my $mani = File::Spec->catfile(File::Spec->updir, "MANIFEST");
b695f709 64 if (open(MANI, $mani)) {
65 while (<MANI>) { # similar code in t/TEST
66 if (m!^(ext/\S+/([^/]+\.t|test\.pl)|lib/\S+?(\.t|test\.pl))\s!) {
122a0375 67 push @tests, File::Spec->catfile($updir, $1);
b695f709 68 }
7a315204 69 }
b695f709 70 } else {
71 warn "$0: cannot open $mani: $!\n";
7a315204 72 }
b695f709 73 push @tests, <pod/*.t>;
7a315204 74 }
75}
52cebf5e 76
a5f75d66 77Test::Harness::runtests @tests;
56eca212 78exit(0) unless -e "../testcompile";
79
e4f0d88d 80# %infinite = qw (
81# op/bop.t 1
82# lib/hostname.t 1
83# op/lex_assign.t 1
595ae481 84# lib/ph.t 1
e4f0d88d 85# );
56eca212 86
87my $dhwrapper = <<'EOT';
88open DATA,"<".__FILE__;
89until (($_=<DATA>) =~ /^__END__/) {};
90EOT
52cebf5e 91
92@tests = grep (!$infinite{$_}, @tests);
56eca212 93@tests = map {
ef712cf7 94 my $new = $_;
adac82c7 95 if ($datahandle{$_} && !( -f "$new.t") ) {
ef712cf7 96 $new .= '.t';
97 local(*F, *T);
98 open(F,"<$_") or die "Can't open $_: $!";
99 open(T,">$new") or die "Can't open $new: $!";
100 print T $dhwrapper, <F>;
101 close F;
102 close T;
103 }
104 $new;
105 } @tests;
106
107print "The tests ", join(' ', keys(%infinite)),
108 " generate infinite loops! Skipping!\n";
109
595ae481 110$ENV{'HARNESS_COMPILE_TEST'} = 1;
9636a016 111$ENV{'PERLCC_TIMEOUT'} = 120 unless $ENV{'PERLCC_TIMEOUT'};
ef712cf7 112
595ae481 113Test::Harness::runtests @tests;
56eca212 114foreach (keys %datahandle) {
115 unlink "$_.t";
52cebf5e 116}