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