perl 5.003_01: vms/test.com
[p5sagit/p5-mst-13.2.git] / vms / test.com
1 $!  Test.Com - DCL driver for perl5 regression tests
2 $!
3 $!  Version 1.1   4-Dec-1995
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 $   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
21 $
22 $  exe = ".Exe"
23 $  If p1.nes."" Then exe = p1
24 $!  Pick up a copy of perl to use for the tests
25 $   Delete/Log/NoConfirm Perl.;*
26 $   Copy/Log/NoConfirm [-]Perl'exe' []Perl.
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
70 $   Link/NoTrace/Exe=Echo.Exe Echo.Obj;
71 $   Delete/Log/NoConfirm Echo.Obj;*
72 $   echo = "$" + F$Parse("Echo.Exe")
73 $
74 $!  And do it
75 $   testdir = "Directory/NoHead/NoTrail/Column=1"
76 $   Define/User Perlshr Sys$Disk:[-]PerlShr'exe'
77 $   MCR Sys$Disk:[]Perl. "''p2'" "''p3'" "''p4'" "''p5'" "''p6'"
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
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.)
88 @compexcl=('cpp.t','script.t');
89 @ioexcl=('argv.t','dup.t','fs.t','inplace.t','pipe.t');
90 @libexcl=('anydbm.t','db-btree.t','db-hash.t','db-recno.t',
91           'gdbm.t','io_dup.t', 'io_pipe.t', 'io_sock.t',
92           'ndbm.t','odbm.t','posix.t','sdbm.t','soundex.t');
93           # Note: POSIX is not part of basic build, but can be built
94           # separately if you're using DECC
95 @opexcl=('exec.t','fork.t','glob.t','groups.t','magic.t','misc.t','stat.t');
96 @exclist=(@compexcl,@ioexcl,@libexcl,@opexcl);
97 foreach $file (@exclist) { $skip{$file}++; }
98
99 $| = 1;
100
101 @ARGV = grep($_,@ARGV);  # remove empty elements due to "''p1'" syntax
102
103 if ($ARGV[0] eq '-v') {
104     $verbose = 1;
105     shift;
106 }
107
108 chdir 't' if -f 't/TEST';
109
110 if ($ARGV[0] eq '') {
111     foreach (<[.*]*.t>) {
112       s/.*[\[.]t./[./;
113       ($fname = $_) =~ s/.*\]//;
114       if ($skip{"\L$fname"}) { push(@skipped,$_); }
115       else { push(@ARGV,$_); }
116     }
117 }
118
119 if (@skipped) {
120   print "The following tests were skipped because they rely extensively on\n";
121   print " Unixisms not compatible with the current version of perl for VMS:\n";
122   print "\t",join("\n\t",@skipped),"\n\n";
123 }
124
125 $bad = 0;
126 $good = 0;
127 $total = @ARGV;
128 while ($test = shift) {
129     if ($test =~ /^$/) {
130         next;
131     }
132     $te = $test;
133     chop($te);
134     $te .= '.' x (24 - length($te));
135         open(script,"$test") || die "Can't run $test.\n";
136         $_ = <script>;
137         close(script);
138         if (/#!..perl(.*)/) {
139             $switch = $1;
140         } else {
141             $switch = '';
142         }
143         open(results,"\$ MCR Sys\$Disk:[]Perl. $switch $test |") || (print "can't run.\n");
144     $ok = 0;
145     $next = 0;
146     while (<results>) {
147         if ($verbose) {
148             print "$te$_";
149             $te = '';
150         }
151         unless (/^#/) {
152             if (/^1\.\.([0-9]+)/) {
153                 $max = $1;
154                 $totmax += $max;
155                 $files += 1;
156                 $next = 1;
157                 $ok = 1;
158             } else {
159                 $next = $1, $ok = 0, last if /^not ok ([0-9]*)/;
160                 next if /^\s*$/; # our 'echo' substitute produces one more \n than Unix'
161                 if (/^ok (.*)/ && $1 == $next) {
162                     $next = $next + 1;
163                 } else {
164                     $ok = 0;
165                 }
166             }
167         }
168     }
169     $next = $next - 1;
170     if ($ok && $next == $max) {
171         if ($max) {
172             print "${te}ok\n";
173             $good = $good + 1;
174         } else {
175             print "${te}skipping test on this platform\n";
176             $files -= 1;
177         }
178     } else {
179         $next += 1;
180         print "${te}FAILED on test $next\n";
181         $bad = $bad + 1;
182         $_ = $test;
183         if (/^base/) {
184             die "Failed a basic test--cannot continue.\n";
185         }
186     }
187 }
188
189 if ($bad == 0) {
190     if ($ok) {
191         print "All tests successful.\n";
192     } else {
193         die "FAILED--no tests were run for some reason.\n";
194     }
195 } else {
196     $pct = sprintf("%.2f", $good / $total * 100);
197     if ($bad == 1) {
198         warn "Failed 1 test, $pct% okay.\n";
199     } else {
200         warn "Failed $bad/$total tests, $pct% okay.\n";
201     }
202 }
203 ($user,$sys,$cuser,$csys) = times;
204 print sprintf("u=%g  s=%g  cu=%g  cs=%g  files=%d  tests=%d\n",
205     $user,$sys,$cuser,$csys,$files,$totmax);
206 $$END-OF-TEST$$
207 $ wrapup:
208 $   If F$Search("Echo.Exe").nes."" Then Delete/Log/NoConfirm Echo.Exe;*
209 $   Set Default &olddef
210 $   Exit