[20000615.005] [PATCH] Cwd::fastgetcwd broken (or mis-named?) on Unix
[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
bd3fa61c 4$! Charles Bailey bailey@newman.upenn.edu
a0d0e21e 5$
6$! A little basic setup
7$ On Error Then Goto wrapup
e518068a 8$ olddef = F$Environment("Default")
84902520 9$ oldmsg = F$Environment("Message")
e518068a 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
93d6612c 22$ Set Message /NoFacility/NoSeverity/NoIdentification/NoText
a0d0e21e 23$
491527d0 24$ exe = ".Exe"
25$ If p1.nes."" Then exe = p1
26$ If F$Extract(0,1,exe) .nes. "."
27$ Then
28$ Write Sys$Error ""
29$ Write Sys$Error "The first parameter passed to Test.Com must be the file type used for the"
30$ Write Sys$Error "images produced when you built Perl (i.e. "".Exe"", unless you edited"
31$ Write Sys$Error "Descrip.MMS or used the AXE=1 macro in the MM[SK] command line."
32$ Write Sys$Error ""
33$ Exit 44
34$ EndIf
3eeba6fb 35$!
36$! "debug" perl if second parameter is nonblank
37$!
38$ dbg = ""
39$ ndbg = ""
40$ if p2.nes."" then dbg = "dbg"
41$ if p2.nes."" then ndbg = "ndbg"
42$!
a0d0e21e 43$! Pick up a copy of perl to use for the tests
8713643e 44$ If F$Search("Perl.").nes."" Then Delete/Log/NoConfirm Perl.;*
3eeba6fb 45$ Copy/Log/NoConfirm [-]'ndbg'Perl'exe' []Perl.
59d8d783 46$!
47$! Pick up a copy of vmspipe.com to use for the tests
48$ If F$Search("VMSPIPE.COM").nes."" then Delete/Log/Noconfirm VMSPIPE.COM;*
49$ Copy/Log/NoConfirm [-]VMSPIPE.COM []
50$!
a0d0e21e 51$! Make the environment look a little friendlier to tests which assume Unix
3b558104 52$ cat == "Type"
ff0cee69 53$ Macro/NoDebug/NoList/Object=Echo.Obj Sys$Input
a0d0e21e 54 .title echo
55 .psect data,wrt,noexe
56 dsc:
57 .word 0
58 .byte 14 ; DSC$K_DTYPE_T
59 .byte 2 ; DSC$K_CLASS_D
60 .long 0
61 .psect code,nowrt,exe
62 .entry echo,^m<r2,r3>
63 movab dsc,r2
64 pushab (r2)
65 calls #1,G^LIB$GET_FOREIGN
66 movl 4(r2),r3
67 movzwl (r2),r0
68 addl2 4(r2),r0
69 cmpl r3,r0
70 bgtru sym.3
71 nop
72 sym.1:
73 movb (r3),r0
74 cmpb r0,#65
75 blss sym.2
76 cmpb r0,#90
77 bgtr sym.2
78 cvtbl r0,r0
79 addl2 #32,r0
80 cvtlb r0,(r3)
81 sym.2:
82 incl r3
83 movzwl (r2),r0
84 addl2 4(r2),r0
85 cmpl r3,r0
86 blequ sym.1
87 sym.3:
88 pushab (r2)
89 calls #1,G^LIB$PUT_OUTPUT
90 movl #1,r0
91 ret
92 .end echo
59d8d783 93$ If F$Search("Echo.Exe").nes."" Then Delete/Log/NoConfirm Echo.Exe;*
ff0cee69 94$ Link/NoMap/NoTrace/Exe=Echo.Exe Echo.Obj;
a0d0e21e 95$ Delete/Log/NoConfirm Echo.Obj;*
3b558104 96$ echo == "$" + F$Parse("Echo.Exe")
a0d0e21e 97$
98$! And do it
09b7f37c 99$ Show Process/Accounting
e518068a 100$ testdir = "Directory/NoHead/NoTrail/Column=1"
23724483 101$ Define 'dbg'Perlshr Sys$Disk:[-]'dbg'PerlShr'exe'
3eeba6fb 102$ MCR Sys$Disk:[]Perl. "-I[-.lib]" - "''p3'" "''p4'" "''p5'" "''p6'"
a0d0e21e 103$ Deck/Dollar=$$END-OF-TEST$$
104# $RCSfile: TEST,v $$Revision: 4.1 $$Date: 92/08/07 18:27:00 $
bd3fa61c 105# Modified for VMS 30-Sep-1994 Charles Bailey bailey@newman.upenn.edu
a0d0e21e 106#
107# This is written in a peculiar style, since we're trying to avoid
108# most of the constructs we'll be testing for.
109
110# skip those tests we know will fail entirely or cause perl to hang bacause
271404a7 111# of Unixisms in the tests. (The Perl operators being tested may work fine,
112# but the tests may use other operators which don't.)
71be2cbc 113use Config;
114
84902520 115@compexcl=('cpp.t');
93d6612c 116@ioexcl=('argv.t','dup.t','fs.t','pipe.t');
bf99883d 117@libexcl=('db-btree.t','db-hash.t','db-recno.t',
562a7b0c 118 'gdbm.t','io_dup.t', 'io_pipe.t', 'io_poll.t', 'io_sel.t',
119 'io_sock.t', 'io_unix.t',
ef060a86 120 'ndbm.t','odbm.t','open2.t','open3.t', 'ph.t', 'posix.t');
71be2cbc 121
122# Note: POSIX is not part of basic build, but can be built
123# separately if you're using DECC
124# io_xs.t tests the new_tmpfile routine, which doesn't work with the
125# VAXCRTL, since the file can't be stat()d, an Perl's do_open()
126# insists on stat()ing a file descriptor before it'll use it.
127push(@libexcl,'io_xs.t') if $Config{'vms_cc_type'} ne 'decc';
128
491527d0 129@opexcl=('die_exit.t','exec.t','fork.t','glob.t','groups.t','magic.t','misc.t','stat.t');
a0d0e21e 130@exclist=(@compexcl,@ioexcl,@libexcl,@opexcl);
131foreach $file (@exclist) { $skip{$file}++; }
132
133$| = 1;
134
34b5aed4 135@ARGV = grep($_,@ARGV); # remove empty elements due to "''p1'" syntax
136
61bb5906 137if (lc($ARGV[0]) eq '-v') {
a0d0e21e 138 $verbose = 1;
34b5aed4 139 shift;
140}
a0d0e21e 141
142chdir 't' if -f 't/TEST';
143
144if ($ARGV[0] eq '') {
34b5aed4 145 foreach (<[.*]*.t>) {
146 s/.*[\[.]t./[./;
147 ($fname = $_) =~ s/.*\]//;
a0d0e21e 148 if ($skip{"\L$fname"}) { push(@skipped,$_); }
149 else { push(@ARGV,$_); }
150 }
151}
152
153if (@skipped) {
154 print "The following tests were skipped because they rely extensively on\n";
155 print " Unixisms not compatible with the current version of perl for VMS:\n";
34b5aed4 156 print "\t",join("\n\t",@skipped),"\n\n";
a0d0e21e 157}
158
159$bad = 0;
160$good = 0;
161$total = @ARGV;
162while ($test = shift) {
163 if ($test =~ /^$/) {
164 next;
165 }
166 $te = $test;
167 chop($te);
34b5aed4 168 $te .= '.' x (24 - length($te));
a0d0e21e 169 open(script,"$test") || die "Can't run $test.\n";
170 $_ = <script>;
171 close(script);
172 if (/#!..perl(.*)/) {
173 $switch = $1;
55497cff 174 # Add "" to protect uppercase switches on command line
44a8e56a 175 $switch =~ s/-(\S*[A-Z]\S*)/"-$1"/g;
a0d0e21e 176 } else {
177 $switch = '';
178 }
9428117f 179 open(results,"\$ MCR Sys\$Disk:[]Perl. \"-I[-.lib]\" $switch $test 2>&1|") || (print "can't run.\n");
a0d0e21e 180 $ok = 0;
181 $next = 0;
3eeba6fb 182 $pending_not = 0;
a0d0e21e 183 while (<results>) {
184 if ($verbose) {
34b5aed4 185 print "$te$_";
186 $te = '';
a0d0e21e 187 }
188 unless (/^#/) {
189 if (/^1\.\.([0-9]+)/) {
190 $max = $1;
191 $totmax += $max;
192 $files += 1;
193 $next = 1;
194 $ok = 1;
195 } else {
196 $next = $1, $ok = 0, last if /^not ok ([0-9]*)/;
197 next if /^\s*$/; # our 'echo' substitute produces one more \n than Unix'
198 if (/^ok (.*)/ && $1 == $next) {
3eeba6fb 199 $next = $1, $ok=0, last if $pending_not;
a0d0e21e 200 $next = $next + 1;
3eeba6fb 201 } elsif (/^not/) {
202 $pending_not = 1;
a0d0e21e 203 } else {
204 $ok = 0;
205 }
206 }
207 }
208 }
209 $next = $next - 1;
210 if ($ok && $next == $max) {
271404a7 211 if ($max) {
212 print "${te}ok\n";
213 $good = $good + 1;
214 } else {
215 print "${te}skipping test on this platform\n";
216 $files -= 1;
217 }
a0d0e21e 218 } else {
219 $next += 1;
34b5aed4 220 print "${te}FAILED on test $next\n";
a0d0e21e 221 $bad = $bad + 1;
222 $_ = $test;
223 if (/^base/) {
224 die "Failed a basic test--cannot continue.\n";
225 }
226 }
227}
228
229if ($bad == 0) {
230 if ($ok) {
231 print "All tests successful.\n";
232 } else {
233 die "FAILED--no tests were run for some reason.\n";
234 }
235} else {
236 $pct = sprintf("%.2f", $good / $total * 100);
237 if ($bad == 1) {
238 warn "Failed 1 test, $pct% okay.\n";
239 } else {
240 warn "Failed $bad/$total tests, $pct% okay.\n";
241 }
242}
243($user,$sys,$cuser,$csys) = times;
c04215f0 244print sprintf("u=%g s=%g cu=%g cs=%g scripts=%d tests=%d\n",
a0d0e21e 245 $user,$sys,$cuser,$csys,$files,$totmax);
246$$END-OF-TEST$$
247$ wrapup:
23724483 248$ deassign 'dbg'Perlshr
09b7f37c 249$ Show Process/Accounting
e518068a 250$ Set Default &olddef
84902520 251$ Set Message 'oldmsg'
a0d0e21e 252$ Exit