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'; |
93430cb4 |
8 | unshift @INC, '../lib'; |
cf8a9db4 |
9 | $ENV{PERL5LIB} = '../lib'; # so children will see it too |
aa689395 |
10 | } |
a5f75d66 |
11 | use lib '../lib'; |
aa689395 |
12 | |
a5f75d66 |
13 | use Test::Harness; |
14 | |
15 | $Test::Harness::switches = ""; # Too much noise otherwise |
90ce63d5 |
16 | $Test::Harness::verbose = shift if @ARGV && $ARGV[0] eq '-v'; |
a5f75d66 |
17 | |
18 | @tests = @ARGV; |
68dc0745 |
19 | @tests = <base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t lib/*.t> unless @tests; |
52cebf5e |
20 | |
a5f75d66 |
21 | Test::Harness::runtests @tests; |
56eca212 |
22 | exit(0) unless -e "../testcompile"; |
23 | |
24 | %infinite = qw( |
25 | op/bop.t 1 |
26 | lib/hostname.t 1 |
27 | ); |
28 | #fudge DATA for now. |
29 | %datahandle = qw( |
30 | lib/bigint.t 1 |
31 | lib/bigintpm.t 1 |
32 | lib/bigfloat.t 1 |
33 | lib/bigfloatpm.t 1 |
34 | ); |
35 | |
36 | my $dhwrapper = <<'EOT'; |
37 | open DATA,"<".__FILE__; |
38 | until (($_=<DATA>) =~ /^__END__/) {}; |
39 | EOT |
52cebf5e |
40 | |
41 | @tests = grep (!$infinite{$_}, @tests); |
56eca212 |
42 | @tests = map { |
43 | my $new = $_; |
44 | if ($datahandle{$_}) { |
45 | $new .= '.t'; |
46 | local(*F, *T); |
47 | open(F,"<$_") or die "Can't open $_: $!"; |
48 | open(T,">$new") or die "Can't open $new: $!"; |
49 | print T $dhwrapper, <F>; |
50 | close F; |
51 | close T; |
52 | } |
53 | $new; |
54 | } @tests; |
55 | |
56 | print "The tests ", join(' ', keys(%infinite)), |
57 | " generate infinite loops! Skipping!\n"; |
58 | $ENV{'COMPILE_TEST'} = 1; Test::Harness::runtests @tests; |
59 | foreach (keys %datahandle) { |
60 | unlink "$_.t"; |
52cebf5e |
61 | } |