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