Commit | Line | Data |
a0d0e21e |
1 | $! Test.Com - DCL driver for perl5 regression tests |
2 | $! |
e518068a |
3 | $! Version 1.1 4-Dec-1995 |
bd3fa61c |
4 | $! Charles Bailey bailey@newman.upenn.edu |
d9ae6319 |
5 | $! |
a0d0e21e |
6 | $! A little basic setup |
7 | $ On Error Then Goto wrapup |
e518068a |
8 | $ olddef = F$Environment("Default") |
84902520 |
9 | $ oldmsg = F$Environment("Message") |
e518068a |
10 | $ If F$Search("t.dir").nes."" |
11 | $ Then |
12 | $ Set Default [.t] |
13 | $ Else |
14 | $ If F$TrnLNm("Perl_Root").nes."" |
15 | $ Then |
16 | $ Set Default Perl_Root:[t] |
17 | $ Else |
18 | $ Write Sys$Error "Can't find test directory" |
19 | $ Exit 44 |
20 | $ EndIf |
21 | $ EndIf |
93d6612c |
22 | $ Set Message /NoFacility/NoSeverity/NoIdentification/NoText |
d9ae6319 |
23 | $! |
491527d0 |
24 | $ exe = ".Exe" |
25 | $ If p1.nes."" Then exe = p1 |
26 | $ If F$Extract(0,1,exe) .nes. "." |
27 | $ Then |
28 | $ Write Sys$Error "" |
29 | $ Write Sys$Error "The first parameter passed to Test.Com must be the file type used for the" |
30 | $ Write Sys$Error "images produced when you built Perl (i.e. "".Exe"", unless you edited" |
31 | $ Write Sys$Error "Descrip.MMS or used the AXE=1 macro in the MM[SK] command line." |
32 | $ Write Sys$Error "" |
33 | $ Exit 44 |
34 | $ EndIf |
3eeba6fb |
35 | $! |
36 | $! "debug" perl if second parameter is nonblank |
37 | $! |
38 | $ dbg = "" |
39 | $ ndbg = "" |
40 | $ if p2.nes."" then dbg = "dbg" |
41 | $ if p2.nes."" then ndbg = "ndbg" |
42 | $! |
a0d0e21e |
43 | $! Pick up a copy of perl to use for the tests |
8713643e |
44 | $ If F$Search("Perl.").nes."" Then Delete/Log/NoConfirm Perl.;* |
3eeba6fb |
45 | $ Copy/Log/NoConfirm [-]'ndbg'Perl'exe' []Perl. |
59d8d783 |
46 | $! |
47 | $! Pick up a copy of vmspipe.com to use for the tests |
48 | $ If F$Search("VMSPIPE.COM").nes."" then Delete/Log/Noconfirm VMSPIPE.COM;* |
49 | $ Copy/Log/NoConfirm [-]VMSPIPE.COM [] |
50 | $! |
a0d0e21e |
51 | $! And do it |
09b7f37c |
52 | $ Show Process/Accounting |
e518068a |
53 | $ testdir = "Directory/NoHead/NoTrail/Column=1" |
746380c8 |
54 | $ PerlShr_filespec = f$parse("Sys$Disk:[-]''dbg'PerlShr''exe'") |
55 | $ Define 'dbg'Perlshr 'PerlShr_filespec' |
b6345914 |
56 | $ if f$mode() .nes. "INTERACTIVE" then Define PERL_SKIP_TTY_TEST 1 |
3eeba6fb |
57 | $ MCR Sys$Disk:[]Perl. "-I[-.lib]" - "''p3'" "''p4'" "''p5'" "''p6'" |
a0d0e21e |
58 | $ Deck/Dollar=$$END-OF-TEST$$ |
a0d0e21e |
59 | # |
b6345914 |
60 | # The bulk of the below code is scheduled for deletion. test.com |
61 | # will shortly use t/TEST. |
62 | # |
a0d0e21e |
63 | |
71be2cbc |
64 | use Config; |
cd4070af |
65 | use File::Spec; |
71be2cbc |
66 | |
a0d0e21e |
67 | $| = 1; |
68 | |
60e23f2f |
69 | # Let tests know they're running in the perl core. Useful for modules |
70 | # which live dual lives on CPAN. |
71 | $ENV{PERL_CORE} = 1; |
72 | |
34b5aed4 |
73 | @ARGV = grep($_,@ARGV); # remove empty elements due to "''p1'" syntax |
74 | |
61bb5906 |
75 | if (lc($ARGV[0]) eq '-v') { |
a0d0e21e |
76 | $verbose = 1; |
34b5aed4 |
77 | shift; |
78 | } |
a0d0e21e |
79 | |
80 | chdir 't' if -f 't/TEST'; |
81 | |
82 | if ($ARGV[0] eq '') { |
91af766a |
83 | foreach (<[.*]*.t>, <[-.ext...]*.t>, <[-.lib...]*.t>) { |
cd4070af |
84 | $_ = File::Spec->abs2rel($_); |
85 | s/\[([a-z]+)/[.$1/; # hmm, abs2rel doesn't do subdirs of the cwd |
34b5aed4 |
86 | ($fname = $_) =~ s/.*\]//; |
de5a37b2 |
87 | push(@ARGV,$_); |
a0d0e21e |
88 | } |
89 | } |
90 | |
a0d0e21e |
91 | $bad = 0; |
92 | $good = 0; |
d9ae6319 |
93 | $extra_skip = 0; |
a0d0e21e |
94 | $total = @ARGV; |
95 | while ($test = shift) { |
96 | if ($test =~ /^$/) { |
97 | next; |
98 | } |
99 | $te = $test; |
100 | chop($te); |
cd4070af |
101 | $te .= '.' x (40 - length($te)); |
a0d0e21e |
102 | open(script,"$test") || die "Can't run $test.\n"; |
103 | $_ = <script>; |
104 | close(script); |
105 | if (/#!..perl(.*)/) { |
106 | $switch = $1; |
55497cff |
107 | # Add "" to protect uppercase switches on command line |
44a8e56a |
108 | $switch =~ s/-(\S*[A-Z]\S*)/"-$1"/g; |
a0d0e21e |
109 | } else { |
110 | $switch = ''; |
111 | } |
9428117f |
112 | open(results,"\$ MCR Sys\$Disk:[]Perl. \"-I[-.lib]\" $switch $test 2>&1|") || (print "can't run.\n"); |
a0d0e21e |
113 | $ok = 0; |
114 | $next = 0; |
3eeba6fb |
115 | $pending_not = 0; |
a0d0e21e |
116 | while (<results>) { |
117 | if ($verbose) { |
34b5aed4 |
118 | print "$te$_"; |
119 | $te = ''; |
a0d0e21e |
120 | } |
121 | unless (/^#/) { |
6c750130 |
122 | if (/^1\.\.([0-9]+)( todo ([\d ]+))?/) { |
a0d0e21e |
123 | $max = $1; |
6c750130 |
124 | %todo = map { $_ => 1 } split / /, $3 if $3; |
a0d0e21e |
125 | $totmax += $max; |
126 | $files += 1; |
127 | $next = 1; |
128 | $ok = 1; |
129 | } else { |
6c750130 |
130 | # our 'echo' substitute produces one more \n than Unix' |
131 | next if /^\s*$/; |
132 | |
133 | |
e617780b |
134 | if (/^(not )?ok (\d+)[^#]*(\s*#.*)?/ && |
6c750130 |
135 | $2 == $next) |
136 | { |
137 | my($not, $num, $extra) = ($1, $2, $3); |
138 | my($istodo) = $extra =~ /^\s*#\s*TODO/ if $extra; |
139 | $istodo = 1 if $todo{$num}; |
140 | |
141 | if( $not && !$istodo ) { |
142 | $ok = 0; |
143 | $next = $num; |
144 | last; |
145 | } |
146 | elsif( $pending_not ) { |
147 | $next = $num; |
148 | $ok = 0; |
149 | } |
150 | else { |
151 | $next = $next + 1; |
152 | } |
153 | } |
154 | elsif(/^not $/) { |
155 | # VMS has this problem. It sometimes adds newlines |
156 | # between prints. This sometimes means you get |
157 | # "not \nok 42" |
158 | $pending_not = 1; |
159 | } |
160 | elsif (/^Bail out!\s*(.*)/i) { # magic words |
161 | die "FAILED--Further testing stopped" . ($1 ? ": $1\n" : ".\n"); |
a0d0e21e |
162 | } |
6c750130 |
163 | else { |
164 | $ok = 0; |
165 | } |
166 | |
a0d0e21e |
167 | } |
168 | } |
169 | } |
170 | $next = $next - 1; |
171 | if ($ok && $next == $max) { |
271404a7 |
172 | if ($max) { |
173 | print "${te}ok\n"; |
174 | $good = $good + 1; |
175 | } else { |
176 | print "${te}skipping test on this platform\n"; |
177 | $files -= 1; |
d9ae6319 |
178 | $extra_skip = $extra_skip + 1; |
271404a7 |
179 | } |
a0d0e21e |
180 | } else { |
181 | $next += 1; |
34b5aed4 |
182 | print "${te}FAILED on test $next\n"; |
a0d0e21e |
183 | $bad = $bad + 1; |
184 | $_ = $test; |
185 | if (/^base/) { |
186 | die "Failed a basic test--cannot continue.\n"; |
187 | } |
188 | } |
189 | } |
190 | |
191 | if ($bad == 0) { |
192 | if ($ok) { |
193 | print "All tests successful.\n"; |
194 | } else { |
195 | die "FAILED--no tests were run for some reason.\n"; |
196 | } |
197 | } else { |
d9ae6319 |
198 | # $pct = sprintf("%.2f", $good / $total * 100); |
199 | $gtotal = $total - $extra_skip; |
200 | if ($gtotal <= 0) { $gtotal = $total; } |
201 | $pct = sprintf("%.2f", $good / $gtotal * 100); |
a0d0e21e |
202 | if ($bad == 1) { |
203 | warn "Failed 1 test, $pct% okay.\n"; |
d9ae6319 |
204 | } else { |
205 | if ($extra_skip > 0) { |
206 | warn "Total tests: $total, Passed $good, Skipped $extra_skip.\n"; |
207 | warn "Failed $bad/$gtotal tests, $pct% okay.\n"; |
208 | } |
209 | else { |
210 | warn "Total tests: $total, Passed $good.\n"; |
211 | warn "Failed $bad/$gtotal tests, $pct% okay.\n"; |
212 | } |
a0d0e21e |
213 | } |
214 | } |
215 | ($user,$sys,$cuser,$csys) = times; |
c04215f0 |
216 | print sprintf("u=%g s=%g cu=%g cs=%g scripts=%d tests=%d\n", |
a0d0e21e |
217 | $user,$sys,$cuser,$csys,$files,$totmax); |
218 | $$END-OF-TEST$$ |
219 | $ wrapup: |
23724483 |
220 | $ deassign 'dbg'Perlshr |
09b7f37c |
221 | $ Show Process/Accounting |
e518068a |
222 | $ Set Default &olddef |
84902520 |
223 | $ Set Message 'oldmsg' |
a0d0e21e |
224 | $ Exit |