Commit | Line | Data |
a5f75d66 |
1 | #!./perl |
2 | |
3 | # We suppose that perl _mostly_ works at this moment, so may use |
4 | # sophisticated testing. |
5 | |
aa689395 |
6 | BEGIN { |
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 |
12 | use 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 | |
37 | foreach (keys %datahandle) { |
38 | unlink "$_.t"; |
39 | } |
40 | |
122a0375 |
41 | my @tests = (); |
42 | |
7a315204 |
43 | if (@ARGV) { |
44 | @tests = @ARGV; |
45 | } else { |
b695f709 |
46 | unless (@tests) { |
122a0375 |
47 | push @tests, <base/*.t>; |
48 | push @tests, <comp/*.t>; |
49 | push @tests, <cmd/*.t>; |
50 | push @tests, <run/*.t>; |
51 | push @tests, <io/*.t>; |
52 | push @tests, <op/*.t>; |
53 | push @tests, <lib/*.t>; |
b695f709 |
54 | use File::Spec; |
55 | my $updir = File::Spec->updir; |
122a0375 |
56 | my $mani = File::Spec->catfile(File::Spec->updir, "MANIFEST"); |
b695f709 |
57 | if (open(MANI, $mani)) { |
58 | while (<MANI>) { # similar code in t/TEST |
59 | if (m!^(ext/\S+/([^/]+\.t|test\.pl)|lib/\S+?(\.t|test\.pl))\s!) { |
122a0375 |
60 | push @tests, File::Spec->catfile($updir, $1); |
b695f709 |
61 | } |
7a315204 |
62 | } |
b695f709 |
63 | } else { |
64 | warn "$0: cannot open $mani: $!\n"; |
7a315204 |
65 | } |
b695f709 |
66 | push @tests, <pod/*.t>; |
7a315204 |
67 | } |
68 | } |
52cebf5e |
69 | |
a5f75d66 |
70 | Test::Harness::runtests @tests; |
56eca212 |
71 | exit(0) unless -e "../testcompile"; |
72 | |
e4f0d88d |
73 | # %infinite = qw ( |
74 | # op/bop.t 1 |
75 | # lib/hostname.t 1 |
76 | # op/lex_assign.t 1 |
595ae481 |
77 | # lib/ph.t 1 |
e4f0d88d |
78 | # ); |
56eca212 |
79 | |
80 | my $dhwrapper = <<'EOT'; |
81 | open DATA,"<".__FILE__; |
82 | until (($_=<DATA>) =~ /^__END__/) {}; |
83 | EOT |
52cebf5e |
84 | |
85 | @tests = grep (!$infinite{$_}, @tests); |
56eca212 |
86 | @tests = map { |
ef712cf7 |
87 | my $new = $_; |
adac82c7 |
88 | if ($datahandle{$_} && !( -f "$new.t") ) { |
ef712cf7 |
89 | $new .= '.t'; |
90 | local(*F, *T); |
91 | open(F,"<$_") or die "Can't open $_: $!"; |
92 | open(T,">$new") or die "Can't open $new: $!"; |
93 | print T $dhwrapper, <F>; |
94 | close F; |
95 | close T; |
96 | } |
97 | $new; |
98 | } @tests; |
99 | |
100 | print "The tests ", join(' ', keys(%infinite)), |
101 | " generate infinite loops! Skipping!\n"; |
102 | |
595ae481 |
103 | $ENV{'HARNESS_COMPILE_TEST'} = 1; |
9636a016 |
104 | $ENV{'PERLCC_TIMEOUT'} = 120 unless $ENV{'PERLCC_TIMEOUT'}; |
ef712cf7 |
105 | |
595ae481 |
106 | Test::Harness::runtests @tests; |
56eca212 |
107 | foreach (keys %datahandle) { |
108 | unlink "$_.t"; |
52cebf5e |
109 | } |