This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[win32] another toke.c maintpatch
[perl5.git] / vms / test.com
CommitLineData
a0d0e21e
LW
1$! Test.Com - DCL driver for perl5 regression tests
2$!
e518068a 3$! Version 1.1 4-Dec-1995
a0d0e21e
LW
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
LW
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
LW
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
LW
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
LW
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
LW
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');
bf99883d 94@libexcl=('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',
bf99883d 96 'ndbm.t','odbm.t','open2.t','open3.t','posix.t');
71be2cbc 97
98# Note: POSIX is not part of basic build, but can be built
99# separately if you're using DECC
100# io_xs.t tests the new_tmpfile routine, which doesn't work with the
101# VAXCRTL, since the file can't be stat()d, an Perl's do_open()
102# insists on stat()ing a file descriptor before it'll use it.
103push(@libexcl,'io_xs.t') if $Config{'vms_cc_type'} ne 'decc';
104
271404a7 105@opexcl=('exec.t','fork.t','glob.t','groups.t','magic.t','misc.t','stat.t');
a0d0e21e
LW
106@exclist=(@compexcl,@ioexcl,@libexcl,@opexcl);
107foreach $file (@exclist) { $skip{$file}++; }
108
109$| = 1;
110
34b5aed4 111@ARGV = grep($_,@ARGV); # remove empty elements due to "''p1'" syntax
112
61bb5906 113if (lc($ARGV[0]) eq '-v') {
a0d0e21e 114 $verbose = 1;
34b5aed4 115 shift;
116}
a0d0e21e
LW
117
118chdir 't' if -f 't/TEST';
119
120if ($ARGV[0] eq '') {
34b5aed4 121 foreach (<[.*]*.t>) {
122 s/.*[\[.]t./[./;
123 ($fname = $_) =~ s/.*\]//;
a0d0e21e
LW
124 if ($skip{"\L$fname"}) { push(@skipped,$_); }
125 else { push(@ARGV,$_); }
126 }
127}
128
129if (@skipped) {
130 print "The following tests were skipped because they rely extensively on\n";
131 print " Unixisms not compatible with the current version of perl for VMS:\n";
34b5aed4 132 print "\t",join("\n\t",@skipped),"\n\n";
a0d0e21e
LW
133}
134
135$bad = 0;
136$good = 0;
137$total = @ARGV;
138while ($test = shift) {
139 if ($test =~ /^$/) {
140 next;
141 }
142 $te = $test;
143 chop($te);
34b5aed4 144 $te .= '.' x (24 - length($te));
a0d0e21e
LW
145 open(script,"$test") || die "Can't run $test.\n";
146 $_ = <script>;
147 close(script);
148 if (/#!..perl(.*)/) {
149 $switch = $1;
55497cff 150 # Add "" to protect uppercase switches on command line
44a8e56a 151 $switch =~ s/-(\S*[A-Z]\S*)/"-$1"/g;
a0d0e21e
LW
152 } else {
153 $switch = '';
154 }
155 open(results,"\$ MCR Sys\$Disk:[]Perl. $switch $test |") || (print "can't run.\n");
156 $ok = 0;
157 $next = 0;
158 while (<results>) {
159 if ($verbose) {
34b5aed4 160 print "$te$_";
161 $te = '';
a0d0e21e
LW
162 }
163 unless (/^#/) {
164 if (/^1\.\.([0-9]+)/) {
165 $max = $1;
166 $totmax += $max;
167 $files += 1;
168 $next = 1;
169 $ok = 1;
170 } else {
171 $next = $1, $ok = 0, last if /^not ok ([0-9]*)/;
172 next if /^\s*$/; # our 'echo' substitute produces one more \n than Unix'
173 if (/^ok (.*)/ && $1 == $next) {
174 $next = $next + 1;
175 } else {
176 $ok = 0;
177 }
178 }
179 }
180 }
181 $next = $next - 1;
182 if ($ok && $next == $max) {
271404a7 183 if ($max) {
184 print "${te}ok\n";
185 $good = $good + 1;
186 } else {
187 print "${te}skipping test on this platform\n";
188 $files -= 1;
189 }
a0d0e21e
LW
190 } else {
191 $next += 1;
34b5aed4 192 print "${te}FAILED on test $next\n";
a0d0e21e
LW
193 $bad = $bad + 1;
194 $_ = $test;
195 if (/^base/) {
196 die "Failed a basic test--cannot continue.\n";
197 }
198 }
199}
200
201if ($bad == 0) {
202 if ($ok) {
203 print "All tests successful.\n";
204 } else {
205 die "FAILED--no tests were run for some reason.\n";
206 }
207} else {
208 $pct = sprintf("%.2f", $good / $total * 100);
209 if ($bad == 1) {
210 warn "Failed 1 test, $pct% okay.\n";
211 } else {
212 warn "Failed $bad/$total tests, $pct% okay.\n";
213 }
214}
215($user,$sys,$cuser,$csys) = times;
216print sprintf("u=%g s=%g cu=%g cs=%g files=%d tests=%d\n",
217 $user,$sys,$cuser,$csys,$files,$totmax);
218$$END-OF-TEST$$
219$ wrapup:
220$ If F$Search("Echo.Exe").nes."" Then Delete/Log/NoConfirm Echo.Exe;*
e518068a 221$ Set Default &olddef
84902520 222$ Set Message 'oldmsg'
a0d0e21e 223$ Exit