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