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