INSTALL patches
[p5sagit/p5-mst-13.2.git] / vms / test.com
CommitLineData
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
a0d0e21e 5$
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
84902520 22$ Set Message /Facility/Severity/Identification/Text
a0d0e21e 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
a0d0e21e 35$! Pick up a copy of perl to use for the tests
36$ Delete/Log/NoConfirm Perl.;*
271404a7 37$ Copy/Log/NoConfirm [-]Perl'exe' []Perl.
a0d0e21e 38$
39$! Make the environment look a little friendlier to tests which assume Unix
40$ cat = "Type"
ff0cee69 41$ Macro/NoDebug/NoList/Object=Echo.Obj Sys$Input
a0d0e21e 42 .title echo
43 .psect data,wrt,noexe
44 dsc:
45 .word 0
46 .byte 14 ; DSC$K_DTYPE_T
47 .byte 2 ; DSC$K_CLASS_D
48 .long 0
49 .psect code,nowrt,exe
50 .entry echo,^m<r2,r3>
51 movab dsc,r2
52 pushab (r2)
53 calls #1,G^LIB$GET_FOREIGN
54 movl 4(r2),r3
55 movzwl (r2),r0
56 addl2 4(r2),r0
57 cmpl r3,r0
58 bgtru sym.3
59 nop
60 sym.1:
61 movb (r3),r0
62 cmpb r0,#65
63 blss sym.2
64 cmpb r0,#90
65 bgtr sym.2
66 cvtbl r0,r0
67 addl2 #32,r0
68 cvtlb r0,(r3)
69 sym.2:
70 incl r3
71 movzwl (r2),r0
72 addl2 4(r2),r0
73 cmpl r3,r0
74 blequ sym.1
75 sym.3:
76 pushab (r2)
77 calls #1,G^LIB$PUT_OUTPUT
78 movl #1,r0
79 ret
80 .end echo
ff0cee69 81$ Link/NoMap/NoTrace/Exe=Echo.Exe Echo.Obj;
a0d0e21e 82$ Delete/Log/NoConfirm Echo.Obj;*
748a9306 83$ echo = "$" + F$Parse("Echo.Exe")
a0d0e21e 84$
85$! And do it
09b7f37c 86$ Show Process/Accounting
e518068a 87$ testdir = "Directory/NoHead/NoTrail/Column=1"
271404a7 88$ Define/User Perlshr Sys$Disk:[-]PerlShr'exe'
44a8e56a 89$ MCR Sys$Disk:[]Perl. "-I[-.lib]" - "''p2'" "''p3'" "''p4'" "''p5'" "''p6'"
a0d0e21e 90$ Deck/Dollar=$$END-OF-TEST$$
91# $RCSfile: TEST,v $$Revision: 4.1 $$Date: 92/08/07 18:27:00 $
bd3fa61c 92# Modified for VMS 30-Sep-1994 Charles Bailey bailey@newman.upenn.edu
a0d0e21e 93#
94# This is written in a peculiar style, since we're trying to avoid
95# most of the constructs we'll be testing for.
96
97# skip those tests we know will fail entirely or cause perl to hang bacause
271404a7 98# of Unixisms in the tests. (The Perl operators being tested may work fine,
99# but the tests may use other operators which don't.)
71be2cbc 100use Config;
101
84902520 102@compexcl=('cpp.t');
103a9d15 103@ioexcl=('argv.t','dup.t','fs.t','pipe.t');
bf99883d 104@libexcl=('db-btree.t','db-hash.t','db-recno.t',
562a7b0c 105 'gdbm.t','io_dup.t', 'io_pipe.t', 'io_poll.t', 'io_sel.t',
106 'io_sock.t', 'io_unix.t',
09b7f37c 107 'ndbm.t','odbm.t','open2.t','open3.t', 'ph.t', 'posix.t');
71be2cbc 108
109# Note: POSIX is not part of basic build, but can be built
110# separately if you're using DECC
111# io_xs.t tests the new_tmpfile routine, which doesn't work with the
112# VAXCRTL, since the file can't be stat()d, an Perl's do_open()
113# insists on stat()ing a file descriptor before it'll use it.
114push(@libexcl,'io_xs.t') if $Config{'vms_cc_type'} ne 'decc';
115
491527d0 116@opexcl=('die_exit.t','exec.t','fork.t','glob.t','groups.t','magic.t','misc.t','stat.t');
a0d0e21e 117@exclist=(@compexcl,@ioexcl,@libexcl,@opexcl);
118foreach $file (@exclist) { $skip{$file}++; }
119
120$| = 1;
121
34b5aed4 122@ARGV = grep($_,@ARGV); # remove empty elements due to "''p1'" syntax
123
61bb5906 124if (lc($ARGV[0]) eq '-v') {
a0d0e21e 125 $verbose = 1;
34b5aed4 126 shift;
127}
a0d0e21e 128
129chdir 't' if -f 't/TEST';
130
131if ($ARGV[0] eq '') {
34b5aed4 132 foreach (<[.*]*.t>) {
133 s/.*[\[.]t./[./;
134 ($fname = $_) =~ s/.*\]//;
a0d0e21e 135 if ($skip{"\L$fname"}) { push(@skipped,$_); }
136 else { push(@ARGV,$_); }
137 }
138}
139
140if (@skipped) {
141 print "The following tests were skipped because they rely extensively on\n";
142 print " Unixisms not compatible with the current version of perl for VMS:\n";
34b5aed4 143 print "\t",join("\n\t",@skipped),"\n\n";
a0d0e21e 144}
145
146$bad = 0;
147$good = 0;
148$total = @ARGV;
149while ($test = shift) {
150 if ($test =~ /^$/) {
151 next;
152 }
153 $te = $test;
154 chop($te);
34b5aed4 155 $te .= '.' x (24 - length($te));
a0d0e21e 156 open(script,"$test") || die "Can't run $test.\n";
157 $_ = <script>;
158 close(script);
159 if (/#!..perl(.*)/) {
160 $switch = $1;
55497cff 161 # Add "" to protect uppercase switches on command line
44a8e56a 162 $switch =~ s/-(\S*[A-Z]\S*)/"-$1"/g;
a0d0e21e 163 } else {
164 $switch = '';
165 }
b2b3adea 166 open(results,"\$ MCR Sys\$Disk:[]Perl. \"-I[-.lib]\" $switch $test |") || (print "can't run.\n");
a0d0e21e 167 $ok = 0;
168 $next = 0;
169 while (<results>) {
170 if ($verbose) {
34b5aed4 171 print "$te$_";
172 $te = '';
a0d0e21e 173 }
174 unless (/^#/) {
175 if (/^1\.\.([0-9]+)/) {
176 $max = $1;
177 $totmax += $max;
178 $files += 1;
179 $next = 1;
180 $ok = 1;
181 } else {
182 $next = $1, $ok = 0, last if /^not ok ([0-9]*)/;
183 next if /^\s*$/; # our 'echo' substitute produces one more \n than Unix'
184 if (/^ok (.*)/ && $1 == $next) {
185 $next = $next + 1;
186 } else {
187 $ok = 0;
188 }
189 }
190 }
191 }
192 $next = $next - 1;
193 if ($ok && $next == $max) {
271404a7 194 if ($max) {
195 print "${te}ok\n";
196 $good = $good + 1;
197 } else {
198 print "${te}skipping test on this platform\n";
199 $files -= 1;
200 }
a0d0e21e 201 } else {
202 $next += 1;
34b5aed4 203 print "${te}FAILED on test $next\n";
a0d0e21e 204 $bad = $bad + 1;
205 $_ = $test;
206 if (/^base/) {
207 die "Failed a basic test--cannot continue.\n";
208 }
209 }
210}
211
212if ($bad == 0) {
213 if ($ok) {
214 print "All tests successful.\n";
215 } else {
216 die "FAILED--no tests were run for some reason.\n";
217 }
218} else {
219 $pct = sprintf("%.2f", $good / $total * 100);
220 if ($bad == 1) {
221 warn "Failed 1 test, $pct% okay.\n";
222 } else {
223 warn "Failed $bad/$total tests, $pct% okay.\n";
224 }
225}
226($user,$sys,$cuser,$csys) = times;
227print sprintf("u=%g s=%g cu=%g cs=%g files=%d tests=%d\n",
228 $user,$sys,$cuser,$csys,$files,$totmax);
229$$END-OF-TEST$$
230$ wrapup:
09b7f37c 231$ Show Process/Accounting
a0d0e21e 232$ If F$Search("Echo.Exe").nes."" Then Delete/Log/NoConfirm Echo.Exe;*
e518068a 233$ Set Default &olddef
84902520 234$ Set Message 'oldmsg'
a0d0e21e 235$ Exit