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