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