Yes, you guessed it -- a typos fixed
[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")
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$
22$! Pick up a copy of perl to use for the tests
23$ Delete/Log/NoConfirm Perl.;*
24$ Copy/Log/NoConfirm [-]Perl.Exe []Perl.
25$
26$! Make the environment look a little friendlier to tests which assume Unix
27$ cat = "Type"
28$ Macro/NoDebug/Object=Echo.Obj Sys$Input
29 .title echo
30 .psect data,wrt,noexe
31 dsc:
32 .word 0
33 .byte 14 ; DSC$K_DTYPE_T
34 .byte 2 ; DSC$K_CLASS_D
35 .long 0
36 .psect code,nowrt,exe
37 .entry echo,^m<r2,r3>
38 movab dsc,r2
39 pushab (r2)
40 calls #1,G^LIB$GET_FOREIGN
41 movl 4(r2),r3
42 movzwl (r2),r0
43 addl2 4(r2),r0
44 cmpl r3,r0
45 bgtru sym.3
46 nop
47 sym.1:
48 movb (r3),r0
49 cmpb r0,#65
50 blss sym.2
51 cmpb r0,#90
52 bgtr sym.2
53 cvtbl r0,r0
54 addl2 #32,r0
55 cvtlb r0,(r3)
56 sym.2:
57 incl r3
58 movzwl (r2),r0
59 addl2 4(r2),r0
60 cmpl r3,r0
61 blequ sym.1
62 sym.3:
63 pushab (r2)
64 calls #1,G^LIB$PUT_OUTPUT
65 movl #1,r0
66 ret
67 .end echo
68$ Link/NoTrace Echo.Obj;
69$ Delete/Log/NoConfirm Echo.Obj;*
748a9306 70$ echo = "$" + F$Parse("Echo.Exe")
a0d0e21e 71$
72$! And do it
e518068a 73$ testdir = "Directory/NoHead/NoTrail/Column=1"
74$ Define/User Perlshr Sys$Disk:[-]PerlShr.Exe
a0d0e21e 75$ MCR Sys$Disk:[]Perl.
76$ Deck/Dollar=$$END-OF-TEST$$
77# $RCSfile: TEST,v $$Revision: 4.1 $$Date: 92/08/07 18:27:00 $
78# Modified for VMS 30-Sep-1994 Charles Bailey bailey@genetics.upenn.edu
79#
80# This is written in a peculiar style, since we're trying to avoid
81# most of the constructs we'll be testing for.
82
83# skip those tests we know will fail entirely or cause perl to hang bacause
84# of Unixisms
85@compexcl=('cpp.t','script.t');
86@ioexcl=('argv.t','dup.t','fs.t','inplace.t','pipe.t');
87@libexcl=('anydbm.t','db-btree.t','db-hash.t','db-recno.t',
88 'gdbm.t','ndbm.t','odbm.t','sdbm.t','posix.t','soundex.t');
89@opexcl=('exec.t','fork.t','glob.t','magic.t','misc.t','stat.t');
90@exclist=(@compexcl,@ioexcl,@libexcl,@opexcl);
91foreach $file (@exclist) { $skip{$file}++; }
92
93$| = 1;
94
95#if ($ARGV[0] eq '-v') {
96 $verbose = 1;
97# shift;
98#}
99
100chdir 't' if -f 't/TEST';
101
102if ($ARGV[0] eq '') {
e518068a 103 @files = split(/[ \n]/, `\$ testdir [...]*.t;`);
a0d0e21e 104 foreach (@files) {
105 $fname = $_;
106 $fname =~ s/.*\]([\w\$\-]+\.T);.*/$1/;
107 if ($skip{"\L$fname"}) { push(@skipped,$_); }
108 else { push(@ARGV,$_); }
109 }
110}
111
112if (@skipped) {
113 print "The following tests were skipped because they rely extensively on\n";
114 print " Unixisms not compatible with the current version of perl for VMS:\n";
115 print "\t",join("\n\t",@skipped);
116}
117
118$bad = 0;
119$good = 0;
120$total = @ARGV;
121while ($test = shift) {
122 if ($test =~ /^$/) {
123 next;
124 }
125 $te = $test;
126 chop($te);
127 print "$te" . '.' x (15 - length($te)) . "\n";
128 open(script,"$test") || die "Can't run $test.\n";
129 $_ = <script>;
130 close(script);
131 if (/#!..perl(.*)/) {
132 $switch = $1;
133 } else {
134 $switch = '';
135 }
136 open(results,"\$ MCR Sys\$Disk:[]Perl. $switch $test |") || (print "can't run.\n");
137 $ok = 0;
138 $next = 0;
139 while (<results>) {
140 if ($verbose) {
141 print $_;
142 }
143 unless (/^#/) {
144 if (/^1\.\.([0-9]+)/) {
145 $max = $1;
146 $totmax += $max;
147 $files += 1;
148 $next = 1;
149 $ok = 1;
150 } else {
151 $next = $1, $ok = 0, last if /^not ok ([0-9]*)/;
152 next if /^\s*$/; # our 'echo' substitute produces one more \n than Unix'
153 if (/^ok (.*)/ && $1 == $next) {
154 $next = $next + 1;
155 } else {
156 $ok = 0;
157 }
158 }
159 }
160 }
161 $next = $next - 1;
162 if ($ok && $next == $max) {
163 print "ok\n";
164 $good = $good + 1;
165 } else {
166 $next += 1;
167 print "FAILED on test $next\n";
168 $bad = $bad + 1;
169 $_ = $test;
170 if (/^base/) {
171 die "Failed a basic test--cannot continue.\n";
172 }
173 }
174}
175
176if ($bad == 0) {
177 if ($ok) {
178 print "All tests successful.\n";
179 } else {
180 die "FAILED--no tests were run for some reason.\n";
181 }
182} else {
183 $pct = sprintf("%.2f", $good / $total * 100);
184 if ($bad == 1) {
185 warn "Failed 1 test, $pct% okay.\n";
186 } else {
187 warn "Failed $bad/$total tests, $pct% okay.\n";
188 }
189}
190($user,$sys,$cuser,$csys) = times;
191print sprintf("u=%g s=%g cu=%g cs=%g files=%d tests=%d\n",
192 $user,$sys,$cuser,$csys,$files,$totmax);
193$$END-OF-TEST$$
194$ wrapup:
195$ If F$Search("Echo.Exe").nes."" Then Delete/Log/NoConfirm Echo.Exe;*
e518068a 196$ Set Default &olddef
a0d0e21e 197$ Exit