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 | $! Make the environment look a little friendlier to tests which assume Unix |
3b558104 |
52 | $ cat == "Type" |
ff0cee69 |
53 | $ Macro/NoDebug/NoList/Object=Echo.Obj Sys$Input |
a0d0e21e |
54 | .title echo |
55 | .psect data,wrt,noexe |
56 | dsc: |
57 | .word 0 |
58 | .byte 14 ; DSC$K_DTYPE_T |
59 | .byte 2 ; DSC$K_CLASS_D |
60 | .long 0 |
61 | .psect code,nowrt,exe |
62 | .entry echo,^m<r2,r3> |
63 | movab dsc,r2 |
64 | pushab (r2) |
65 | calls #1,G^LIB$GET_FOREIGN |
66 | movl 4(r2),r3 |
67 | movzwl (r2),r0 |
68 | addl2 4(r2),r0 |
69 | cmpl r3,r0 |
70 | bgtru sym.3 |
71 | nop |
72 | sym.1: |
73 | movb (r3),r0 |
74 | cmpb r0,#65 |
75 | blss sym.2 |
76 | cmpb r0,#90 |
77 | bgtr sym.2 |
78 | cvtbl r0,r0 |
79 | addl2 #32,r0 |
80 | cvtlb r0,(r3) |
81 | sym.2: |
82 | incl r3 |
83 | movzwl (r2),r0 |
84 | addl2 4(r2),r0 |
85 | cmpl r3,r0 |
86 | blequ sym.1 |
87 | sym.3: |
88 | pushab (r2) |
89 | calls #1,G^LIB$PUT_OUTPUT |
90 | movl #1,r0 |
91 | ret |
92 | .end echo |
59d8d783 |
93 | $ If F$Search("Echo.Exe").nes."" Then Delete/Log/NoConfirm Echo.Exe;* |
ff0cee69 |
94 | $ Link/NoMap/NoTrace/Exe=Echo.Exe Echo.Obj; |
a0d0e21e |
95 | $ Delete/Log/NoConfirm Echo.Obj;* |
3b558104 |
96 | $ echo == "$" + F$Parse("Echo.Exe") |
d9ae6319 |
97 | $! |
a0d0e21e |
98 | $! And do it |
09b7f37c |
99 | $ Show Process/Accounting |
e518068a |
100 | $ testdir = "Directory/NoHead/NoTrail/Column=1" |
746380c8 |
101 | $ PerlShr_filespec = f$parse("Sys$Disk:[-]''dbg'PerlShr''exe'") |
102 | $ Define 'dbg'Perlshr 'PerlShr_filespec' |
3eeba6fb |
103 | $ MCR Sys$Disk:[]Perl. "-I[-.lib]" - "''p3'" "''p4'" "''p5'" "''p6'" |
a0d0e21e |
104 | $ Deck/Dollar=$$END-OF-TEST$$ |
de5a37b2 |
105 | # $RCSfile: test.com,v $$Revision: 1.1 $$Date: 2001/12/05 06:53:37 $ |
bd3fa61c |
106 | # Modified for VMS 30-Sep-1994 Charles Bailey bailey@newman.upenn.edu |
a0d0e21e |
107 | # |
108 | # This is written in a peculiar style, since we're trying to avoid |
109 | # most of the constructs we'll be testing for. |
110 | |
111 | # skip those tests we know will fail entirely or cause perl to hang bacause |
271404a7 |
112 | # of Unixisms in the tests. (The Perl operators being tested may work fine, |
113 | # but the tests may use other operators which don't.) |
71be2cbc |
114 | use Config; |
cd4070af |
115 | use File::Spec; |
71be2cbc |
116 | |
a0d0e21e |
117 | $| = 1; |
118 | |
60e23f2f |
119 | # Let tests know they're running in the perl core. Useful for modules |
120 | # which live dual lives on CPAN. |
121 | $ENV{PERL_CORE} = 1; |
122 | |
34b5aed4 |
123 | @ARGV = grep($_,@ARGV); # remove empty elements due to "''p1'" syntax |
124 | |
61bb5906 |
125 | if (lc($ARGV[0]) eq '-v') { |
a0d0e21e |
126 | $verbose = 1; |
34b5aed4 |
127 | shift; |
128 | } |
a0d0e21e |
129 | |
130 | chdir 't' if -f 't/TEST'; |
131 | |
132 | if ($ARGV[0] eq '') { |
91af766a |
133 | foreach (<[.*]*.t>, <[-.ext...]*.t>, <[-.lib...]*.t>) { |
cd4070af |
134 | $_ = File::Spec->abs2rel($_); |
135 | s/\[([a-z]+)/[.$1/; # hmm, abs2rel doesn't do subdirs of the cwd |
34b5aed4 |
136 | ($fname = $_) =~ s/.*\]//; |
de5a37b2 |
137 | push(@ARGV,$_); |
a0d0e21e |
138 | } |
139 | } |
140 | |
a0d0e21e |
141 | $bad = 0; |
142 | $good = 0; |
d9ae6319 |
143 | $extra_skip = 0; |
a0d0e21e |
144 | $total = @ARGV; |
145 | while ($test = shift) { |
146 | if ($test =~ /^$/) { |
147 | next; |
148 | } |
149 | $te = $test; |
150 | chop($te); |
cd4070af |
151 | $te .= '.' x (40 - length($te)); |
a0d0e21e |
152 | open(script,"$test") || die "Can't run $test.\n"; |
153 | $_ = <script>; |
154 | close(script); |
155 | if (/#!..perl(.*)/) { |
156 | $switch = $1; |
55497cff |
157 | # Add "" to protect uppercase switches on command line |
44a8e56a |
158 | $switch =~ s/-(\S*[A-Z]\S*)/"-$1"/g; |
a0d0e21e |
159 | } else { |
160 | $switch = ''; |
161 | } |
9428117f |
162 | open(results,"\$ MCR Sys\$Disk:[]Perl. \"-I[-.lib]\" $switch $test 2>&1|") || (print "can't run.\n"); |
a0d0e21e |
163 | $ok = 0; |
164 | $next = 0; |
3eeba6fb |
165 | $pending_not = 0; |
a0d0e21e |
166 | while (<results>) { |
167 | if ($verbose) { |
34b5aed4 |
168 | print "$te$_"; |
169 | $te = ''; |
a0d0e21e |
170 | } |
171 | unless (/^#/) { |
6c750130 |
172 | if (/^1\.\.([0-9]+)( todo ([\d ]+))?/) { |
a0d0e21e |
173 | $max = $1; |
6c750130 |
174 | %todo = map { $_ => 1 } split / /, $3 if $3; |
a0d0e21e |
175 | $totmax += $max; |
176 | $files += 1; |
177 | $next = 1; |
178 | $ok = 1; |
179 | } else { |
6c750130 |
180 | # our 'echo' substitute produces one more \n than Unix' |
181 | next if /^\s*$/; |
182 | |
183 | |
e617780b |
184 | if (/^(not )?ok (\d+)[^#]*(\s*#.*)?/ && |
6c750130 |
185 | $2 == $next) |
186 | { |
187 | my($not, $num, $extra) = ($1, $2, $3); |
188 | my($istodo) = $extra =~ /^\s*#\s*TODO/ if $extra; |
189 | $istodo = 1 if $todo{$num}; |
190 | |
191 | if( $not && !$istodo ) { |
192 | $ok = 0; |
193 | $next = $num; |
194 | last; |
195 | } |
196 | elsif( $pending_not ) { |
197 | $next = $num; |
198 | $ok = 0; |
199 | } |
200 | else { |
201 | $next = $next + 1; |
202 | } |
203 | } |
204 | elsif(/^not $/) { |
205 | # VMS has this problem. It sometimes adds newlines |
206 | # between prints. This sometimes means you get |
207 | # "not \nok 42" |
208 | $pending_not = 1; |
209 | } |
210 | elsif (/^Bail out!\s*(.*)/i) { # magic words |
211 | die "FAILED--Further testing stopped" . ($1 ? ": $1\n" : ".\n"); |
a0d0e21e |
212 | } |
6c750130 |
213 | else { |
214 | $ok = 0; |
215 | } |
216 | |
a0d0e21e |
217 | } |
218 | } |
219 | } |
220 | $next = $next - 1; |
221 | if ($ok && $next == $max) { |
271404a7 |
222 | if ($max) { |
223 | print "${te}ok\n"; |
224 | $good = $good + 1; |
225 | } else { |
226 | print "${te}skipping test on this platform\n"; |
227 | $files -= 1; |
d9ae6319 |
228 | $extra_skip = $extra_skip + 1; |
271404a7 |
229 | } |
a0d0e21e |
230 | } else { |
231 | $next += 1; |
34b5aed4 |
232 | print "${te}FAILED on test $next\n"; |
a0d0e21e |
233 | $bad = $bad + 1; |
234 | $_ = $test; |
235 | if (/^base/) { |
236 | die "Failed a basic test--cannot continue.\n"; |
237 | } |
238 | } |
239 | } |
240 | |
241 | if ($bad == 0) { |
242 | if ($ok) { |
243 | print "All tests successful.\n"; |
244 | } else { |
245 | die "FAILED--no tests were run for some reason.\n"; |
246 | } |
247 | } else { |
d9ae6319 |
248 | # $pct = sprintf("%.2f", $good / $total * 100); |
249 | $gtotal = $total - $extra_skip; |
250 | if ($gtotal <= 0) { $gtotal = $total; } |
251 | $pct = sprintf("%.2f", $good / $gtotal * 100); |
a0d0e21e |
252 | if ($bad == 1) { |
253 | warn "Failed 1 test, $pct% okay.\n"; |
d9ae6319 |
254 | } else { |
255 | if ($extra_skip > 0) { |
256 | warn "Total tests: $total, Passed $good, Skipped $extra_skip.\n"; |
257 | warn "Failed $bad/$gtotal tests, $pct% okay.\n"; |
258 | } |
259 | else { |
260 | warn "Total tests: $total, Passed $good.\n"; |
261 | warn "Failed $bad/$gtotal tests, $pct% okay.\n"; |
262 | } |
a0d0e21e |
263 | } |
264 | } |
265 | ($user,$sys,$cuser,$csys) = times; |
c04215f0 |
266 | print sprintf("u=%g s=%g cu=%g cs=%g scripts=%d tests=%d\n", |
a0d0e21e |
267 | $user,$sys,$cuser,$csys,$files,$totmax); |
268 | $$END-OF-TEST$$ |
269 | $ wrapup: |
23724483 |
270 | $ deassign 'dbg'Perlshr |
09b7f37c |
271 | $ Show Process/Accounting |
e518068a |
272 | $ Set Default &olddef |
84902520 |
273 | $ Set Message 'oldmsg' |
a0d0e21e |
274 | $ Exit |