Debian Codegraph @

vms/vmstest.com

raw
1 $! vmstest.com -- DCL script to perform test/Makefile actions for VMS
2 $!
3 $! Usage:
4 $! $ set default [-.test]
5 $! $ @[-.vms]vmstest.com bigtest
6 $! This assumes that newly built gawk.exe is in the next directory up.
7 $!
8 $! Note to other maintainers:
9 $! * when this test script is run via automation through RSH or SSH,
10 $! on non-VAX, for some reason a second empty version of the output
11 $! file is generated.
12 $! For the tests to pass, this must be detected and deleted.
13 $! This issue does not show up when running this script from
14 $! an interactive SSH session.
15 $! * The tests where Gawk could return an error code need to be
16 $! wrapped in a set On / set noOn pair or it will abort this
17 $! script, leaving behind an open "junit" file logical in DCL.
18 $!
19 $! 3.1.7: changed to share code among many common tests, and
20 $! to put results for test foo into _foo.tmp instead of tmp.
21 $!
22 $! 4.0.71: New tests:
23 $! functab1,functab2,functab3,id,incdupe,incdupe2, incdupe3,include2
24 $! symtab1,symtab2,symtab3,symtab4,symtab5,symtab6
25 $!
26 $! 4.0.75: New tests
27 $! basic: rri1,getline5,incdupe4,incdupe5,incdupe6,incdupe7
28 $! ext: colonwarn,reginttrad,symtab7,symtab8,symtab9
29 $!
30 $! 4.1.1: New tests implemented in 4.1.3a
31 $!
32 $! basic: badassign1,dfamb1,exit2,nfloop
33 $! ext: profile4,profile5
34 $! locale: backbigs1,backsmalls1,backsmalls2,mbprintf4
35 $! backgigs1 requires a locale not supplied with VMS.
36 $!
37 $! 4.1.2: New tests implemented in 4.1.3a
38 $! basic: badbuild,callparam,exitval3,inpref,paramasfunc1,
39 $! paramasfunc2,regexpbrack,sortglos
40 $! ext: crlf,dbugeval,fpat4,genpot,indirectbuiltin,
41 $! printfbad4,printhuge,profile0,profile6,profile7,
42 $! regnul1,regnul2,rsgetline,rsglstdin
43 $! charset_all: charset_msg_start,charset_tests,charset_msg_end
44 $!
45 $! 4.1.3: New tests - implemented in 4.1.3a
46 $! basic: rebrackloc
47 $!
48 $! 4.1.3a: New tests
49 $! vms_debug: Not a test, switches to a debug gawk for following tests
50 $! basic: aryprm9,exitval2,nulinsrc,rstest4,rstest5
51 $! ext: mbstr2,profile8,watchpoint1
52 $! shlib: inplace2,testext,lc_num1,mbprintf1
53 $! mbprintf2,mbfprintf3,mbfprintf4,mbfw1
54 $!
55 $! 4.1.3c: New tests
56 $! ext: clos1way2, clos1way3, clos1way4, clos1way5
57 $!
58 $! 4.1.3f: New tests
59 $! basic: arrayind1,rscompat,sigpipe1
60 $!
61 $! 4.1.3.g: New tests
62 $! basic: fsnul1, hex2, mixed1, subback
63 $! ext: fpat4, symtab10
64 $!
65 $! 4.1.3.i: New tests
66 $! basic: ofmtstrnum
67 $! extra: ignrcas3
68 $!
69 $! 4.2.0: New tests
70 $! basic: aryunasgn, concat5, memleak
71 $! ext: fpat5, fpat6, fwtest5, fwtest6, fwtest7, fwtest8,
72 $! sourcesplit
73 $! charset: mbprintf5
74 $!
75 $! 4.2+: New tests
76 $! basic: numstr1, setrec0, setrec1
77 $! extra: isarrayunset, nlstringtest
78 $!
79 $!
80 $ echo = "write sys$output"
81 $ cmp = "diff/Output=_NL:/Maximum=1"
82 $ delsym = "delete/symbol/local/nolog"
83 $ igncascmp = "''cmp'/Ignore=Case"
84 $ sumslp = "edit/Sum"
85 $ rm = "delete/noConfirm/noLog"
86 $ mv = "rename/New_Vers"
87 $ sort = "sort"
88 $ gawk = "$sys$disk:[-]gawk"
89 $ AWKPATH_srcdir = "define/User AWKPATH sys$disk:[]"
90 $ AWKLIBPATH_dir = "define/User AWKLIBPATH sys$disk:[-]"
91 $ arch_name = f$edit(f$getsyi("arch_name"),"upcase,trim")
92 $
93 $! Make sure that the default directory exists on a search list.
94 $ def_dir = f$environment("default")
95 $ create/dir 'def_dir'
96 $ listdepth = 0
97 $ pipeok = 0
98 $ floatmode = -1 ! 0: D_float, 1: G_float, 2: IEEE T_float
99 $
100 $ list = p1+" "+p2+" "+p3+" "+p4+" "+p5+" "+p6+" "+p7+" "+p8
101 $ list = f$edit(list,"TRIM,LOWERCASE")
102 $ if list.eqs."" then list = "all" ! bigtest
103 $ gosub create_junit_test_header
104 $ gosub list_of_tests
105 $ gosub finish_junit_test
106 $ echo "done."
107 $ exit
108 $!
109 $create_junit_test_header:
110 $ junit_count = 0
111 $ temp_fdl = "sys$disk:[]stream_lf.fdl"
112 $ arch_code = f$extract(0, 1, arch_name)
113 $!
114 $ if f$trnlnm("junit",,, "SUPERVISOR") .nes. ""
115 $ then
116 $ close junit
117 $ endif
118 $ if f$trnlnm("junit_hdr",,, "SUPERVISOR") .nes. ""
119 $ then
120 $ close junit_hdr
121 $ endif
122 $ junit_hdr_file = "sys$disk:[]test_output.xml"
123 $ if f$search(junit_hdr_file) .nes. "" then delete 'junit_hdr_file';*
124 $ junit_body_file = "sys$disk:[]test_body_tmp.xml"
125 $ if f$search(junit_body_file) .nes. "" then delete 'junit_body_file';*
126 $!!
127 $ if arch_code .nes. "V"
128 $ then
129 $ create 'junit_hdr_file'/fdl="RECORD; FORMAT STREAM_LF;"
130 $ create 'junit_body_file'/fdl="RECORD; FORMAT STREAM_LF;"
131 $ else
132 $ if f$search(temp_fdl) .nes. "" then delete 'temp_fdl';*
133 $ create 'temp_fdl'
134 RECORD
135 FORMAT stream_lf
136 $ continue
137 $ create 'junit_hdr_file'/fdl='temp_fdl'
138 $ create 'junit_body_file'/fdl='temp_fdl'
139 $ endif
140 $ open/append junit 'junit_body_file'
141 $ if f$search(temp_fdl) .nes. "" then delete 'temp_fdl';*
142 $ return
143 $!
144 $finish_junit_test:
145 $ open/append junit_hdr 'junit_hdr_file'
146 $ write junit_hdr "<?xml version=""1.0"" encoding=""UTF-8""?>"
147 $ write junit_hdr "<testsuite name=""gawk"""
148 $ write junit_hdr " tests=""''junit_count'"">"
149 $ close junit_hdr
150 $ write junit "</testsuite>"
151 $ close junit
152 $ append 'junit_body_file' 'junit_hdr_file'
153 $ delete 'junit_body_file';*
154 $ return
155 $!
156 $junit_report_skip:
157 $ write sys$output "Skipping test ''test' reason ''skip_reason'."
158 $ junit_count = junit_count + 1
159 $ write junit " <testcase name=""''test'"""
160 $ write junit " classname=""''test_class'"">"
161 $ write junit " <skipped/>"
162 $ write junit " </testcase>"
163 $ return
164 $!
165 $junit_report_fail_diff:
166 $ fail_msg = "failed"
167 $ fail_type = "diff"
168 $! fall through to junit_report_fail
169 $junit_report_fail:
170 $ write sys$output "failing test ''test' reason ''fail_msg'."
171 $ junit_count = junit_count + 1
172 $ write junit " <testcase name=""''test'"""
173 $ write junit " classname=""''test_class'"">"
174 $ write junit -
175 " <failure message=""''fail_msg'"" type=""''fail_type'"" >"
176 $ write junit " </failure>"
177 $ write junit " </testcase>"
178 $ return
179 $!
180 $junit_report_pass:
181 $ junit_count = junit_count + 1
182 $ write junit " <testcase name=""''test'"""
183 $ write junit " classname=""''test_class'"">"
184 $ write junit " </testcase>"
185 $ return
186 $
187 $vms_debug: echo "Switching to gawk_debug.exe"
188 $ gawk = "$sys$disk:[-]gawk_debug.exe"
189 $ return
190 $!
191 $all:
192 $
193 $bigtest: echo "bigtest..."
194 $ ! omits "printlang" and "extra"
195 $ list = "basic unix_tests gawk_ext vms_tests charset_tests" -
196 + " machine_tests"
197 $ gosub list_of_tests
198 $ return
199 $
200 $basic: echo "basic..."
201 $ list = "msg addcomma anchgsub argarray arrayind1" -
202 + " arrayparm arrayref arrayprm2 arrayprm3 arrymem1" -
203 + " arryref2 arryref3 arryref4 arryref5 arynasty" -
204 + " arynocls aryprm1 aryprm2 aryprm3 aryprm4 aryprm5" -
205 + " aryprm6 aryprm7 aryprm8 aryprm9 arysubnm aryunasgn" -
206 + " asgext awkpath" -
207 + " back89 backgsub badassign1 badbuild"
208 $ gosub list_of_tests
209 $ list = "callparam childin clobber closebad clsflnam" -
210 + " compare compare2 concat1 concat2 concat3 concat4" -
211 + " concat5 convfmt " -
212 + " datanonl defref delargv delarprm delarpm2 delfunc" -
213 + " dfamb1 dfastress dynlj" -
214 + " eofsplit exit2 exitval1 exitval2 exitval3"
215 $ gosub list_of_tests
216 $ list = "fcall_exit fcall_exit2 fldchg fldchgnf" -
217 + " fnamedat fnarray fnarray2 fnaryscl fnasgnm fnmisc" -
218 + " fordel forref forsimp fsbs fsnul1 fsspcoln fsrs" -
219 + " fstabplus funsemnl funsmnam funstack"
220 $ gosub list_of_tests
221 $ list = "getline getline2 getline3 getline4 getline5 " -
222 + " getlnbuf getnr2tb getnr2tm gsubasgn gsubtest" -
223 + " gsubtst2 gsubtst3 gsubtst4 gsubtst5 gsubtst6" -
224 + " gsubtst7 gsubtst8" -
225 + " hex hex2 hsprint" -
226 + " inpref inputred intest intprec iobug1" -
227 + " leaddig leadnl litoct longsub longwrds"-
228 + " manglprm math membug1 messages memleak minusstr mixed1" -
229 + " mmap8k mtchi18n"
230 $ gosub list_of_tests
231 $ list = "nasty nasty2 negexp negrange nested nfldstr" -
232 + " nfloop nfneg nfset nlfldsep nlinstr nlstrina" -
233 + " noeffect nofile nofmtch noloop1 noloop2 nonl" -
234 + " noparms nors nulinsrc nulrsend numindex numstr1" -
235 + " numsubstr" -
236 + " octsub ofmt ofmtbig ofmtfidl" -
237 + " ofmta ofmts ofs1 onlynl opasnidx opasnslf
238 $ gosub list_of_tests
239 $ list = "paramasfunc1 paramasfunc2 paramdup" -
240 + " paramres paramtyp paramuninitglobal" -
241 + " parse1 parsefld parseme pcntplus posix2008sub" -
242 + " prdupval prec printf0 printf1 prmarscl prmreuse" -
243 + " prt1eval prtoeval"
244 $ gosub list_of_tests
245 $ list = "rand range1 rebrackloc rebt8b1 redfilnm regeq" -
246 + " regexpbrack regexprange regrange reindops reparse" -
247 + " resplit rri1 rs rscompat rsnul1nl rsnulbig rsnulbig2" -
248 + " rstest1 rstest2 rstest3 rstest4 rstest5 rswhite"
249 $ gosub list_of_tests
250 $ list = "scalar sclforin sclifin setrec0 setrec1 sigpipe1" -
251 + " sortempty sortglos" -
252 + " splitargv splitarr splitdef splitvar splitwht" -
253 + " strcat1 strtod strnum1 subamp subback subi18n subsepnm" -
254 + " subslash substr swaplns synerr1 synerr2"
255 $ gosub list_of_tests
256 $ list = "tradanch tweakfld" -
257 + " uninit2 uninit3 uninit4 uninit5 uninitialized" -
258 + " unterm uparrfs" -
259 + " wideidx wideidx2 widesub widesub2 widesub3 widesub4" -
260 + " wjposer1" -
261 + " zeroe0 zeroflag zero2"
262 $ gosub list_of_tests
263 $ return
264 $!
265 $unix:
266 $unix_tests: echo "unix_tests..."
267 $ list = "fflush getlnhd localenl pid pipeio1 pipeio2" -
268 + " poundbang rtlen rtlen01 space strftlng"
269 $ gosub list_of_tests
270 $ return
271 $
272 $gnu:
273 $gawk_ext: echo "gawk_ext... (gawk.extensions)"
274 $ list = "aadelete1 aadelete2 aarray1 aasort aasorti" -
275 + " argtest arraysort" -
276 + " backw badargs beginfile1 binmode1" -
277 + " colonwarn clos1way clos1way2 clos1way3 clos1way4" -
278 + " clos1way5 charasbytes crlf" -
279 + " dbugeval delsub devfd devfd1 devfd2 dumpvars" -
280 + " exit" -
281 + " fieldwdth fpat1 fpat2 fpat3 fpat4 fpat5 fpat6 " -
282 + " fpatnull funlen functab1 functab2 functab3 fsfwfs " -
283 + " fwtest fwtest2 fwtest3 fwtest4 fwtest5 fwtest6 " -
284 + " fwtest7 fwtest8"
285 $ gosub list_of_tests
286 $ list = "genpot gensub gensub2 getlndir gnuops2 gnuops3" -
287 + " gnureops" -
288 + " icasefs id icasers igncdym igncfs ignrcase ignrcas2" -
289 + " incdupe incdupe2 incdupe3 incdupe4 incdupe5" -
290 + " incdupe6 incdupe7 include2 indirectbuiltin indirectcall"
291 $ gosub list_of_tests
292 $ list = "lint lintold lintwarn" -
293 + " match1 match2 match3 manyfiles mbprintf3 mbstr1 mbstr2" -
294 + " nastyparm next nondec nondec2" -
295 + " patsplit posix printfbad1 printfbad2 printfbad3" -
296 + " printfbad4 printhuge procinfs profile0 profile1" -
297 + " profile2 profile3 profile4 profile5 profile6" -
298 + " profile7 profile8 pty1"
299 $ gosub list_of_tests
300 $ list = "regx8bit rebuf reginttrad regnul1 regnul2" -
301 + " reint reint2 rsgetline rsglstdin rsstart1 rsstart2" -
302 + " rsstart3 rstest6" -
303 + " shadow sortfor sortu sourcesplit split_after_fpat" -
304 + " splitarg4 strtonum strftime switch2 symtab1 symtab2" -
305 + " symtab3 symtab4 symtab5 symtab6 symtab7 symtab8" -
306 + " symtab9 symtab10 watchpoint1"
307 $ gosub list_of_tests
308 $ return
309 $
310 $vms:
311 $vms_tests: echo "vms_tests..."
312 $ list = "vms_cmd vms_io1 vms_io2"
313 $ gosub list_of_tests
314 $ return
315 $
316 $locale_tests:
317 $charset_tests: echo "charset_tests..."
318 $ ! without i18n kit, VMS only supports the C locale
319 $ ! and several of these fail
320 $ list = "asort asorti" -
321 + " backbigs1 backsmalls1 backsmalls2" -
322 + " fmttest fnarydel fnparydl" -
323 + " lc_num1 mbfw1" -
324 + " mbprintf1 mbprintf2 mbprintf4 mbprintf5" -
325 + " rebt8b2 rtlenmb" -
326 + " sort1 sprintfc"
327 $ gosub list_of_tests
328 $ return
329 $!
330 $charset_all: echo "All charset tests..."
331 $ list = "charset_msg_start charset_tests charset_msg_end"
332 $ gosub list_of_tests
333 $ return
334 $
335 $hardware:
336 $machine_tests: echo "machine_tests..."
337 $ ! these depend upon the floating point format in use
338 $ list = "double1 double2 fmtspcl intformat"
339 $ gosub list_of_tests
340 $ return
341 $
342 $extra: echo "extra..."
343 $ list = "regtest inftest inet ignrcas3 isarrayunset" -
344 + " nlstringtest"
345 $ gosub list_of_tests
346 $ return
347 $
348 $inet: echo "inet..."
349 $ type sys$input:
350 The inet tests only work if gawk has been built with TCP/IP socket
351 support and your system supports the services "discard" at port 9
352 and "daytimed" at port 13.
353 $ list = "inetechu inetecht inetdayu inetdayt"
354 $ gosub list_of_tests
355 $ return
356 $!
357 $shlib:
358 $extension: echo "extension...."
359 $ list = "fnmatch filefuncs fork fork2 fts functab4" -
360 + " inplace1 inplace2" -
361 + " ordchr ordchr2" -
362 + " readdir readfile readfile2 revout revtwoway rwarray" -
363 + " testext time"
364 $ gosub list_of_tests
365 $ return
366 $!
367 $mpfr:
368 $ test_class = "mpfr"
369 $ skip_reason = "Not yet implemented on VMS"
370 $ ! mpfr has not yet been ported to VMS.
371 $ gosub junit_report_skip
372 $ return
373 $!
374 $! list_of_tests: process 'list', a space-separated list of tests.
375 $! Some tests assign their own 'list' and call us recursively,
376 $! so we have to emulate a local stack to prevent the current list
377 $! from being clobbered by nested execution. We do this by making
378 $! and operating on list1, list2, &c depending upon call depth.
379 $! Lower level tests access higher numbered entries; the lower
380 $! entries in use by caller or caller's caller are kept intact.
381 $list_of_tests:
382 $ listdepth = listdepth + 1 ! increment calling depth
383 $ list'listdepth' = f$edit(list,"COMPRESS,TRIM")
384 $next_test:
385 $ test = f$element(0," ",list'listdepth')
386 $ list'listdepth' = list'listdepth' - test - " "
387 $ gosub 'test'
388 $ if list'listdepth'.nes."" then goto next_test
389 $ listdepth = listdepth - 1 ! reset
390 $ return
391 $
392 $
393 $! common tests, not needing special set up: gawk -f 'test'.awk 'test'.in
394 $addcomma:
395 $anchgsub:
396 $asgext:
397 $back89:
398 $backgsub:
399 $concat1:
400 $datanonl:
401 $dfamb1:
402 $fldchg:
403 $fldchgnf:
404 $fsnul1:
405 $fsrs:
406 $funstack:
407 $getline4:
408 $getnr2tb:
409 $getnr2tm:
410 $gsubtst5:
411 $gsubtst7:
412 $gsubtst8:
413 $hex2:
414 $inpref:
415 $leadnl:
416 $manglprm:
417 $membug1:
418 $nested:
419 $nfset:
420 $nlfldsep:
421 $nlinstr:
422 $noloop1:
423 $noloop2:
424 $nulrsend:
425 $ofmt:
426 $ofmtfidl:
427 $ofmts:
428 $ofs1:
429 $onlynl:
430 $parse1:
431 $parsefld:
432 $prdupval:
433 $range1:
434 $rebrackloc:
435 $regeq:
436 $regexpbrack:
437 $reindops:
438 $reparse:
439 $rsnul1nl:
440 $rswhite:
441 $setrec0:
442 $sortglos:
443 $splitargv:
444 $splitvar:
445 $strtod:
446 $subback:
447 $swaplns:
448 $uparrfs:
449 $wjposer1:
450 $ test_class = "basic"
451 $ test_in = "''test'.in"
452 $ goto common_with_test_in_redir
453 $!
454 $sprintfc:
455 $ test_class = "charset_tests"
456 $ test_in = "''test'.in"
457 $ goto common_with_test_in_redir
458 $!
459 $backw:
460 $fpat1:
461 $fpat3:
462 $fpat5:
463 $fpat6:
464 $fpatnull:
465 $fsfwfs:
466 $funlen:
467 $fwtest:
468 $fwtest2:
469 $fwtest4:
470 $fwtest5:
471 $fwtest6:
472 $fwtest7:
473 $fwtest8:
474 $gensub:
475 $icasers:
476 $igncdym:
477 $igncfs:
478 $indirectcall:
479 $match3:
480 $rebuf:
481 $rsstart1:
482 $sortfor:
483 $split_after_fpat:
484 $splitarg4:
485 $ test_in = "''test'.in"
486 $ test_class = "gawk_ext"
487 $ goto common_with_test_in_redir
488 $!
489 $fwtest3:
490 $ test_in = "fwtest2.in"
491 $ test_class = "gawk_ext"
492 $ goto common_with_test_in_redir
493 $!
494 $common_with_test_in_redir:
495 $! common with 'test'.in redirected.
496 $!
497 $ echo "''test'"
498 $! if f$search("sys$disk:[]_''test'.tmp2;*") .nes. ""
499 $! then
500 $! delete sys$disk:[]_'test'.tmp2;*
501 $! endif
502 $ if f$search("sys$disk:[]_''test'.tmp;*") .nes. ""
503 $ then
504 $ delete sys$disk:[]_'test'.tmp;*
505 $ endif
506 $ tmp_output = "_''test'.tmp"
507 $ set noOn
508 $ gawk -f 'test'.awk < 'test_in' >'tmp_output' 2>&1
509 $ gawk_status = $status
510 $ set On
511 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
512 $ then
513 $ delete sys$disk:[]_'test'.tmp;2
514 $ endif
515 $ if .not. gawk_status
516 $ then
517 $ call exit_code 'gawk_status' _'test'.tmp
518 $ endif
519 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
520 $ if $status
521 $ then
522 $ rm _'test'.tmp;*
523 $ gosub junit_report_pass
524 $ else
525 $ gosub junit_report_fail_diff
526 $ endif
527 $ return
528 $!
529 $!
530 $! Gawk treats < 'test_in' differently than just 'test_in' on VMS
531 $! and some tests care about this.
532 $common_with_test_input:
533 $! common with 'test'.in
534 $!
535 $ echo "''test'"
536 $ if f$search("sys$disk:[]_''test'.tmp;*") .nes. ""
537 $ then
538 $ delete sys$disk:[]_'test'.tmp;*
539 $ endif
540 $ set noOn
541 $ gawk -f 'test'.awk 'test_in' >_'test'.tmp
542 $ gawk_status = $status
543 $ set On
544 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
545 $ then
546 $ delete sys$disk:[]_'test'.tmp;2
547 $ endif
548 $ if .not. gawk_status
549 $ then
550 $ call exit_code 'gawk_status' _'test'.tmp
551 $ endif
552 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
553 $ if $status
554 $ then
555 $ rm _'test'.tmp;*
556 $ gosub junit_report_pass
557 $ else
558 $ gosub junit_report_fail_diff
559 $ endif
560 $ return
561 $!
562 $!
563 $!
564 $arrayind1:
565 $ echo "''test'"
566 $ test_class = "basic"
567 $ define/user sys$error _'test'.tmp
568 $ gawk -f 'test'.awk 'test'.in >_'test'.tmp2
569 $ append _'test'.tmp2 _'test'.tmp
570 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
571 $ if $status
572 $ then
573 $ rm _'test'.tmp;,_'test'.tmp2;
574 $ gosub junit_report_pass
575 $ else
576 $ gosub junit_report_fail_diff
577 $ endif
578 $ return
579 $!
580 $indirectbuiltin: ! 4.1.2
581 $ echo "''test'"
582 $ test_class = "gawk_ext"
583 $ ! No shell simulation in gawk
584 $ temp_file = "sys$disk:[]_'test'.tmp"
585 $ if f$search(temp_file) .nes. "" then delete 'temp_file';*
586 $ old_rm = rm
587 $ rm = "continue ! "
588 $ gawk -f 'test'.awk 'test'.in >_'test'.tmp
589 $ rm = old_rm
590 $ ! gawk subprocesses creating new generation of stdout
591 $ ! instead of appending to open one.
592 $ cmp 'test'.ok sys$disk:[]_'test'.tmp;1
593 $ if $status
594 $ then
595 $ rm _'test'.tmp;*,x1.out;,x2.out;
596 $ gosub junit_report_pass
597 $ else
598 $ gosub junit_report_fail_diff
599 $ endif
600 $ return
601 $!
602 $!
603 $! Sourcesplit test
604 $sourcesplit:
605 $ echo "''test'"
606 $ test_class = "gawk_ext"
607 $ source1 = "BEGIN { a = 5;"
608 $ source2 = "print a }"
609 $ if f$search("sys$disk:[]_''test'.tmp2;*") .nes. ""
610 $ then
611 $ delete sys$disk:[]_'test'.tmp2;*
612 $ endif
613 $ set noOn
614 $ define/user sys$error _'test'.tmp
615 $ gawk --source="''source1'" --source="''source2'" >_'test'.tmp2
616 $ gawk_status = $status
617 $ if f$search("sys$disk:[]_''test'.tmp2;2") .nes. ""
618 $ then
619 $ delete sys$disk:[]_'test'.tmp2;2
620 $ endif
621 $ if .not. gawk_status then call exit_code 'gawk_status' _'test'.tmp
622 $ set On
623 $ append _'test'.tmp2 _'test'.tmp
624 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
625 $ if $status
626 $ then
627 $ rm _'test'.tmp;,_'test'.tmp2;
628 $ gosub junit_report_pass
629 $ else
630 $ gosub junit_report_fail_diff
631 $ endif
632 $ return
633 $!
634 $!
635 $
636 $! more common tests, without a data file: gawk -f 'test'.awk
637 $ofmta:
638 $ if arch_name .eqs. "VAX"
639 $ then
640 $ test_class = "basic"
641 $ skip_reason = "skipped on VAX"
642 $ gosub junit_report_skip
643 $ return
644 $ endif
645 $arrayref:
646 $arryref2:
647 $arrymem1:
648 $arynasty:
649 $arysubnm:
650 $aryunasgn:
651 $badassign1:
652 $badbuild:
653 $callparam:
654 $closebad:
655 $compare2:
656 $concat2:
657 $concat3:
658 $concat5:
659 $convfmt:
660 $delargv:
661 $delarpm2:
662 $delarprm:
663 $dynlj:
664 $exit2:
665 $fordel:
666 $forref:
667 $forsimp:
668 $funsemnl:
669 $getline3:
670 $hsprint:
671 $intest:
672 $math:
673 $memleak:
674 $minusstr:
675 $negrange:
676 $nulinsrc:
677 $numstr1:
678 $nlstrina:
679 $octsub:
680 $ofmtstrnum:
681 $paramtyp:
682 $paramuninitglobal:
683 $pcntplus:
684 $printf1:
685 $prt1eval:
686 $rebt8b1:
687 $regexprange:
688 $regrange:
689 $setrec1:
690 $splitdef:
691 $splitwht:
692 $strnum1:
693 $substr:
694 $zero2:
695 $zeroflag:
696 $ test_class = "basic"
697 $ goto common_without_test_in
698 $isarrayunset:
699 $ test_class = "extra"
700 $ goto common_without_test_in
701 $!
702 $aarray1:
703 $aasort:
704 $aasorti:
705 $arraysort:
706 $delsub:
707 $fpat2:
708 $gensub2:
709 $gnuops2:
710 $gnuops3:
711 $gnureops:
712 $icasefs:
713 $match1:
714 $nondec:
715 $patsplit:
716 $procinfs:
717 $regx8bit:
718 $sortu:
719 $strtonum:
720 $switch2:
721 $ test_class = "gawk_ext"
722 $ goto common_without_test_in
723 $!
724 $asort:
725 $asorti:
726 $fnarydel:
727 $fnparydl:
728 $rebt8b2:
729 $sort1:
730 $ test_class = "charset_tests"
731 $ goto common_without_test_in
732 $!
733 $common_without_test_in:
734 $! common without 'test'.in
735 $ echo "''test'"
736 $ set noOn
737 $ gawk -f 'test'.awk 2>&1 >_'test'.tmp
738 $ if .not. $status then call exit_code '$status' _'test'.tmp
739 $ set On
740 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
741 $ then
742 $ delete sys$disk:[]_'test'.tmp;2
743 $ endif
744 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
745 $ if $status
746 $ then
747 $ rm _'test'.tmp;
748 $ gosub junit_report_pass
749 $ else
750 $ gosub junit_report_fail_diff
751 $ endif
752 $ return
753 $
754 $colonwarn: echo "''test'"
755 $ test_class = "gawk_ext"
756 $ if f$search("sys$disk:[]_''test'*.tmp;*") .nes. ""
757 $ then
758 $ rm _'test'*.tmp;*
759 $ endif
760 $ if f$search("sys$disk:[]_''test'*.err;*") .nes. ""
761 $ then
762 $ rm _'test'*.err;*
763 $ endif
764 $ define/user sys$error _'test'.err
765 $ gawk -f 'test'.awk 1 < 'test'.in > _'test'.tmp
766 $ define/user sys$error _'test'_2.err
767 $ gawk -f 'test'.awk 2 < 'test'.in > _'test'_2.tmp
768 $ define/user sys$error _'test'_3.err
769 $ gawk -f 'test'.awk 3 < 'test'.in > _'test'_3.tmp
770 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
771 $ then
772 $ delete sys$disk:[]_'test'_%.tmp;2
773 $ endif
774 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
775 $ then
776 $ delete sys$disk:[]_'test'.tmp;2
777 $ endif
778 $ append -
779 sys$disk:[]_'test'.tmp,sys$disk:[]_'test'.err,-
780 sys$disk:[]_'test'_2.tmp,sys$disk:[]_'test'_2.err,-
781 sys$disk:[]_'test'_3.tmp -
782 _'test'_3.err
783 $ cmp 'test'.ok sys$disk:[]_'test'_3.err;1
784 $ if $status
785 $ then
786 $ rm _'test'*.tmp;*
787 $ rm _'test'*.err;*
788 $ gosub junit_report_pass
789 $ else
790 $ gosub junit_report_fail_diff
791 $ endif
792 $ return
793 $
794 $dbugeval:
795 $ echo "''test'"
796 $ test_class = "gawk_ext"
797 $ if f$getdvi("SYS$COMMAND", "TRM")
798 $ then
799 $ set noOn
800 $ gawk --debug -f /dev/null < 'test'.in 2>&1 > _'test.tmp'
801 $ if .not. $status then call exit_code '$status' _'test'.tmp
802 $ set On
803 $ cmp 'test'.ok sys$disk:[]_'test'.tmp;1
804 $ if $status
805 $ then
806 $ rm _'test'*.tmp;*
807 $ gosub junit_report_pass
808 $ else
809 $ gosub junit_report_fail_diff
810 $ endif
811 $ else
812 $ skip_reason = "Skipping because not a terminal."
813 $ gosub junit_report_skip
814 $ endif
815 $ return
816 $!
817 $rsglstdin:
818 $ echo "''test'"
819 $ test_class = "gawk_ext"
820 $ set noOn
821 $ define/user sys$input rsgetline.in
822 $ if f$search("sys$disk:[]_''test'.tmp;*") .nes. ""
823 $ then
824 $ delete sys$disk:[]_'test'.tmp;*
825 $ endif
826 $ gawk -f rsgetline.awk 2>&1 > _'test'.tmp
827 $ gawk_status = $status
828 $ set On
829 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
830 $ then
831 $ delete sys$disk:[]_'test'.tmp;2
832 $ endif
833 $ if .not. gawk_status then call exit_code 'gawk_status' _'test'.tmp
834 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
835 $ if $status
836 $ then
837 $ rm _'test'.tmp;
838 $ gosub junit_report_pass
839 $ else
840 $ gosub junit_report_fail_diff
841 $ endif
842 $ return
843 $!
844 $genpot:
845 $ echo "''test'"
846 $ test_class = "gawk_ext"
847 $ set noOn
848 $ gawk -f 'test'.awk --gen-pot 2>&1 >_'test'.tmp
849 $ if .not. $status then call exit_code '$status' _'test'.tmp
850 $ set On
851 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
852 $ if $status
853 $ then
854 $ rm _'test'.tmp;
855 $ gosub junit_report_pass
856 $ else
857 $ gosub junit_report_fail_diff
858 $ endif
859 $ return
860 $!
861 $paramasfunc1:
862 $paramasfunc2:
863 $ echo "''test'"
864 $ test_class = "gawk_ext"
865 $ set noOn
866 $ gawk -f 'test'.awk --posix 2>&1 >_'test'.tmp
867 $ if .not. $status then call exit_code '$status' _'test'.tmp
868 $ set On
869 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
870 $ if $status
871 $ then
872 $ rm _'test'.tmp;
873 $ gosub junit_report_pass
874 $ else
875 $ gosub junit_report_fail_diff
876 $ endif
877 $ return
878 $!
879 $watchpoint1:
880 $ echo "''test'"
881 $ test_class = "gawk_ext"
882 $ set noOn
883 $ gawk "-D" -f 'test'.awk 'test'.in < 'test'.script 2>&1 >_'test'.tmp
884 $ if .not. $status then call exit_code '$status' _'test'.tmp
885 $ set On
886 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
887 $ if $status
888 $ then
889 $ rm _'test'.tmp;
890 $ gosub junit_report_pass
891 $ else
892 $ gosub junit_report_fail_diff
893 $ endif
894 $ return
895 $!
896 $!
897 $!
898 $fork: ! 4.0.2
899 $fork2: ! 4.0.2
900 $ test_class = "shlib"
901 $ skip_reasons = "''test' not implemented on VMS"
902 $ gosub junit_report_skip
903 $ return
904 $!
905 $testext:
906 $ echo "''test'"
907 $ test_class = "shlib"
908 $ if arch_name .eqs. "VAX"
909 $ then
910 $ skip_reason = "ODS-5 required"
911 $ gosub junit_report_skip
912 $ return
913 $ endif
914 $ set process/parse=extended ! ODS-5 only
915 $ gawk "/^(@load|BEGIN)/,/^}/" [-.extension]'test'.c > _'test'.awk
916 $ set noOn
917 $ AWKLIBPATH_dir
918 $ gawk -f _'test'.awk >_'test'.tmp 2>&1
919 $ if .not. $status then call exit_code '$status' _'test'.tmp
920 $ gawk "{gsub(""no children"",""No child processes"")}1" -
921 _'test'.tmp >_'test'.tmp1
922 $ rm sys$disk:[]_'test'.tmp;*
923 $ mv sys$disk:[]_'test'.tmp1 sys$disk:[]_'test'.tmp
924 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
925 $ if $status
926 $ then
927 $ rm _'test'.tmp;
928 $ gosub junit_report_pass
929 $ else
930 $ gosub junit_report_fail_diff
931 $ endif
932 $ set On
933 $ return
934 $!
935 $double1:
936 $double2:
937 $ echo "''test'"
938 $ test_class = "hardware"
939 $ skip_reason = "skipped"
940 $ gosub junit_report_skip
941 $ return
942 $
943 $getline5: echo "''test'"
944 $ test_class = "basic"
945 $ ! Use of echo and rm inside the awk script makes it necessary
946 $ ! for some temporary redefinitions. The VMS gawk.exe also creates
947 $ ! multiple output files. Only the first contains the data.
948 $ old_echo = echo
949 $ old_rm = rm
950 $ echo = "pipe write sys$output"
951 $ rm = "!"
952 $ gawk -f 'test'.awk > _'test'.tmp
953 $ echo = old_echo
954 $ rm = old_rm
955 $ delsym old_echo
956 $ delsym old_rm
957 $ cmp 'test'.ok sys$disk:[]_'test'.tmp;1
958 $ if $status
959 $ then
960 $ rm _'test'.tmp;*,f.;*
961 $ gosub junit_report_pass
962 $ else
963 $ gosub junit_report_fail_diff
964 $ endif
965 $ return
966 $
967 $msg:
968 $ ! first show gawk's version (without copyright notice)
969 $ gawk --version >_msg.tmp
970 $ gawk "FNR == 1 {print; exit}" _msg.tmp
971 $ rm _msg.tmp;
972 $ echo "Any output from ""DIF"" is bad news, although some differences"
973 $ echo "in floating point values are probably benign -- in particular,"
974 $ echo "some systems may omit a leading zero and the floating point"
975 $ echo "precision may lead to slightly different output in a few cases."
976 $ echo ""
977 $ return
978 $!
979 $charset_msg_start:
980 $ echo "======== Starting tests that can vary based on character set ========"
981 $ echo "======== or locale support ========"
982 $ echo "*********************************************************************"
983 $ echo "* Some or all of these tests may fail if you have inadequate or *"
984 $ echo "* missing locale support. At least en_US.UTF-8, ru_RU.UTF-8 and *"
985 $ echo "* ja_JP.UTF-8 are needed. However, if you see this message, then *"
986 $ echo "* this test script thinks you have what you need ... *"
987 $ echo "*********************************************************************"
988 $ echo ""
989 $ return
990 $!
991 $charset_msg_end:
992 $ echo "======== Done with tests that can vary based on character set ========"
993 $ echo "======== or locale support ========"
994 $ echo ""
995 $ return
996 $!
997 $printlang:
998 $! the default locale is C, with LC_LANG and LC_ALL left empty;
999 $! showing that at the very beginning may cause some confusion about
1000 $! whether gawk requires those, so we don't run this as the first test
1001 $ gawk -f printlang.awk
1002 $ return
1003 $
1004 $poundbang:
1005 $ echo "''test'"
1006 $ test_class = "unix_tests"
1007 $ skip_reason = "not supported"
1008 $ gosub junit_report_skip
1009 $ return
1010 $!
1011 $pty1:
1012 $ echo "''test'"
1013 $ test_class = "gawk_ext"
1014 $ skip_reason = "not supported"
1015 $ gosub junit_report_skip
1016 $ return
1017 $!
1018 $rscompat:
1019 $ echo "''test'"
1020 $ test_class = "basic"
1021 $ gawk --traditional -f 'test'.awk 'test'.in >_'test'.tmp
1022 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1023 $ then
1024 $ delete sys$disk:[]_'test'.tmp;2
1025 $ endif
1026 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
1027 $ if $status
1028 $ then
1029 $ rm _'test'.tmp;
1030 $ gosub junit_report_pass
1031 $ else
1032 $ gosub junit_report_fail_diff
1033 $ endif
1034 $ return
1035 $!
1036 $
1037 $
1038 $messages: echo "''test'"
1039 $ test_class = "basic"
1040 $ set noOn
1041 $ gawk -f 'test'.awk > _out2 >& _out3
1042 $ cmp out1.ok sys$disk:[]_out1.
1043 $ if $status then rm _out1.;
1044 $ cmp out2.ok sys$disk:[]_out2.
1045 $ if $status then rm _out2.;
1046 $ cmp out3.ok sys$disk:[]_out3.
1047 $ if $status
1048 $ then
1049 $ rm _out3.;
1050 $ gosub junit_report_pass
1051 $ else
1052 $ gosub junit_report_fail_diff
1053 $ endif
1054 $ set On
1055 $ return
1056 $
1057 $argarray: echo "argarray"
1058 $ test_class = "basic"
1059 $ copy sys$disk:[]argarray.in sys$disk:[]argarray.input
1060 $ purge sys$disk:[]argarray.input
1061 $ define/User TEST "test" !this is useless...
1062 $ gawk -f argarray.awk ./argarray.input - >_argarray.tmp
1063 just a test
1064 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1065 $ then
1066 $ delete sys$disk:[]_'test'.tmp;2
1067 $ endif
1068 $ cmp argarray.ok sys$disk:[]_argarray.tmp
1069 $ if $status
1070 $ then
1071 $ rm _argarray.tmp;,sys$disk:[]argarray.input;
1072 $ gosub junit_report_pass
1073 $ else
1074 $ gosub junit_report_fail_diff
1075 $ endif
1076 $ return
1077 $
1078 $fstabplus: echo "fstabplus"
1079 $ test_class = "basic"
1080 $ gawk -f fstabplus.awk >_fstabplus.tmp
1081 1 2
1082 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1083 $ then
1084 $ delete sys$disk:[]_'test'.tmp;2
1085 $ endif
1086 $ cmp fstabplus.ok sys$disk:[]_fstabplus.tmp
1087 $ if $status
1088 $ then
1089 $ rm _'test'.tmp;
1090 $ gosub junit_report_pass
1091 $ else
1092 $ gosub junit_report_fail_diff
1093 $ endif
1094 $ return
1095 $
1096 $longwrds: echo "longwrds"
1097 $ test_class = "basic"
1098 $ gawk -v "SORT=sort sys$input: _longwrds.tmp" -f longwrds.awk longwrds.in >_NL:
1099 $ cmp longwrds.ok sys$disk:[]_longwrds.tmp
1100 $ if $status
1101 $ then
1102 $ rm _longwrds.tmp;
1103 $ gosub junit_report_pass
1104 $ else
1105 $ gosub junit_report_fail_diff
1106 $ endif
1107 $ return
1108 $
1109 $fieldwdth: echo "fieldwdth"
1110 $ test_class = "gawk_ext"
1111 $ gawk -v "FIELDWIDTHS=2 3 4" "{ print $2}" >_fieldwdth.tmp
1112 123456789
1113 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1114 $ then
1115 $ delete sys$disk:[]_'test'.tmp;2
1116 $ endif
1117 $ cmp fieldwdth.ok sys$disk:[]_fieldwdth.tmp
1118 $ if $status
1119 $ then
1120 $ rm _fieldwdth.tmp;
1121 $ gosub junit_report_pass
1122 $ else
1123 $ gosub junit_report_fail_diff
1124 $ endif
1125 $ return
1126 $
1127 $ignrcase: echo "ignrcase"
1128 $ test_class = "gawk_ext"
1129 $ gawk -v "IGNORECASE=1" "{ sub(/y/, """"); print}" >_ignrcase.tmp
1130 xYz
1131 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1132 $ then
1133 $ delete sys$disk:[]_'test'.tmp;2
1134 $ endif
1135 $ cmp ignrcase.ok sys$disk:[]_ignrcase.tmp
1136 $ if $status
1137 $ then
1138 $ rm _ignrcase.tmp;
1139 $ gosub junit_report_pass
1140 $ else
1141 $ gosub junit_report_fail_diff
1142 $ endif
1143 $ return
1144 $
1145 $regtest:
1146 $ echo "regtest"
1147 $ test_class = "extra"
1148 $ if f$search("regtest.com").eqs.""
1149 $ then
1150 $ skip_reason = "Not implemented on VMS"
1151 $ gosub junit_report_skip
1152 $ else
1153 $ echo "regtest"
1154 $ echo "Some of the output from regtest is very system specific, do not"
1155 $ echo "be distressed if your output differs from that distributed."
1156 $ echo "Manual inspection is called for."
1157 $ @regtest.com
1158 $ skip_reason = "Not implemented on VMS"
1159 $ gosub junit_report_skip
1160 $ endif
1161 $ return
1162 $
1163 $posix: echo "posix"
1164 $ test_class = "gawk_ext"
1165 $ gawk -f posix.awk >_posix.tmp
1166 1:2,3 4
1167 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1168 $ then
1169 $ delete sys$disk:[]_'test'.tmp;2
1170 $ endif
1171 $ cmp posix.ok sys$disk:[]_posix.tmp
1172 $ if $status
1173 $ then
1174 $ rm _posix.tmp;
1175 $ gosub junit_report_pass
1176 $ else
1177 $ gosub junit_report_fail_diff
1178 $ endif
1179 $ return
1180 $
1181 $manyfiles: echo "manyfiles"
1182 $ test_class = "gawk_ext"
1183 $!! this used to use a hard-coded value of 300 simultaneously open
1184 $!! files, but if our open file quota is generous enough then that
1185 $!! wouldn't exercise the ability to handle more than the maximum
1186 $!! number allowed at once
1187 $ f_cnt = 300
1188 $ chnlc = f$getsyi("CHANNELCNT")
1189 $ fillm = f$getjpi("","FILLM")
1190 $ if fillm.ge.chnlc then fillm = chnlc - 1
1191 $ if fillm.ge.f_cnt then f_cnt = fillm + 10
1192 $ if f$search("sys$disk:[.junk]*.*").nes.""
1193 $ then
1194 $ rm sys$disk:[.junk]*.*;*
1195 $ endif
1196 $ if f$parse("sys$disk:[.junk]") .eqs. ""
1197 $ then
1198 $ create/Dir/Prot=(O:rwed) sys$disk:[.junk]
1199 $ endif
1200 $ gawk -- "BEGIN {for (i = 1; i <= ''f_cnt'; i++) print i, i}" -
1201 >_manyfiles.dat
1202 $ echo "(processing ''f_cnt' files; this may take quite a while)"
1203 $ set noOn ! continue even if gawk fails
1204 $ gawk -f manyfiles.awk _manyfiles.dat _manyfiles.dat
1205 $ define/User sys$error _NL:
1206 $ define/User sys$output _manyfiles.tmp
1207 $ search/Match=Nor/Output=_NL:/Log sys$disk:[.junk]*.* ""
1208 $!/Log output: "%SEARCH-S-NOMATCH, <filename> - <#> records" plus 1 line summary
1209 $ gawk -v "F_CNT=''f_cnt'" -f - _manyfiles.tmp
1210 $deck !some input begins with "$"
1211 $4 != 2 {++count}
1212 END {if (NR != F_CNT+1 || count != 1) {print "\nFailed!"}}
1213 $eod
1214 $ set On
1215 $ skip_reason = "Test detection not implemented yet"
1216 $ gosub junit_report_skip
1217 $ rm sys$disk:_manyfiles.tmp;,sys$disk:_manyfiles.dat;
1218 $ rm sys$disk:[.junk]*.*;*,sys$disk:[]junk.dir;
1219 $ return
1220 $
1221 $compare: echo "compare"
1222 $ test_class = "basic"
1223 $ gawk -f compare.awk 0 1 compare.in >_compare.tmp
1224 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1225 $ then
1226 $ delete sys$disk:[]_'test'.tmp;2
1227 $ endif
1228 $ cmp compare.ok sys$disk:[]_compare.tmp
1229 $ if $status
1230 $ then
1231 $ rm _compare.tmp;
1232 $ gosub junit_report_pass
1233 $ else
1234 $ gosub junit_report_fail_diff
1235 $ endif
1236 $ return
1237 $
1238 $rs: echo "rs"
1239 $ test_class = "basic"
1240 $ gawk -v "RS=" "{ print $1, $2}" rs.in >_rs.tmp
1241 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1242 $ then
1243 $ delete sys$disk:[]_'test'.tmp;2
1244 $ endif
1245 $ cmp rs.ok sys$disk:[]_rs.tmp
1246 $ if $status
1247 $ then
1248 $ rm _rs.tmp;
1249 $ gosub junit_report_pass
1250 $ else
1251 $ gosub junit_report_fail_diff
1252 $ endif
1253 $ return
1254 $
1255 $fsbs: echo "fsbs"
1256 $ test_class = "basic"
1257 $ gawk -f fsbs.awk fsbs.in >_fsbs.tmp
1258 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1259 $ then
1260 $ delete sys$disk:[]_'test'.tmp;2
1261 $ endif
1262 $ cmp fsbs.ok sys$disk:[]_fsbs.tmp
1263 $ if $status
1264 $ then
1265 $ rm _fsbs.tmp;
1266 $ gosub junit_report_pass
1267 $ else
1268 $ gosub junit_report_fail_diff
1269 $ endif
1270 $ return
1271 $
1272 $inftest: echo "inftest"
1273 $ test_class = "extra"
1274 $ !! echo "This test is very machine specific..."
1275 $ set noOn
1276 $ gawk -f inftest.awk >_inftest.tmp
1277 $ !! cmp inftest.ok sys$disk:[]_inftest.tmp !just care that gawk doesn't crash...
1278 $ if $status
1279 $ then
1280 $ rm _inftest.tmp;
1281 $ gosub junit_report_pass
1282 $ else
1283 $ gosub junit_report_fail_diff
1284 $ endif
1285 $ set On
1286 $ return
1287 $
1288 $getline2: echo "getline2"
1289 $ test_class = "basic"
1290 $ gawk -f getline2.awk getline2.awk getline2.awk >_getline2.tmp
1291 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1292 $ then
1293 $ delete sys$disk:[]_'test'.tmp;2
1294 $ endif
1295 $ cmp getline2.ok sys$disk:[]_getline2.tmp
1296 $ if $status
1297 $ then
1298 $ rm _getline2.tmp;
1299 $ gosub junit_report_pass
1300 $ else
1301 $ gosub junit_report_fail_diff
1302 $ endif
1303 $ return
1304 $
1305 $rand: echo "rand"
1306 $ test_class = "basic"
1307 $ echo "The following line should just be 19 random numbers between 1 and 100"
1308 $ echo ""
1309 $ gawk -f rand.awk
1310 $ skip_reason = "Test detection not implemented yet"
1311 $ gosub junit_report_skip
1312 $ return
1313 $
1314 $negexp: echo "negexp"
1315 $ test_class = "basic"
1316 $ gawk "BEGIN { a = -2; print 10^a }" >_negexp.tmp
1317 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1318 $ then
1319 $ delete sys$disk:[]_'test'.tmp;2
1320 $ endif
1321 $ cmp negexp.ok sys$disk:[]_negexp.tmp
1322 $ if $status
1323 $ then
1324 $ rm _negexp.tmp;
1325 $ gosub junit_report_pass
1326 $ else
1327 $ gosub junit_report_fail_diff
1328 $ endif
1329 $ return
1330 $
1331 $awkpath: echo "awkpath"
1332 $ test_class = "basic"
1333 $ define/User AWK_LIBRARY [],[.lib]
1334 $ gawk -f awkpath.awk >_awkpath.tmp
1335 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1336 $ then
1337 $ delete sys$disk:[]_'test'.tmp;2
1338 $ endif
1339 $ cmp awkpath.ok sys$disk:[]_awkpath.tmp
1340 $ if $status
1341 $ then
1342 $ rm _awkpath.tmp;
1343 $ gosub junit_report_pass
1344 $ else
1345 $ gosub junit_report_fail_diff
1346 $ endif
1347 $ return
1348 $
1349 $argtest: echo "argtest"
1350 $ test_class = "gawk_ext"
1351 $ gawk -f argtest.awk -x -y abc >_argtest.tmp
1352 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1353 $ then
1354 $ delete sys$disk:[]_'test'.tmp;2
1355 $ endif
1356 $ cmp argtest.ok sys$disk:[]_argtest.tmp
1357 $ if $status
1358 $ then
1359 $ rm _argtest.tmp;
1360 $ gosub junit_report_pass
1361 $ else
1362 $ gosub junit_report_fail_diff
1363 $ endif
1364 $ return
1365 $
1366 $badargs: echo "badargs"
1367 $ test_class = "gawk_ext"
1368 $ on error then continue
1369 $ gawk -f 2>&1 >_badargs.too
1370 $ if f$search("sys$disk:[]_''test'.too;2") .nes. ""
1371 $ then
1372 $ delete sys$disk:[]_'test'.too;2
1373 $ endif
1374 $! search/Match=Nor _badargs.too "patchlevel" /Output=_badargs.tmp
1375 $ gawk "/patchlevel/{next}; {gsub(""\"""",""'""); print}" <_badargs.too >_badargs.tmp
1376 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1377 $ then
1378 $ delete sys$disk:[]_'test'.tmp;2
1379 $ endif
1380 $ cmp badargs.ok sys$disk:[]_badargs.tmp
1381 $ if $status
1382 $ then
1383 $ rm _badargs.tmp;,_badargs.too;
1384 $ gosub junit_report_pass
1385 $ else
1386 $ gosub junit_report_fail_diff
1387 $ endif
1388 $ return
1389 $
1390 $nonl: echo "nonl"
1391 $ test_class = "basic"
1392 $ ! This one might fail, depending on the tool used to unpack the
1393 $ ! distribution. Some will add a final newline if the file lacks one.
1394 $ AWKPATH_srcdir
1395 $ gawk --lint -f nonl.awk _NL: >_nonl.tmp 2>&1
1396 $ cmp nonl.ok sys$disk:[]_nonl.tmp
1397 $ if $status
1398 $ then
1399 $ rm _nonl.tmp;
1400 $ gosub junit_report_pass
1401 $ else
1402 $ gosub junit_report_fail_diff
1403 $ endif
1404 $ return
1405 $
1406 $defref: echo "defref"
1407 $ test_class = "basic"
1408 $ set noOn
1409 $ AWKPATH_srcdir
1410 $ gawk --lint -f defref.awk >_defref.tmp 2>&1
1411 $ if .not. $status then call exit_code '$status' _defref.tmp
1412 $ set On
1413 $ cmp defref.ok sys$disk:[]_defref.tmp
1414 $ if $status
1415 $ then
1416 $ rm _defref.tmp;
1417 $ gosub junit_report_pass
1418 $ else
1419 $ gosub junit_report_fail_diff
1420 $ endif
1421 $ return
1422 $
1423 $nofmtch: echo "nofmtch"
1424 $ test_class = "basic"
1425 $ AWKPATH_srcdir
1426 $ gawk --lint -f nofmtch.awk >_nofmtch.tmp 2>&1
1427 $ cmp nofmtch.ok sys$disk:[]_nofmtch.tmp
1428 $ if $status
1429 $ then
1430 $ rm _nofmtch.tmp;
1431 $ gosub junit_report_pass
1432 $ else
1433 $ gosub junit_report_fail_diff
1434 $ endif
1435 $ return
1436 $
1437 $strftime: echo "strftime"
1438 $ test_class = "gawk_ext"
1439 $ ! this test could fail on slow machines or on a second boundary,
1440 $ ! so if it does, double check the actual results
1441 $ ! This test needs SYS$TIMEZONE_NAME and SYS$TIMEZONE_RULE
1442 $ ! to be properly defined.
1443 $ ! This test now needs GNV Coreutils to work
1444 $ date_bin = "gnv$gnu:[bin]gnv$date.exe"
1445 $ if f$search(date_bin) .eqs. ""
1446 $ then
1447 $ skip_reason = "Need GNV Coreutils gnv$date.exe"
1448 $ gosub junit_report_skip
1449 $ return
1450 $ endif
1451 $ date := $'date_bin'
1452 $!! date | gawk -v "OUTPUT"=_strftime.tmp -f strftime.awk
1453 $ now = f$time()
1454 $ wkd = f$extract(0,3,f$cvtime(now,,"WEEKDAY"))
1455 $ mon = f$cvtime(now,"ABSOLUTE","MONTH")
1456 $ mon = f$extract(0,1,mon) + f$edit(f$extract(1,2,mon),"LOWERCASE")
1457 $ day = f$cvtime(now,,"DAY")
1458 $ tim = f$extract(0,8,f$cvtime(now,,"TIME"))
1459 $! Can not use tz as it shows up in the C environment.
1460 $ timezone = f$trnlnm("SYS$TIMEZONE_NAME")
1461 $ yr = f$cvtime(now,,"YEAR")
1462 $ if f$trnlnm("FTMP").nes."" then close/noLog ftmp
1463 $ open/Write ftmp strftime.in
1464 $ write ftmp wkd," ",mon," ",day," ",tim," ",timezone," ",yr
1465 $ close ftmp
1466 $ gawk -v "OUTPUT"=_strftime.tmp -f strftime.awk strftime.in
1467 $ set noOn
1468 $ cmp strftime.ok sys$disk:[]_strftime.tmp
1469 $ if $status
1470 $ then
1471 $ rm _strftime.tmp;,strftime.ok;*,strftime.in;*
1472 $ gosub junit_report_pass
1473 $ else
1474 $ gosub junit_report_fail_diff
1475 $ endif
1476 $ set On
1477 $ return
1478 $
1479 $litoct: echo "litoct"
1480 $ test_class = "basic"
1481 $ gawk --traditional -f litoct.awk >_litoct.tmp
1482 ab
1483 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1484 $ then
1485 $ delete sys$disk:[]_'test'.tmp;2
1486 $ endif
1487 $ cmp litoct.ok sys$disk:[]_litoct.tmp
1488 $ if $status
1489 $ then
1490 $ rm _litoct.tmp;
1491 $ gosub junit_report_pass
1492 $ else
1493 $ gosub junit_report_fail_diff
1494 $ endif
1495 $ return
1496 $
1497 $resplit: echo "resplit"
1498 $ test_class = "gawk_ext"
1499 $ gawk -- "{ FS = "":""; $0 = $0; print $2 }" >_resplit.tmp
1500 a:b:c d:e:f
1501 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1502 $ then
1503 $ delete sys$disk:[]_'test'.tmp;2
1504 $ endif
1505 $ cmp resplit.ok sys$disk:[]_resplit.tmp
1506 $ if $status
1507 $ then
1508 $ rm _resplit.tmp;
1509 $ gosub junit_report_pass
1510 $ else
1511 $ gosub junit_report_fail_diff
1512 $ endif
1513 $ return
1514 $
1515 $intprec: echo "intprec"
1516 $ test_class = "basic"
1517 $ gawk -f intprec.awk >_intprec.tmp 2>&1
1518 $ cmp intprec.ok sys$disk:[]_intprec.tmp
1519 $ if $status
1520 $ then
1521 $ rm _intprec.tmp;
1522 $ gosub junit_report_pass
1523 $ else
1524 $ gosub junit_report_fail_diff
1525 $ endif
1526 $ return
1527 $
1528 $incdupe: echo "''test'"
1529 $ test_class = "gawk_ext"
1530 $ set noOn
1531 $ gawk --lint -i inclib -i inclib.awk "BEGIN {print sandwich(""a"", ""b"", ""c"")}" > _'test'.tmp 2>&1
1532 $ if .not. $status then call exit_code '$status' _'test'.tmp
1533 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
1534 $ if $status
1535 $ then
1536 $ rm _'test'.tmp;*
1537 $ gosub junit_report_pass
1538 $ else
1539 $ gosub junit_report_fail_diff
1540 $ endif
1541 $ set On
1542 $ return
1543 $
1544 $incdupe2: echo "''test'"
1545 $ test_class = "gawk_ext"
1546 $ set noOn
1547 $ gawk --lint -f inclib -f inclib.awk >_'test'.tmp 2>&1
1548 $ if .not. $status then call exit_code '$status' _'test'.tmp
1549 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
1550 $ if $status
1551 $ then
1552 $ rm _'test'.tmp;*
1553 $ gosub junit_report_pass
1554 $ else
1555 $ gosub junit_report_fail_diff
1556 $ endif
1557 $ set On
1558 $ return
1559 $
1560 $incdupe3: echo "''test'"
1561 $ test_class = "gawk_ext"
1562 $ gawk --lint -f hello -f hello.awk >_'test'.tmp 2>&1
1563 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
1564 $ if $status
1565 $ then
1566 $ rm _'test'.tmp;*
1567 $ gosub junit_report_pass
1568 $ else
1569 $ gosub junit_report_fail_diff
1570 $ endif
1571 $ return
1572 $
1573 $incdupe4: echo "''test'"
1574 $ test_class = "gawk_ext"
1575 $ set NoOn
1576 $ gawk --lint -f hello -i hello.awk >_'test'.tmp 2>&1
1577 $ if .not. $status then call exit_code '$status' _'test'.tmp
1578 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
1579 $ if $status
1580 $ then
1581 $ rm _'test'.tmp;*
1582 $ gosub junit_report_pass
1583 $ else
1584 $ gosub junit_report_fail_diff
1585 $ endif
1586 $ set On
1587 $ return
1588 $
1589 $incdupe5: echo "''test'"
1590 $ test_class = "gawk_ext"
1591 $ set NoOn
1592 $ gawk --lint -i hello -f hello.awk >_'test'.tmp 2>&1
1593 $ if .not. $status then call exit_code '$status' _'test'.tmp
1594 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
1595 $ if $status
1596 $ then
1597 $ rm _'test'.tmp;*
1598 $ gosub junit_report_pass
1599 $ else
1600 $ gosub junit_report_fail_diff
1601 $ endif
1602 $ set On
1603 $ return
1604 $
1605 $incdupe6: echo "''test'"
1606 $ test_class = "gawk_ext"
1607 $ set NoOn
1608 $ gawk --lint -i inchello -f hello.awk >_'test'.tmp 2>&1
1609 $ if .not. $status then call exit_code '$status' _'test'.tmp
1610 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
1611 $ if $status
1612 $ then
1613 $ rm _'test'.tmp;*
1614 $ gosub junit_report_pass
1615 $ else
1616 $ gosub junit_report_fail_diff
1617 $ endif
1618 $ set On
1619 $ return
1620 $
1621 $incdupe7: echo "''test'"
1622 $ test_class = "gawk_ext"
1623 $ set NoOn
1624 $ gawk --lint -f hello -i inchello >_'test'.tmp 2>&1
1625 $ if .not. $status then call exit_code '$status' _'test'.tmp
1626 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
1627 $ if $status
1628 $ then
1629 $ rm _'test'.tmp;*
1630 $ gosub junit_report_pass
1631 $ else
1632 $ gosub junit_report_fail_diff
1633 $ endif
1634 $ set On
1635 $ return
1636 $
1637 $include2: echo "''test'"
1638 $ test_class = "gawk_ext"
1639 $ gawk -i inclib "BEGIN {print sandwich(""a"", ""b"", ""c"")}" >_'test'.tmp 2>&1
1640 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
1641 $ if $status
1642 $ then
1643 $ rm _'test'.tmp;*
1644 $ gosub junit_report_pass
1645 $ else
1646 $ gosub junit_report_fail_diff
1647 $ endif
1648 $ return
1649 $
1650 $id:
1651 $symtab1:
1652 $symtab2:
1653 $symtab3: echo "''test'"
1654 $ test_class = "gawk_ext"
1655 $ set noOn
1656 $ old_sort = sort
1657 $ sort = "@sys$disk:[-.vms]vms_sort.com"
1658 $ gawk -f 'test'.awk >_'test'.tmp 2>&1
1659 $ if .not. $status then call exit_code '$status' _'test'.tmp
1660 $ sort = old_sort
1661 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
1662 $ if $status
1663 $ then
1664 $ rm _'test'.tmp;*
1665 $ gosub junit_report_pass
1666 $ else
1667 $ gosub junit_report_fail_diff
1668 $ endif
1669 $ set On
1670 $ return
1671 $
1672 $symtab4:
1673 $symtab5:
1674 $symtab7: echo "''test'"
1675 $ test_class = "gawk_ext"
1676 $ set noOn
1677 $ gawk -f 'test'.awk <'test'.in >_'test'.tmp 2>&1
1678 $ if .not. $status then call exit_code '$status' _'test'.tmp
1679 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
1680 $ if $status
1681 $ then
1682 $ rm _'test'.tmp;*
1683 $ gosub junit_report_pass
1684 $ else
1685 $ gosub junit_report_fail_diff
1686 $ endif
1687 $ set On
1688 $ return
1689 $
1690 $symtab6: echo "''test'"
1691 $ test_class = "gawk_ext"
1692 $ tmp_error = "sys$disk:[]__''test'.tmp2"
1693 $ set noOn
1694 $ if f$search(tmp_error) then delete 'tmp_error';*
1695 $ define/user sys$error 'tmp_error'
1696 $ gawk -d__'test'.tmp -f 'test'.awk
1697 $ gawk_status = $status
1698 $ if f$search("sys$disk:[]__''test'.tmp") .eqs. ""
1699 $ then
1700 $ copy 'tmp_error' sys$disk:[]__'test.tmp'
1701 $ else
1702 $ append 'tmp_error' sys$disk:[]__'test.tmp'
1703 $ endif
1704 $ if .not. gawk_status then call exit_code 'gawk_status' __'test'.tmp
1705 $ pipe search __'test'.tmp "ENVIRON","PROCINFO" /match=nor > _'test'.tmp
1706 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
1707 $ if $status
1708 $ then
1709 $ rm _'test'.tmp;*,__'test'.tmp;*,'tmp_error';*
1710 $ gosub junit_report_pass
1711 $ else
1712 $ gosub junit_report_fail_diff
1713 $ endif
1714 $ set On
1715 $ return
1716 $
1717 $symtab8: echo "''test'"
1718 $ test_class = "gawk_ext"
1719 $ set noOn
1720 $ gawk -d__'test'.tmp -f 'test'.awk 'test'.in > _'test'.tmp
1721 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1722 $ then
1723 $ delete sys$disk:[]_'test'.tmp;2
1724 $ endif
1725 $ pipe search __'test'.tmp "ENVIRON","PROCINFO","FILENAME" /match=nor > ___'test'.tmp
1726 $ convert/append ___'test'.tmp _'test'.tmp
1727 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
1728 $ if $status
1729 $ then
1730 $ rm _'test'.tmp;*,__'test'.tmp;*,___'test'.tmp;*
1731 $ gosub junit_report_pass
1732 $ else
1733 $ gosub junit_report_fail_diff
1734 $ endif
1735 $ set On
1736 $ return
1737 $
1738 $!-----------------------------------------------------------------------------------
1739 $! This awk script performs some cleanup by doing "system (rm testit.txt)". This is
1740 $! good for Unix but a pain for VMS as we must specify version number when deleting
1741 $! a file. The workaround is to define "rm" as a VMS comment and deleting the file
1742 $! outside of the awk script.
1743 $! Additionally each awk "system" call results in a new version of the output file.
1744 $! so we need to compensate for that as well.
1745 $!-----------------------------------------------------------------------------------
1746 $symtab9: echo "''test'"
1747 $ test_class = "gawk_ext"
1748 $ old_rm = rm ! Remember old definition of rm
1749 $ rm = "!" ! Redefine rm to something harmless
1750 $ gawk -f 'test'.awk >_'test'.tmp
1751 $ rm = old_rm ! Restore old value
1752 $ delsym old_rm
1753 $ cmp 'test'.ok sys$disk:[]_'test'.tmp;-0 ! -0 is the lowest version
1754 $ if $status
1755 $ then
1756 $ rm _'test'.tmp;*,testit.txt;*
1757 $ gosub junit_report_pass
1758 $ else
1759 $ gosub junit_report_fail_diff
1760 $ endif
1761 $ return
1762 $!
1763 $symtab10: echo "''test'"
1764 $ test_class = "gawk_ext"
1765 $ set noOn
1766 $ define/user sys$error _'test'.tmp
1767 $ gawk -f 'test'.awk > _'test'.tmp2
1768 $ if .not. $status then call exit_code '$status' _'test'.tmp2
1769 $ append _'test'.tmp2 _'test'.tmp
1770 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
1771 $ if $status
1772 $ then
1773 $ rm _'test'.tmp;*
1774 $ gosub junit_report_pass
1775 $ else
1776 $ gosub junit_report_fail_diff
1777 $ endif
1778 $ set On
1779 $ return
1780 $!
1781 $ignrcas3: echo "''test'"
1782 $ test_class = "extra"
1783 $ if f$search("sys$i18n_locale:el_gr_iso8859-7.locale") .nes. ""
1784 $ then
1785 $ define/user LC_ALL "el_gr_iso8859-7"
1786 $ define/user GAWKLOCALE "el_gr_iso8859-7"
1787 $ AWKPATH_srcdir
1788 $! goto common_without_test_in
1789 $ skip_reason = "VMS EL_GR_ISO8859-7 locale fails test"
1790 $ gosub junit_report_skip
1791 $ else
1792 $ skip_reason = "EL_GR_ISO8859-7 locale not installed"
1793 $ gosub junit_report_skip
1794 $ endif
1795 $ return
1796 $!
1797 $nlstringtest: echo "''test'"
1798 $ test_class = "extra"
1799 $ ! This locale does not seem to be available from the HPE I18N kit.
1800 $ ! So this test has not been run on VMS.
1801 $ if f$search("sys$i18n_locale:fr_fr_utf-8.locale") .nes. ""
1802 $ then
1803 $ define/user LC_ALL "fr_fr_utf-8"
1804 $ define/user GAWKLOCALE "fr_fr_utf-8"
1805 $ AWKPATH_srcdir
1806 $! goto common_without_test_in
1807 $ skip_reason = "VMS FR_FR_UTF-8 locale test not validated."
1808 $ gosub junit_report_skip
1809 $ else
1810 $ skip_reason = "FR_FR_UTF-8 locale not installed"
1811 $ gosub junit_report_skip
1812 $ endif
1813 $ return
1814 $!
1815 $childin: echo "''test'"
1816 $ test_class = "basic"
1817 $ cat = "type sys$input"
1818 $ gawk -f 'test'.awk < 'test'.in > _'test'.tmp
1819 $ delsym cat
1820 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1821 $ then
1822 $ delete sys$disk:[]_'test'.tmp;2
1823 $ endif
1824 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
1825 $ if $status
1826 $ then
1827 $ rm _'test'.tmp;
1828 $ gosub junit_report_pass
1829 $ else
1830 $ gosub junit_report_fail_diff
1831 $ endif
1832 $ return
1833 $
1834 $noeffect: echo "noeffect"
1835 $ test_class = "basic"
1836 $ AWKPATH_srcdir
1837 $ gawk --lint -f noeffect.awk >_noeffect.tmp 2>&1
1838 $ cmp noeffect.ok sys$disk:[]_noeffect.tmp
1839 $ if $status
1840 $ then
1841 $ rm _noeffect.tmp;
1842 $ gosub junit_report_pass
1843 $ else
1844 $ gosub junit_report_fail_diff
1845 $ endif
1846 $ return
1847 $
1848 $numsubstr: echo "numsubstr"
1849 $ test_class = "basic"
1850 $ AWKPATH_srcdir
1851 $ gawk -f numsubstr.awk numsubstr.in >_numsubstr.tmp
1852 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1853 $ then
1854 $ delete sys$disk:[]_'test'.tmp;2
1855 $ endif
1856 $ cmp numsubstr.ok sys$disk:[]_numsubstr.tmp
1857 $ if $status
1858 $ then
1859 $ rm _numsubstr.tmp;
1860 $ gosub junit_report_pass
1861 $ else
1862 $ gosub junit_report_fail_diff
1863 $ endif
1864 $ return
1865 $
1866 $prmreuse: echo "prmreuse"
1867 $ test_class = "basic"
1868 $ if f$search("prmreuse.ok").eqs."" then create prmreuse.ok
1869 $ gawk -f prmreuse.awk >_prmreuse.tmp
1870 $ cmp prmreuse.ok sys$disk:[]_prmreuse.tmp
1871 $ if $status
1872 $ then
1873 $ rm _prmreuse.tmp;
1874 $ gosub junit_report_pass
1875 $ else
1876 $ gosub junit_report_fail_diff
1877 $ endif
1878 $ return
1879 $
1880 $fflush:
1881 $ echo "fflush"
1882 $ test_class = "unix_tests"
1883 $ skip_reason = "not supported"
1884 $ gosub junit_report_skip
1885 $ return
1886 $!!fflush: echo "fflush"
1887 $ ! hopelessly Unix-specific
1888 $!! @fflush.sh >_fflush.tmp
1889 $ cmp fflush.ok sys$disk:[]_fflush.tmp
1890 $ if $status
1891 $ then
1892 $ rm _fflush.tmp;
1893 $ gosub junit_report_pass
1894 $ else
1895 $ gosub junit_report_fail_diff
1896 $ endif
1897 $ return
1898 $
1899 $getlnhd:
1900 $ echo "getlnhd"
1901 $ !Expects a Unix shell
1902 $ test_class = "unix_tests"
1903 $ skip_reason = "Expects a Unix shell"
1904 $ gosub junit_report_skip
1905 $ return
1906 $!!getlnhd: echo "getlnhd"
1907 $ gawk -f getlnhd.awk >_getlnhd.tmp
1908 $ cmp getlnhd.ok sys$disk:[]_getlnhd.tmp
1909 $ if $status
1910 $ then
1911 $ rm _getlnhd.tmp;
1912 $ gosub junit_report_pass
1913 $ else
1914 $ gosub junit_report_fail_diff
1915 $ endif
1916 $ return
1917 $
1918 $tweakfld: echo "tweakfld"
1919 $ test_class = "basic"
1920 $ gawk -f tweakfld.awk tweakfld.in >_tweakfld.tmp
1921 $ if f$search("errors.cleanup").nes."" then rm errors.cleanup;*
1922 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1923 $ then
1924 $ delete sys$disk:[]_'test'.tmp;2
1925 $ endif
1926 $ cmp tweakfld.ok sys$disk:[]_tweakfld.tmp
1927 $ if $status
1928 $ then
1929 $ rm _tweakfld.tmp;
1930 $ gosub junit_report_pass
1931 $ else
1932 $ gosub junit_report_fail_diff
1933 $ endif
1934 $ return
1935 $
1936 $clsflnam: echo "clsflnam"
1937 $ test_class = "basic"
1938 $ if f$search("clsflnam.ok").eqs."" then create clsflnam.ok
1939 $ gawk -f clsflnam.awk clsflnam.in >_clsflnam.tmp 2>&1
1940 $ cmp clsflnam.ok sys$disk:[]_clsflnam.tmp
1941 $ if $status
1942 $ then
1943 $ rm _clsflnam.tmp;
1944 $ gosub junit_report_pass
1945 $ else
1946 $ gosub junit_report_fail_diff
1947 $ endif
1948 $ return
1949 $
1950 $mmap8k: echo "mmap8k"
1951 $ test_class = "basic"
1952 $ gawk "{ print }" mmap8k.in >_mmap8k.tmp
1953 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1954 $ then
1955 $ delete sys$disk:[]_'test'.tmp;2
1956 $ endif
1957 $ cmp mmap8k.in sys$disk:[]_mmap8k.tmp
1958 $ if $status
1959 $ then
1960 $ rm _mmap8k.tmp;
1961 $ gosub junit_report_pass
1962 $ else
1963 $ gosub junit_report_fail_diff
1964 $ endif
1965 $ return
1966 $
1967 $eofsplit: echo "eofsplit"
1968 $ test_class = "basic"
1969 $ if f$search("eofsplit.ok").eqs."" then create eofsplit.ok
1970 $ gawk -f eofsplit.awk >_eofsplit.tmp
1971 $ cmp eofsplit.ok sys$disk:[]_eofsplit.tmp
1972 $ if $status
1973 $ then
1974 $ rm _eofsplit.tmp;
1975 $ gosub junit_report_pass
1976 $ else
1977 $ gosub junit_report_fail_diff
1978 $ endif
1979 $ return
1980 $!
1981 $tradanch: echo "tradanch"
1982 $ test_class = "basic"
1983 $ if f$search("tradanch.ok").eqs."" then create tradanch.ok
1984 $ gawk --traditional -f tradanch.awk tradanch.in >_tradanch.tmp
1985 $ cmp tradanch.ok sys$disk:[]_tradanch.tmp
1986 $ if $status
1987 $ then
1988 $ rm _tradanch.tmp;
1989 $ gosub junit_report_pass
1990 $ else
1991 $ gosub junit_report_fail_diff
1992 $ endif
1993 $ return
1994 $
1995 $reginttrad: echo "''test'"
1996 $ test_class = "basic"
1997 $ gawk --traditional -r -f 'test'.awk >_'test'.tmp
1998 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
1999 $ then
2000 $ delete sys$disk:[]_'test'.tmp;2
2001 $ endif
2002 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
2003 $ if $status
2004 $ then
2005 $ rm _'test'.tmp;
2006 $ gosub junit_report_pass
2007 $ else
2008 $ gosub junit_report_fail_diff
2009 $ endif
2010 $ return
2011 $
2012 $pid: echo "pid"
2013 $ test_class = "unix_tests"
2014 $ pid = f$integer("%x" + f$getjpi("","PID"))
2015 $ ppid = f$integer("%x" + f$getjpi("","OWNER"))
2016 $ gawk -v "ok_pid=''pid'" -v "ok_ppid=''ppid'" -f pid.awk >_pid.tmp >& _NL:
2017 $ cmp pid.ok sys$disk:[]_pid.tmp
2018 $ if $status
2019 $ then
2020 $ rm _pid.tmp;
2021 $ gosub junit_report_pass
2022 $ else
2023 $ gosub junit_report_fail_diff
2024 $ endif
2025 $ return
2026 $
2027 $strftlng: echo "strftlng"
2028 $ test_class = "unix_tests"
2029 $ define/User TZ "UTC" !useless
2030 $ gawk -f strftlng.awk >_strftlng.tmp
2031 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2032 $ then
2033 $ delete sys$disk:[]_'test'.tmp;2
2034 $ endif
2035 $ cmp strftlng.ok sys$disk:[]_strftlng.tmp
2036 $ if $status
2037 $ then
2038 $ rm _strftlng.tmp;
2039 $ gosub junit_report_pass
2040 $ else
2041 $ gosub junit_report_fail_diff
2042 $ endif
2043 $ return
2044 $
2045 $nfldstr: echo "nfldstr"
2046 $ test_class = "basic"
2047 $ if f$search("nfldstr.ok").eqs."" then create nfldstr.ok
2048 $ gawk "$1 == 0 { print ""bug"" }" >_nfldstr.tmp
2049
2050 $ cmp nfldstr.ok sys$disk:[]_nfldstr.tmp
2051 $ if $status
2052 $ then
2053 $ rm _nfldstr.tmp;
2054 $ gosub junit_report_pass
2055 $ else
2056 $ gosub junit_report_fail_diff
2057 $ endif
2058 $ return
2059 $
2060 $nors: echo "nors"
2061 $ test_class = "basic"
2062 $!! there's no straightforward way to supply non-terminated input on the fly
2063 $!! @echo A B C D E | tr -d '\12' | $(AWK) '{ print $$NF }' - $(srcdir)/nors.in > _$@
2064 $!! so just read a line from sys$input instead
2065 $ gawk "{ print $NF }" - nors.in >_nors.tmp
2066 A B C D E
2067 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2068 $ then
2069 $ delete sys$disk:[]_'test'.tmp;2
2070 $ endif
2071 $ cmp nors.ok sys$disk:[]_nors.tmp
2072 $ if $status
2073 $ then
2074 $ rm _nors.tmp;
2075 $ gosub junit_report_pass
2076 $ else
2077 $ gosub junit_report_fail_diff
2078 $ endif
2079 $ return
2080 $
2081 $reint: echo "reint"
2082 $ test_class = "gawk_ext"
2083 $ set noOn
2084 $ gawk --re-interval -f reint.awk reint.in >_reint.tmp
2085 $ gawk_status = $status
2086 $ set On
2087 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2088 $ then
2089 $ delete sys$disk:[]_'test'.tmp;2
2090 $ endif
2091 $ if .not. gawk_status
2092 $ then
2093 $ call exit_code 'gawk_status' _'test'.tmp
2094 $ endif
2095 $ cmp reint.ok sys$disk:[]_reint.tmp
2096 $ if gawk_status
2097 $ then
2098 $ rm _reint.tmp;
2099 $ gosub junit_report_pass
2100 $ else
2101 $ gosub junit_report_fail_diff
2102 $ endif
2103 $ return
2104 $
2105 $noparms: echo "noparms"
2106 $ test_class = "basic"
2107 $ set noOn
2108 $ AWKPATH_srcdir
2109 $ gawk -f noparms.awk >_noparms.tmp 2>&1
2110 $ if .not. $status then call exit_code '$status' _noparms.tmp
2111 $ set On
2112 $ cmp noparms.ok sys$disk:[]_noparms.tmp
2113 $ if $status
2114 $ then
2115 $ rm _noparms.tmp;
2116 $ gosub junit_report_pass
2117 $ else
2118 $ gosub junit_report_fail_diff
2119 $ endif
2120 $ return
2121 $
2122 $pipeio1: echo "pipeio1"
2123 $ test_class = "unix_tests"
2124 $ cat = "TYPE" !close enough, as long as we avoid .LIS default suffix
2125 $ define/User test1 []test1.
2126 $ define/User test2 []test2.
2127 $ gawk -f pipeio1.awk >_pipeio1.tmp
2128 $ rm test1.;,test2.;
2129 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2130 $ then
2131 $ delete sys$disk:[]_'test'.tmp;2
2132 $ endif
2133 $ cmp pipeio1.ok sys$disk:[]_pipeio1.tmp
2134 $ if $status
2135 $ then
2136 $ rm _pipeio1.tmp;
2137 $ gosub junit_report_pass
2138 $ else
2139 $ gosub junit_report_fail_diff
2140 $ endif
2141 $ return
2142 $
2143 $pipeio2:
2144 $ test_class = "unix_tests"
2145 $ echo "pipeio2 skipped"
2146 $ ! Expects the sed utility and Posix shell
2147 $ return
2148 $!!pipeio2: echo "pipeio2"
2149 $ cat = "gawk -- {print}"
2150 $ tr = "??" !unfortunately, no trivial substitution available...
2151 $ gawk -v "SRCDIR=." -f pipeio2.awk >_pipeio2.tmp
2152 $ cmp pipeio2.ok sys$disk:[]_pipeio2.tmp
2153 $ if $status
2154 $ then
2155 $ rm _pipeio2.tmp;
2156 $ gosub junit_report_pass
2157 $ else
2158 $ gosub junit_report_fail_diff
2159 $ endif
2160 $ return
2161 $
2162 $clobber: echo "clobber"
2163 $ test_class = "basic"
2164 $ gawk -f clobber.awk >_clobber.tmp
2165 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2166 $ then
2167 $ delete sys$disk:[]_'test'.tmp;2
2168 $ endif
2169 $ cmp clobber.ok sys$disk:[]seq.
2170 $ if $status then rm seq.;*
2171 $ cmp clobber.ok sys$disk:[]_clobber.tmp
2172 $ if $status
2173 $ then
2174 $ rm _clobber.tmp;
2175 $ gosub junit_report_pass
2176 $ else
2177 $ gosub junit_report_fail_diff
2178 $ endif
2179 $ return
2180 $
2181 $nasty: echo "nasty"
2182 $ test_class = "basic"
2183 $ set noOn
2184 $ gawk -f nasty.awk >_nasty.tmp
2185 $ call fixup_LRL nasty.ok
2186 $ call fixup_LRL _nasty.tmp "purge"
2187 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2188 $ then
2189 $ delete sys$disk:[]_'test'.tmp;2
2190 $ endif
2191 $ cmp nasty.ok sys$disk:[]_nasty.tmp
2192 $ if $status
2193 $ then
2194 $ rm _nasty.tmp;
2195 $ file = "lcl_root:[]nasty.ok"
2196 $ if f$search(file) .nes. "" then rm 'file';*
2197 $ gosub junit_report_pass
2198 $ else
2199 $ gosub junit_report_fail_diff
2200 $ endif
2201 $ set On
2202 $ return
2203 $
2204 $nasty2: echo "nasty2"
2205 $ test_class = "basic"
2206 $ set noOn
2207 $ gawk -f nasty2.awk >_nasty2.tmp
2208 $ call fixup_LRL nasty2.ok
2209 $ call fixup_LRL _nasty2.tmp "purge"
2210 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2211 $ then
2212 $ delete sys$disk:[]_'test'.tmp;2
2213 $ endif
2214 $ cmp nasty2.ok sys$disk:[]_nasty2.tmp
2215 $ if $status
2216 $ then
2217 $ rm _nasty2.tmp;
2218 $ file = "lcl_root:[]nasty2.ok"
2219 $ if f$search(file) .nes. "" then rm 'file';*
2220 $ gosub junit_report_pass
2221 $ else
2222 $ gosub junit_report_fail_diff
2223 $ endif
2224 $ set On
2225 $ return
2226 $
2227 $arrayparm:
2228 $arrayprm2:
2229 $fnaryscl:
2230 $opasnslf:
2231 $opasnidx:
2232 $printfbad1:
2233 $prmarscl:
2234 $subslash:
2235 $ test_class = "basic"
2236 $ goto test_error_capture1
2237 $!
2238 $functab1:
2239 $functab2:
2240 $functab3:
2241 $aadelete1:
2242 $aadelete2:
2243 $nastyparm:
2244 $ test_class = "gawk_ext"
2245 $ goto test_error_capture1
2246 $!
2247 $test_error_capture1:
2248 $ echo "''test'"
2249 $ set noOn
2250 $ gawk -f 'test'.awk >_'test'.tmp 2>&1
2251 $ if .not. $status then call exit_code '$status' _'test'.tmp
2252 $ set On
2253 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
2254 $ if $status
2255 $ then
2256 $ rm _'test'.tmp;
2257 $ gosub junit_report_pass
2258 $ else
2259 $ gosub junit_report_fail_diff
2260 $ endif
2261 $ return
2262 $
2263 $arynocls: echo "arynocls"
2264 $ test_class = "basic"
2265 $ gawk -v "INPUT"=arynocls.in -f arynocls.awk >_arynocls.tmp
2266 $ cmp arynocls.ok sys$disk:[]_arynocls.tmp
2267 $ if $status
2268 $ then
2269 $ rm _arynocls.tmp;
2270 $ gosub junit_report_pass
2271 $ else
2272 $ gosub junit_report_fail_diff
2273 $ endif
2274 $ return
2275 $
2276 $getlnbuf: echo "getlnbuf"
2277 $ test_class = "basic"
2278 $ gawk -f getlnbuf.awk getlnbuf.in >_getlnbuf.tmp
2279 $ gawk -f gtlnbufv.awk getlnbuf.in >_getlnbuf.too
2280 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2281 $ then
2282 $ delete sys$disk:[]_'test'.tmp;2
2283 $ endif
2284 $ cmp getlnbuf.ok sys$disk:[]_getlnbuf.tmp
2285 $ if $status then rm _getlnbuf.tmp;
2286 $ if f$search("sys$disk:[]_''test'.too;2") .nes. ""
2287 $ then
2288 $ delete sys$disk:[]_'test'.too;2
2289 $ endif
2290 $ cmp getlnbuf.ok sys$disk:[]_getlnbuf.too
2291 $ if $status
2292 $ then
2293 $ rm _getlnbuf.too;
2294 $ gosub junit_report_pass
2295 $ else
2296 $ gosub junit_report_fail_diff
2297 $ endif
2298 $ return
2299 $
2300 $lint: echo "lint"
2301 $ test_class = "gawk_ext"
2302 $ AWKPATH_srcdir
2303 $ gawk -f lint.awk >_lint.tmp 2>&1
2304 $ cmp lint.ok sys$disk:[]_lint.tmp
2305 $ if $status
2306 $ then
2307 $ rm _lint.tmp;
2308 $ gosub junit_report_pass
2309 $ else
2310 $ gosub junit_report_fail_diff
2311 $ endif
2312 $ return
2313 $
2314 $lintold: echo "lintold"
2315 $ test_class = "gawk_ext"
2316 $ AWKPATH_srcdir
2317 $ set noOn
2318 $ gawk -f lintold.awk --lint-old <lintold.in >_lintold.tmp 2>&1
2319 $ set on
2320 $ cmp lintold.ok sys$disk:[]_lintold.tmp
2321 $ if $status
2322 $ then
2323 $ rm _lintold.tmp;
2324 $ gosub junit_report_pass
2325 $ else
2326 $ gosub junit_report_fail_diff
2327 $ endif
2328 $ return
2329 $
2330 $ofmtbig: echo "ofmtbig"
2331 $ test_class = "basic"
2332 $ set noOn
2333 $ gawk -f ofmtbig.awk ofmtbig.in >_ofmtbig.tmp 2>&1
2334 $ set On
2335 $ cmp ofmtbig.ok sys$disk:[]_ofmtbig.tmp
2336 $ if $status
2337 $ then
2338 $ rm _ofmtbig.tmp;
2339 $ gosub junit_report_pass
2340 $ else
2341 $ gosub junit_report_fail_diff
2342 $ endif
2343 $ return
2344 $
2345 $inetechu: echo "inetechu"
2346 $ test_class = "inet"
2347 $ echo "this test is for establishing UDP connections"
2348 $ set noOn
2349 $ gawk -- "BEGIN {print """" |& ""/inet/udp/0/127.0.0.1/9""}"
2350 $ ! report skip as we do not validate yet.
2351 $ skip_reason = "Test not validated."
2352 $ gosub junit_report_skip
2353 $ set On
2354 $ return
2355 $
2356 $inetecht: echo "inetecht"
2357 $ test_class = "inet"
2358 $ echo "this test is for establishing TCP connections"
2359 $ set noOn
2360 $ gawk -- "BEGIN {print """" |& ""/inet/tcp/0/127.0.0.1/9""}"
2361 $ ! report skip as we do not validate yet.
2362 $ skip_reason = "Test not validated."
2363 $ gosub junit_report_skip
2364 $ set On
2365 $ return
2366 $
2367 $inetdayu: echo "inetdayu"
2368 $ test_class = "inet"
2369 $ echo "this test is for bidirectional UDP transmission"
2370 $ set noOn
2371 $ gawk -f - _NL:
2372 BEGIN { print "" |& "/inet/udp/0/127.0.0.1/13";
2373 "/inet/udp/0/127.0.0.1/13" |& getline; print $0}
2374 $ ! report skip as we do not validate yet.
2375 $ skip_reason = "Test not validated."
2376 $ gosub junit_report_skip
2377 $ set On
2378 $ return
2379 $
2380 $inetdayt: echo "inetdayt"
2381 $ test_class = "inet"
2382 $ echo "this test is for bidirectional TCP transmission"
2383 $ set noOn
2384 $ gawk -f - _NL:
2385 BEGIN { print "" |& "/inet/tcp/0/127.0.0.1/13";
2386 "/inet/tcp/0/127.0.0.1/13" |& getline; print $0}
2387 $ ! report skip as we do not validate yet.
2388 $ skip_reason = "Test not validated."
2389 $ gosub junit_report_skip
2390 $ set On
2391 $ return
2392 $
2393 $redfilnm: echo "redfilnm"
2394 $ test_class = "basic"
2395 $ gawk -f redfilnm.awk srcdir="." redfilnm.in >_redfilnm.tmp
2396 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2397 $ then
2398 $ delete sys$disk:[]_'test'.tmp;2
2399 $ endif
2400 $ cmp redfilnm.ok sys$disk:[]_redfilnm.tmp
2401 $ if $status
2402 $ then
2403 $ rm _redfilnm.tmp;
2404 $ gosub junit_report_pass
2405 $ else
2406 $ gosub junit_report_fail_diff
2407 $ endif
2408 $ return
2409 $
2410 $leaddig: echo "leaddig"
2411 $ test_class = "basic"
2412 $ gawk -v "x=2E" -f leaddig.awk >_leaddig.tmp
2413 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2414 $ then
2415 $ delete sys$disk:[]_'test'.tmp;2
2416 $ endif
2417 $ cmp leaddig.ok sys$disk:[]_leaddig.tmp
2418 $ if $status
2419 $ then
2420 $ rm _leaddig.tmp;
2421 $ gosub junit_report_pass
2422 $ else
2423 $ gosub junit_report_fail_diff
2424 $ endif
2425 $ return
2426 $
2427 $clos1way:
2428 $clos1way2:
2429 $clos1way3:
2430 $clos1way4:
2431 $clos1way5:
2432 $ test_class = "gawk_ext"
2433 $ echo "''test'"
2434 $ skip_reason = "Test not supported."
2435 $ gosub junit_report_skip
2436 $ return
2437 $#clos1way: echo "''test'"
2438 $ gawk -f clos1way.awk >_clos1way.tmp
2439 $ cmp clos1way.ok sys$disk:[]_clos1way.tmp
2440 $ if $status
2441 $ then
2442 $ rm _clos1way.tmp;
2443 $ gosub junit_report_pass
2444 $ else
2445 $ gosub junit_report_fail_diff
2446 $ endif
2447 $ return
2448 $
2449 $shadow: echo "shadow"
2450 $ test_class = "gawk_ext"
2451 $ set noOn
2452 $ AWKPATH_srcdir
2453 $ gawk --lint -f shadow.awk >_shadow.tmp 2>&1
2454 $ set On
2455 $ cmp shadow.ok sys$disk:[]_shadow.tmp
2456 $ if $status
2457 $ then
2458 $ rm _shadow.tmp;
2459 $ gosub junit_report_pass
2460 $ else
2461 $ gosub junit_report_fail_diff
2462 $ endif
2463 $ return
2464 $
2465 $lintwarn: echo "lintwarn"
2466 $ test_class = "basic"
2467 $ set noOn
2468 $ AWKPATH_srcdir
2469 $ gawk --lint -f lintwarn.awk >_lintwarn.tmp 2>&1
2470 $ if .not. $status then call exit_code '$status' _lintwarn.tmp
2471 $ set On
2472 $ cmp lintwarn.ok sys$disk:[]_lintwarn.tmp
2473 $ if $status
2474 $ then
2475 $ rm _lintwarn.tmp;
2476 $ gosub junit_report_pass
2477 $ else
2478 $ gosub junit_report_fail_diff
2479 $ endif
2480 $ return
2481 $
2482 $longsub: echo "longsub"
2483 $ test_class = "basic"
2484 $ set noOn
2485 $ gawk -f longsub.awk longsub.in >_longsub.tmp
2486 $!! the records here are too long for DIFF to handle
2487 $!! so assume success as long as gawk doesn't crash
2488 $!! call fixup_LRL longsub.ok
2489 $!! call fixup_LRL _longsub.tmp "purge"
2490 $!! cmp longsub.ok sys$disk:[]_longsub.tmp
2491 $ if $status
2492 $ then
2493 $ rm _longsub.tmp;
2494 $ gosub junit_report_pass
2495 $ else
2496 $ gosub junit_report_fail_diff
2497 $ endif
2498 $ set On
2499 $ return
2500 $
2501 $arrayprm3: echo "arrayprm3"
2502 $ test_class = "basic"
2503 $ gawk -f arrayprm3.awk arrayprm3.in >_arrayprm3.tmp
2504 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2505 $ then
2506 $ delete sys$disk:[]_'test'.tmp;2
2507 $ endif
2508 $ cmp arrayprm3.ok sys$disk:[]_arrayprm3.tmp
2509 $ if $status
2510 $ then
2511 $ rm _arrayprm3.tmp;
2512 $ gosub junit_report_pass
2513 $ else
2514 $ gosub junit_report_fail_diff
2515 $ endif
2516 $ return
2517 $
2518 $arryref3:
2519 $arryref4:
2520 $arryref5:
2521 $aryprm1:
2522 $aryprm2:
2523 $aryprm3:
2524 $aryprm4:
2525 $aryprm5:
2526 $aryprm6:
2527 $aryprm7:
2528 $aryprm8:
2529 $aryprm9:
2530 $dfastress:
2531 $nfneg:
2532 $numindex:
2533 $scalar:
2534 $sclforin:
2535 $sclifin:
2536 $ echo "''test'"
2537 $ test_class = "basic"
2538 $ set noOn
2539 $ gawk -f 'test'.awk 'test'.in >_'test'.tmp 2>&1
2540 $ if .not. $status then call exit_code '$status' _'test'.tmp
2541 $ set On
2542 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
2543 $ if $status
2544 $ then
2545 $ rm _'test'.tmp;
2546 $ gosub junit_report_pass
2547 $ else
2548 $ gosub junit_report_fail_diff
2549 $ endif
2550 $ return
2551 $!
2552 $sigpipe1:
2553 $ test_class = "basic"
2554 $ echo "''test'"
2555 $ skip_reason = "Test not supported."
2556 $ gosub junit_report_skip
2557 $ return
2558 $
2559 $ !
2560 $ ! For tests requiring exit code 2
2561 $ !
2562 $ echo "''test'"
2563 $ set noOn
2564 $ gawk -f 'test'.awk <'test'.in >_'test'.tmp 2>&1
2565 $ if .not. $status then call exit_code '$status' _'test'.tmp
2566 $ set On
2567 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
2568 $ if $status
2569 $ then
2570 $ rm _'test'.tmp;
2571 $ gosub junit_report_pass
2572 $ else
2573 $ gosub junit_report_fail_diff
2574 $ endif
2575 $ return
2576 $
2577 $exitval2:
2578 $ echo "''test'"
2579 $ test_class = "basic"
2580 $ cmdfile = "sys$disk:[]_''test'.com"
2581 $ if f$search(cmdfile) .nes. "" then delete 'cmdfile';*
2582 $ open/write xxx 'cmdfile'
2583 $ write xxx "$!'f$verify(0,0)'
2584 $ write xxx "$read := read"
2585 $ write xxx "$define/user sys$input sys$command"
2586 $ write xxx "$pipe read sys$input x ; write sys$output x ; exit %x003A151"
2587 $ close xxx
2588 $ ! Unix exit 42 is VMS %x003A151
2589 $ read := "@''cmdfile' !"
2590 $ set noOn
2591 $ gawk -f 'test'.awk >_'test'.tmp
2592 $ if $status .ne. 1 then call exit_code '$status' _'test'.tmp
2593 $ delete/symbol/local read
2594 $ set On
2595 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
2596 $ if $status
2597 $ then
2598 $ rm _'test'.tmp;*
2599 $ if f$search(cmdfile) .nes. "" then rm 'cmdfile';*
2600 $ gosub junit_report_pass
2601 $ else
2602 $ gosub junit_report_fail_diff
2603 $ endif
2604 $ return
2605 $!
2606 $exitval3:
2607 $ echo "''test'"
2608 $ test_class = "basic"
2609 $ set noOn
2610 $ gawk -f 'test'.awk >_'test'.tmp
2611 $ ! Unix exit 42 is VMS %x003A151
2612 $ if $status .ne. 1 then call exit_code '$status' _'test'.tmp
2613 $ set On
2614 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
2615 $ if $status
2616 $ then
2617 $ rm _'test'.tmp;
2618 $ gosub junit_report_pass
2619 $ else
2620 $ gosub junit_report_fail_diff
2621 $ endif
2622 $ return
2623 $!
2624 $!
2625 $lc_num1:
2626 $fmttest:
2627 $backsmalls2:
2628 $ test_class = "charset_tests"
2629 $ test_in = "''test'.in"
2630 $ goto common_test_optional_input
2631 $!
2632 $fpat4:
2633 $regnul1:
2634 $regnul2:
2635 $crlf:
2636 $rsgetline:
2637 $rstest6:
2638 $ test_class = "gawk_ext"
2639 $ test_in = "''test'.in"
2640 $ goto common_with_test_input
2641 $!
2642 $delfunc:
2643 $fcall_exit2:
2644 $fnamedat:
2645 $fnarray2:
2646 $fnasgnm:
2647 $fnmisc:
2648 $gsubasgn:
2649 $gsubtest:
2650 $gsubtst2:
2651 $gsubtst4:
2652 $hex:
2653 $inputred:
2654 $nfloop:
2655 $prec:
2656 $prtoeval:
2657 $rstest1:
2658 $rstest2:
2659 $rstest3:
2660 $sortempty:
2661 $splitarr:
2662 $strcat1:
2663 $subsepnm:
2664 $unterm:
2665 $zeroe0:
2666 $ test_class = "basic"
2667 $common_test_optional_input:
2668 $ echo "''test'"
2669 $ set noOn
2670 $ gawk -f 'test'.awk 'test'.in >_'test'.tmp 2>&1
2671 $ if .not. $status then call exit_code '$status' _'test'.tmp
2672 $ set On
2673 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
2674 $ if $status
2675 $ then
2676 $ rm _'test'.tmp;
2677 $ gosub junit_report_pass
2678 $ else
2679 $ gosub junit_report_fail_diff
2680 $ endif
2681 $ return
2682 $
2683 $getline: echo "getline"
2684 $ test_class = "basic"
2685 $ !Expects a Unix shell
2686 $ skip_reason = "Requires a Unix shell."
2687 $ gosub junit_report_skip
2688 $ return
2689 $!!getline: echo "getline"
2690 $ gawk -f getline.awk getline.in >_getline.tmp
2691 $ cmp getline.ok sys$disk:[]_getline.tmp
2692 $ if $status
2693 $ then
2694 $ rm _getline.tmp;
2695 $ gosub junit_report_pass
2696 $ else
2697 $ gosub junit_report_fail_diff
2698 $ endif
2699 $ return
2700 $
2701 $gsubtst3: echo "gsubtst3"
2702 $ test_class = "basic"
2703 $ gawk --re-interval -f gsubtst3.awk gsubtst3.in >_gsubtst3.tmp
2704 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2705 $ then
2706 $ delete sys$disk:[]_'test'.tmp;2
2707 $ endif
2708 $ cmp gsubtst3.ok sys$disk:[]_gsubtst3.tmp
2709 $ if $status
2710 $ then
2711 $ rm _gsubtst3.tmp;
2712 $ gosub junit_report_pass
2713 $ else
2714 $ gosub junit_report_fail_diff
2715 $ endif
2716 $ return
2717 $
2718 $! FIXME: gawk generates an extra, empty output file while running this test...
2719 $iobug1: echo "iobug1"
2720 $ test_class = "basic"
2721 $ cat = "TYPE sys$input:"
2722 $ true = "exit 1" !success
2723 $ oldout = f$search("_iobug1.tmp;")
2724 $ gawk -f iobug1.awk iobug1.in >_iobug1.tmp
2725 $ badout = f$search("_iobug1.tmp;-1")
2726 $ if badout.nes."" .and. badout.nes.oldout then rm 'badout'
2727 $ cmp iobug1.ok sys$disk:[]_iobug1.tmp
2728 $ if $status
2729 $ then
2730 $ rm _iobug1.tmp;
2731 $ gosub junit_report_pass
2732 $ else
2733 $ gosub junit_report_fail_diff
2734 $ endif
2735 $ return
2736 $
2737 $rstest4:
2738 $ echo "rstest4"
2739 $ test_class = "basic"
2740 $ old_echo = echo
2741 $ echo = "write sys$output """
2742 $ gawk -f rstest4.awk >_rstest4.tmp1
2743 $ if f$search("sys$disk:[]_''test'.tmp1;2") .nes. ""
2744 $ then
2745 $ delete sys$disk:[]_'test'.tmp1;2
2746 $ endif
2747 $ echo = old_echo
2748 $ gawk "{gsub(""< A>"",""<a>"")}1" _'test'.tmp1 >_'test'.tmp
2749 $ rm sys$disk:[]_'test'.tmp1;*
2750 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2751 $ then
2752 $ delete sys$disk:[]_'test'.tmp;2
2753 $ endif
2754 $ cmp rstest4.ok sys$disk:[]_rstest4.tmp
2755 $! if $status then rm _rstest4.tmp;
2756 $ if $status
2757 $ then
2758 $ rm _'test'.tmp;
2759 $ gosub junit_report_pass
2760 $ else
2761 $ gosub junit_report_fail_diff
2762 $ endif
2763 $ return
2764 $
2765 $rstest5:
2766 $ echo "rstest5"
2767 $ test_class = "basic"
2768 $ old_echo = echo
2769 $ echo = "write sys$output """
2770 $ gawk -f rstest5.awk >_rstest5.tmp1
2771 $ if f$search("sys$disk:[]_''test'.tmp1;2") .nes. ""
2772 $ then
2773 $ delete sys$disk:[]_'test'.tmp1;2
2774 $ endif
2775 $ echo = old_echo
2776 $ gawk "{gsub("" '"","""");gsub(""'"","""")}1" _'test'.tmp1 >_'test'.tmp
2777 $ rm sys$disk:[]_'test'.tmp1;*
2778 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2779 $ then
2780 $ delete sys$disk:[]_'test'.tmp;2
2781 $ endif
2782 $ cmp rstest5.ok sys$disk:[]_rstest5.tmp
2783 $ if $status
2784 $ then
2785 $ rm _rstest5.tmp;
2786 $ gosub junit_report_pass
2787 $ else
2788 $ gosub junit_report_fail_diff
2789 $ endif
2790 $ return
2791 $
2792 $fcall_exit:
2793 $fnarray:
2794 $funsmnam:
2795 $paramdup:
2796 $paramres:
2797 $parseme:
2798 $synerr1:
2799 $synerr2:
2800 $ test_class = "basic"
2801 $ goto test_error_capture1
2802 $match2:
2803 $ test_class = "gawk_ext"
2804 $ goto test_error_capture1
2805 $!
2806 $uninit2:
2807 $uninit3:
2808 $uninit4:
2809 $uninit5:
2810 $uninitialized:
2811 $ echo "''test'"
2812 $ test_class = "basic"
2813 $ gawk --lint -f 'test'.awk 'test'.in >_'test'.tmp 2>&1
2814 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
2815 $ if $status
2816 $ then
2817 $ rm _'test'.tmp;
2818 $ gosub junit_report_pass
2819 $ else
2820 $ gosub junit_report_fail_diff
2821 $ endif
2822 $ return
2823 $
2824 $space: echo "space"
2825 $ test_class = "unix_tests"
2826 $ set noOn
2827 $ gawk -f " " space.awk >_space.tmp 2>&1
2828 $ if .not. $status then call exit_code '$status' _space.tmp
2829 $ set On
2830 $! we get a different error from what space.ok expects
2831 $ gawk "{gsub(""file specification syntax error"", ""no such file or directory""); print}" -
2832 _space.tmp >_space.too
2833 $ if f$search("sys$disk:[]_''test'.too;2") .nes. ""
2834 $ then
2835 $ delete sys$disk:[]_'test'.too;2
2836 $ endif
2837 $ rm _space.tmp;
2838 $ mv _space.too _space.tmp
2839 $ igncascmp space.ok sys$disk:[]_space.tmp
2840 $ if $status
2841 $ then
2842 $ rm _space.tmp;
2843 $ gosub junit_report_pass
2844 $ else
2845 $ gosub junit_report_fail_diff
2846 $ endif
2847 $ return
2848 $
2849 $posix2008sub:
2850 $printf0:
2851 $ echo "''test'"
2852 $ test_class = "basic"
2853 $ gawk --posix -f 'test'.awk >_'test'.tmp
2854 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2855 $ then
2856 $ delete sys$disk:[]_'test'.tmp;2
2857 $ endif
2858 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
2859 $ if $status
2860 $ then
2861 $ rm _'test'.tmp;
2862 $ gosub junit_report_pass
2863 $ else
2864 $ gosub junit_report_fail_diff
2865 $ endif
2866 $ return
2867 $
2868 $rsnulbig: echo "rsnulbig"
2869 $ test_class = "basic"
2870 $ if .not.pipeok
2871 $ then echo "Without the PIPE command, ''test' can't be run."
2872 $ On warning then return
2873 $ pipe echo "With PIPE, this will probably take quite a while..."
2874 $ On warning then $
2875 $ pipeok = 1
2876 $ else echo "This will probably take quite a while too..."
2877 $ endif
2878 $ set noOn
2879 $ pipe -
2880 gawk -- "BEGIN {for (i = 1; i <= 128*64+1; i++) print ""abcdefgh123456\n""}" | -
2881 gawk -- "BEGIN {RS = """"; ORS = ""\n\n""}; {print}" | -
2882 gawk -- "/^[^a]/; END {print NR}" >_rsnulbig.tmp
2883 $ set On
2884 $ cmp rsnulbig.ok sys$disk:[]_rsnulbig.tmp
2885 $ if $status
2886 $ then
2887 $ rm _rsnulbig.tmp;
2888 $ gosub junit_report_pass
2889 $ else
2890 $ gosub junit_report_fail_diff
2891 $ endif
2892 $ return
2893 $
2894 $rsnulbig2: echo "rsnulbig2"
2895 $ test_class = "basic"
2896 $ if .not.pipeok
2897 $ then echo "Without the PIPE command, ''test' can't be run."
2898 $ On warning then return
2899 $ pipe echo "With PIPE, this will probably take quite a while..."
2900 $ On warning then $
2901 $ pipeok = 1
2902 $ else echo "This will probably take quite a while too..."
2903 $ endif
2904 $ set noOn
2905 $ pipe -
2906 gawk -- "BEGIN {ORS=""""; n=""\n""; for (i=1; i<=10; i++) n=(n n); for (i=1; i<=128; i++) print n; print ""abc\n""}" | -
2907 gawk -- "BEGIN {RS=""""; ORS=""\n\n"" }; {print}" | -
2908 gawk -- "/^[^a]/; END {print NR}" >_rsnulbig2.tmp
2909 $ set On
2910 $ cmp rsnulbig2.ok sys$disk:[]_rsnulbig2.tmp
2911 $ if $status
2912 $ then
2913 $ rm _rsnulbig2.tmp;
2914 $ gosub junit_report_pass
2915 $ else
2916 $ gosub junit_report_fail_diff
2917 $ endif
2918 $ return
2919 $
2920 $backbigs1: ! 4.1.1
2921 $ test_class = "charset_tests"
2922 $ echo "''test'"
2923 $ ! needs a locale not on VMS currently
2924 $ skip_reason = "Needs locale not on VMS Currently"
2925 $ gosub junit_report_skip
2926 $ return
2927 $!
2928 $backsmalls1:
2929 $ test_class = "charset_tests"
2930 $ gosub define_gawklocale
2931 $ if f$trnlnm("LC_ALL") .nes. "utf8-50"
2932 $ then
2933 $ echo "''test'"
2934 $ skip_reason = "Needs utf8-50 locale."
2935 $ gosub junit_report_skip
2936 $ return
2937 $ else
2938 $ echo "''test'"
2939 $ endif
2940 $ gawk -f 'test'.awk 'test'.in >_'test'.tmp
2941 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2942 $ then
2943 $ delete sys$disk:[]_'test'.tmp;2
2944 $ endif
2945 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
2946 $ if $status
2947 $ then
2948 $ rm _'test'.tmp;
2949 $ gosub junit_report_pass
2950 $ else
2951 $ gosub junit_report_fail_diff
2952 $ endif
2953 $ return
2954 $!
2955 $subamp:
2956 $wideidx:
2957 $widesub2:
2958 $widesub3:
2959 $ echo "''test'"
2960 $ test_class = "basic"
2961 $ gosub define_gawklocale
2962 $ gawk -f 'test'.awk 'test'.in >_'test'.tmp
2963 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2964 $ then
2965 $ delete sys$disk:[]_'test'.tmp;2
2966 $ endif
2967 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
2968 $ if $status
2969 $ then
2970 $ rm _'test'.tmp;
2971 $ gosub junit_report_pass
2972 $ else
2973 $ gosub junit_report_fail_diff
2974 $ endif
2975 $ return
2976 $
2977 $ignrcas2:
2978 $ test_class = "gawk_ext"
2979 $ goto wide_tests_1
2980 $wideidx2:
2981 $widesub:
2982 $widesub4:
2983 $ test_class = "basic"
2984 $ goto wide_tests_1
2985 $!
2986 $wide_tests_1:
2987 $ echo "''test'"
2988 $ gosub define_gawklocale
2989 $ gawk -f 'test'.awk >_'test'.tmp
2990 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
2991 $ then
2992 $ delete sys$disk:[]_'test'.tmp;2
2993 $ endif
2994 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
2995 $ if $status
2996 $ then
2997 $ rm _'test'.tmp;
2998 $ gosub junit_report_pass
2999 $ else
3000 $ gosub junit_report_fail_diff
3001 $ endif
3002 $ return
3003 $
3004 $! This test is somewhat suspect for vms due to exit code manipulation
3005 $exitval1: echo "exitval1"
3006 $ test_class = "basic"
3007 $ gawk -f exitval1.awk >_exitval1.tmp 2>&1
3008 $ if $status then call exit_code '$status' _exitval1.tmp
3009 $ cmp exitval1.ok sys$disk:[]_exitval1.tmp
3010 $ if $status
3011 $ then
3012 $ rm _exitval1.tmp;
3013 $ gosub junit_report_pass
3014 $ else
3015 $ gosub junit_report_fail_diff
3016 $ endif
3017 $ return
3018 $
3019 $fsspcoln: echo "fsspcoln"
3020 $ test_class = "basic"
3021 $ gawk -f fsspcoln.awk "FS=[ :]+" fsspcoln.in >_forspcoln.tmp
3022 $ if f$search("sys$disk:[]_forspcoln.tmp;2") .nes. ""
3023 $ then
3024 $ delete sys$disk:[]_forspcoln.tmp;2
3025 $ endif
3026 $ cmp fsspcoln.ok sys$disk:[]_forspcoln.tmp
3027 $ if $status
3028 $ then
3029 $ rm _forspcoln.tmp;
3030 $ gosub junit_report_pass
3031 $ else
3032 $ gosub junit_report_fail_diff
3033 $ endif
3034 $ return
3035 $
3036 $getlndir: echo "getlndir"
3037 $ test_class = "gawk_ext"
3038 $ ! assume we're running in the test subdirectory; we don't want to
3039 $ ! perform a messy conversion of [] into its file specification
3040 $ gawk -v "SRCDIR=[-]test.dir" -f getlndir.awk >_getlndir.tmp
3041 $! getlndir.ok expects "Is a directory", we see "is a directory"
3042 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3043 $ then
3044 $ delete sys$disk:[]_'test'.tmp;2
3045 $ endif
3046 $ igncascmp getlndir.ok sys$disk:[]_getlndir.tmp
3047 $ if $status
3048 $ then
3049 $ rm _getlndir.tmp;
3050 $ gosub junit_report_pass
3051 $ else
3052 $ gosub junit_report_fail_diff
3053 $ endif
3054 $ return
3055 $
3056 $rsstart2: echo "rsstart2"
3057 $ test_class = "gawk_ext"
3058 $ gawk -f rsstart2.awk rsstart1.in >_rsstart2.tmp
3059 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3060 $ then
3061 $ delete sys$disk:[]_'test'.tmp;2
3062 $ endif
3063 $ cmp rsstart2.ok sys$disk:[]_rsstart2.tmp
3064 $ if $status
3065 $ then
3066 $ rm _rsstart2.tmp;
3067 $ gosub junit_report_pass
3068 $ else
3069 $ gosub junit_report_fail_diff
3070 $ endif
3071 $ return
3072 $
3073 $rsstart3:
3074 $ echo "rsstart3"
3075 $ test_class = "gawk_ext"
3076 $! rsstart3 with pipe fails,
3077 $! presumably due to PIPE's use of print file format
3078 $! if .not.pipeok
3079 $! then echo "Without the PIPE command, ''test' can't be run."
3080 $! On warning then return
3081 $! pipe echo "With PIPE, ''test' will finish quickly."
3082 $! On warning then $
3083 $! pipeok = 1
3084 $! endif
3085 $ ! head rsstart1.in | gawk -f rsstart2.awk >_rsstart3.tmp
3086 $ ! splitting this into two steps would make it the same as rsstart2
3087 $ set noOn
3088 $!$ pipe -
3089 $! gawk -- "FNR <= 10" rsstart1.in | -
3090 $! gawk -f rsstart2.awk >_rsstart3.tmp
3091 $!
3092 $ ! DCL redirection to files is similar to pipes
3093 $ ! But not quite the same.
3094 $ ! DCL pipes are mailboxes, not the same as CRTL pipes,
3095 $ ! So eventually someone should look into why CRTL pipes and
3096 $ ! gawk are not always playing well together.
3097 $ gawk -- "FNR <= 10" rsstart1.in > _'test'.tmp1
3098 $ if f$search("sys$disk:[]_''test'.tmp1;2") .nes. ""
3099 $ then
3100 $ delete sys$disk:[]_'test'.tmp1;2
3101 $ endif
3102 $ define/user sys$input _'test'.tmp1
3103 $ gawk -f rsstart2.awk >_rsstart3.tmp
3104 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3105 $ then
3106 $ delete sys$disk:[]_'test'.tmp;2
3107 $ endif
3108 $ set On
3109 $ cmp rsstart3.ok sys$disk:[]_rsstart3.tmp
3110 $ if $status
3111 $ then
3112 $ rm _rsstart3.tmp;, _rsstart3.tmp1;
3113 $ gosub junit_report_pass
3114 $ else
3115 $ gosub junit_report_fail_diff
3116 $ endif
3117 $ return
3118 $
3119 $rtlen:
3120 $rtlen01:
3121 $ test_class = "unix_tests"
3122 $ goto rtlen_tests_1
3123 $rtlenmb:
3124 $ test_class = "charset_tests"
3125 $ goto rtlen_tests_1
3126 $!
3127 $rtlen_tests_1:
3128 $ echo "''test'"
3129 $ if .not.pipeok
3130 $ then echo "Without the PIPE command, ''test' can't be run."
3131 $ On warning then return
3132 $ pipe echo "With PIPE, ''test' will finish quickly."
3133 $ On warning then $
3134 $ pipeok = 1
3135 $ endif
3136 $ f = "''test'.ok"
3137 $ if test.eqs."rtlen" .or. test.eqs."rtlenmb"
3138 $ then
3139 $ if test.eqs."rtlenmb" then GAWKLOCALE = "en_US.UTF-8"
3140 $ pipe -
3141 gawk -- "BEGIN {printf ""0\n\n\n1\n\n\n\n\n2\n\n""; exit}" | -
3142 gawk -- "BEGIN {RS=""""}; {print length(RT)}" >_'test'.tmp
3143 $ if test.eqs."rtlenmb" then delete/Symbol/Local GAWKLOCALE
3144 $ if test.eqs."rtlenmb" then f = "rtlen.ok"
3145 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3146 $ then
3147 $ delete sys$disk:[]_'test'.tmp;2
3148 $ endif
3149 $ else
3150 $ call/Output=_rtlen01.tmp do__rtlen01
3151 $ ! first test yields 1 instead of 0 due to forced newline
3152 $ gawk -- "FNR==1 {sub(""1"",""0"")}; {print}" _rtlen01.tmp >_rtlen01.too
3153 $ if f$search("sys$disk:[]_''test'.too;2") .nes. ""
3154 $ then
3155 $ delete sys$disk:[]_'test'.too;2
3156 $ endif
3157 $ rm _rtlen01.tmp;
3158 $ mv _rtlen01.too _rtlen01.tmp
3159 $ endif
3160 $ cmp 'f' sys$disk:[]_'test'.tmp
3161 $ if $status
3162 $ then
3163 $ rm _'test'.tmp;
3164 $ gosub junit_report_pass
3165 $ else
3166 $ gosub junit_report_fail_diff
3167 $ endif
3168 $ return
3169 $
3170 $do__rtlen01: subroutine
3171 $ gawk = gawk !PIPE won't propagate local symbols from outer procedure
3172 $ pipe -
3173 gawk -- "BEGIN {printf ""0""; exit}" | -
3174 gawk -- "BEGIN {RS=""""}; {print length(RT)}"
3175 $ pipe -
3176 gawk -- "BEGIN {printf ""0\n""; exit}" | -
3177 gawk -- "BEGIN {RS=""""}; {print length(RT)}"
3178 $ pipe -
3179 gawk -- "BEGIN {printf ""0\n\n""; exit}" | -
3180 gawk -- "BEGIN {RS=""""}; {print length(RT)}"
3181 $ endsubroutine !do__rtlen01
3182 $
3183 $nondec2: echo "nondec2"
3184 $ test_class = "gawk_ext"
3185 $ gawk --non-decimal-data -v "a=0x1" -f nondec2.awk >_nondec2.tmp
3186 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3187 $ then
3188 $ delete sys$disk:[]_'test'.tmp;2
3189 $ endif
3190 $ cmp nondec2.ok sys$disk:[]_nondec2.tmp
3191 $ if $status
3192 $ then
3193 $ rm _nondec2.tmp;
3194 $ gosub junit_report_pass
3195 $ else
3196 $ gosub junit_report_fail_diff
3197 $ endif
3198 $ return
3199 $
3200 $nofile: echo "nofile"
3201 $ test_class = "basic"
3202 $! gawk "{}" no/such/file >_nofile.tmp 2>&1
3203 $! nofile.ok expects no/such/file, but using that name in the test would
3204 $! yield "file specification syntax error" instead of "no such file..."
3205 $ set noOn
3206 $ gawk "{}" no-such-file >_nofile.tmp 2>&1
3207 $ if .not. $status then call exit_code '$status' _nofile.tmp
3208 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3209 $ then
3210 $ delete sys$disk:[]_'test'.tmp;2
3211 $ endif
3212 $ set On
3213 $! restore altered file name
3214 $ gawk "{gsub(""no-such-file"", ""no/such/file""); print}" _nofile.tmp >_nofile.too
3215 $ if f$search("sys$disk:[]_''test'.too;2") .nes. ""
3216 $ then
3217 $ delete sys$disk:[]_'test'.too;2
3218 $ endif
3219 $ rm _nofile.tmp;
3220 $ mv _nofile.too _nofile.tmp
3221 $! nofile.ok expects "No such file ...", we see "no such file ..."
3222 $ igncascmp nofile.ok sys$disk:[]_nofile.tmp
3223 $ if $status
3224 $ then
3225 $ rm _nofile.tmp;
3226 $ gosub junit_report_pass
3227 $ else
3228 $ gosub junit_report_fail_diff
3229 $ endif
3230 $ return
3231 $
3232 $binmode1: echo "binmode1"
3233 $ test_class = "gawk_ext"
3234 $ gawk -v "BINMODE=3" "BEGIN { print BINMODE }" >_binmode1.tmp
3235 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3236 $ then
3237 $ delete sys$disk:[]_'test'.tmp;2
3238 $ endif
3239 $ cmp binmode1.ok sys$disk:[]_binmode1.tmp
3240 $ if $status
3241 $ then
3242 $ rm _binmode1.tmp;
3243 $ gosub junit_report_pass
3244 $ else
3245 $ gosub junit_report_fail_diff
3246 $ endif
3247 $ return
3248 $
3249 $subi18n: echo "''test'"
3250 $ test_class = "basic"
3251 $ define/User GAWKLOCALE "en_US.UTF-8"
3252 $ gawk -f 'test'.awk > _'test'.tmp
3253 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3254 $ then
3255 $ delete sys$disk:[]_'test'.tmp;2
3256 $ endif
3257 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
3258 $ if $status
3259 $ then
3260 $ rm _'test'.tmp;
3261 $ gosub junit_report_pass
3262 $ else
3263 $ gosub junit_report_fail_diff
3264 $ endif
3265 $ return
3266 $
3267 $rri1:
3268 $concat4: echo "''test'"
3269 $ test_class = "basic"
3270 $ define/User GAWKLOCALE "en_US.UTF-8"
3271 $ gawk -f 'test'.awk 'test'.in > _'test'.tmp
3272 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3273 $ then
3274 $ delete sys$disk:[]_'test'.tmp;2
3275 $ endif
3276 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
3277 $ if $status
3278 $ then
3279 $ rm _'test'.tmp;
3280 $ gosub junit_report_pass
3281 $ else
3282 $ gosub junit_report_fail_diff
3283 $ endif
3284 $ return
3285 $
3286 $devfd: echo "devfd"
3287 $ test_class = "gawk_ext"
3288 $ skip_reason = "Not supported."
3289 $ gosub junit_report_skip
3290 $ return
3291 $!!devfd: echo "devfd"
3292 $ gawk 1 /dev/fd/4 /dev/fd/5 4< /devfd.in4 5< devfd.in5 >_devfd.tmp
3293 $ cmp devfd.ok sys$disk:[]_devfd.tmp
3294 $ if $status
3295 $ then
3296 $ rm _devfd.tmp;
3297 $ gosub junit_report_pass
3298 $ else
3299 $ gosub junit_report_fail_diff
3300 $ endif
3301 $ return
3302 $
3303 $devfd1: echo "devfd1"
3304 $ test_class = "gawk_ext"
3305 $ skip_reason = "Not supported."
3306 $ gosub junit_report_skip
3307 $ return
3308 $!!devfd1: echo "devfd1"
3309 $ gawk -f devfd1.awk 4< devfd.in1 5< devfd.in2 >_devfd1.tmp
3310 $ cmp devfd1.ok sys$disk:[]_devfd1.tmp
3311 $ if $status
3312 $ then
3313 $ rm _devfd1.tmp;
3314 $ gosub junit_report_pass
3315 $ else
3316 $ gosub junit_report_fail_diff
3317 $ endif
3318 $ return
3319 $
3320 $devfd2: echo "devfd2"
3321 $ test_class = "gawk_ext"
3322 $ skip_reason = "Not supported."
3323 $ gosub junit_report_skip
3324 $ return
3325 $!!devfd2: echo "devfd2"
3326 $! The program text is the '1' which will print each record. How compact can you get?
3327 $ gawk 1 /dev/fd/4 /dev/fd/5 4< /devfd.in1 5< devfd.in2 >_devfd2.tmp
3328 $ cmp devfd2.ok sys$disk:[]_devfd2.tmp
3329 $ if $status
3330 $ then
3331 $ rm _devfd2.tmp;
3332 $ gosub junit_report_pass
3333 $ else
3334 $ gosub junit_report_fail_diff
3335 $ endif
3336 $ return
3337 $
3338 $charasbytes:
3339 $! This test used "od" on Unix to verify the result. As this is not available
3340 $! we must try as best as possible using DUMP and SEARCH, instead of comparing
3341 $! to charasbytes.ok
3342 $!
3343 $ echo "''test'"
3344 $ test_class = "gawk_ext"
3345 $ gawk -b -f 'test'.awk 'test'.in >_'test'.tmp
3346 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3347 $ then
3348 $ delete sys$disk:[]_'test'.tmp;2
3349 $ endif
3350 $ pipe dump/byte/block=count:1 _charasbytes.tmp | -
3351 search sys$pipe /noout " 00 00 00 00 00 00 00 00 00 00 00 00 0A 5A 5A 5A"
3352 $ if $severity .eq. 1
3353 $ then
3354 $ rm _'test'.tmp;*
3355 $ gosub junit_report_pass
3356 $ else
3357 $ gosub junit_report_fail_diff
3358 $ endif
3359 $ return
3360 $
3361 $mixed1: echo "mixed1"
3362 $ test_class = "basic"
3363 $ set noOn
3364 $ gawk -f /dev/null --source "BEGIN {return junk}" >_mixed1.tmp 2>&1
3365 $ if .not. $status then call exit_code '$status' _mixed1.tmp
3366 $ set On
3367 $ cmp mixed1.ok sys$disk:[]_mixed1.tmp
3368 $ if $status
3369 $ then
3370 $ rm _mixed1.tmp;
3371 $ gosub junit_report_pass
3372 $ else
3373 $ gosub junit_report_fail_diff
3374 $ endif
3375 $ return
3376 $
3377 $mtchi18n: echo "mtchi18n"
3378 $ test_class = "basic"
3379 $ define/User GAWKLOCALE "ru_RU.UTF-8"
3380 $ gawk -f mtchi18n.awk mtchi18n.in >_mtchi18n.tmp
3381 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3382 $ then
3383 $ delete sys$disk:[]_'test'.tmp;2
3384 $ endif
3385 $ cmp mtchi18n.ok sys$disk:[]_mtchi18n.tmp
3386 $ if $status
3387 $ then
3388 $ rm _mtchi18n.tmp;
3389 $ gosub junit_report_pass
3390 $ else
3391 $ gosub junit_report_fail_diff
3392 $ endif
3393 $ return
3394 $
3395 $reint2: echo "reint2"
3396 $ test_class = "gawk_ext"
3397 $ gosub define_gawklocale
3398 $ set noOn
3399 $ gawk --re-interval -f reint2.awk reint2.in >_reint2.tmp
3400 $ gawk_status = $status
3401 $ set On
3402 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3403 $ then
3404 $ delete sys$disk:[]_'test'.tmp;2
3405 $ endif
3406 $ if .not. gawk_status
3407 $ then
3408 $ call exit_code 'gawk_status' _'test'.tmp
3409 $ endif
3410 $ cmp reint2.ok sys$disk:[]_reint2.tmp
3411 $ if gawk_status
3412 $ then
3413 $ rm _reint2.tmp;
3414 $ gosub junit_report_pass
3415 $ else
3416 $ gosub junit_report_fail_diff
3417 $ endif
3418 $ return
3419 $
3420 $localenl: echo "localenl"
3421 $ test_class = "unix_tests"
3422 $ skip_reason = "Not supported."
3423 $ gosub junit_report_skip
3424 $ return
3425 $!!localenl: echo "localenl"
3426 $ ! localenl.com does not exist.
3427 $ @localenl.com /Output=_localenl.tmp ! sh ./localenl.sh >tmp.
3428 $ cmp localenl.ok sys$disk:[]_localenl.tmp
3429 $ if $status
3430 $ then
3431 $ rm _localenl.tmp;
3432 $ gosub junit_report_pass
3433 $ else
3434 $ gosub junit_report_fail_diff
3435 $ endif
3436 $ return
3437 $
3438 $mbprintf1: echo "''test'"
3439 $ test_class = "charset_tests"
3440 $! Makefile test exports this, but we don't want to impact user's environment
3441 $! @GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE ; \
3442 $! Only always have "utf8-20"
3443 $ gosub define_gawklocale
3444 $ gawk -f mbprintf1.awk mbprintf1.in >_mbprintf1.tmp
3445 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3446 $ then
3447 $ delete sys$disk:[]_'test'.tmp;2
3448 $ endif
3449 $ cmp mbprintf1.ok sys$disk:[]_mbprintf1.tmp
3450 $ if $status
3451 $ then
3452 $ rm _mbprintf1.tmp;
3453 $ gosub junit_report_pass
3454 $ else
3455 $ gosub junit_report_fail_diff
3456 $ endif
3457 $ return
3458 $
3459 $mbprintf2:
3460 $ echo "''test'"
3461 $ test_class = "charset_tests"
3462 $! Makefile test exports this, ...
3463 $! @GAWKLOCALE=ja_JP.UTF-8 ; export GAWKLOCALE ; \
3464 $! Only always have "utf8-20"
3465 $! ja_jp_utf-8 is optional
3466 $ gosub define_gawklocale_ja_jp
3467 $ gawk -f 'test'.awk >_'test'.tmp
3468 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3469 $ then
3470 $ delete sys$disk:[]_'test'.tmp;2
3471 $ endif
3472 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
3473 $ if $status
3474 $ then
3475 $ rm _'test'.tmp;
3476 $ gosub junit_report_pass
3477 $ else
3478 $ gosub junit_report_fail_diff
3479 $ endif
3480 $ return
3481 $
3482 $!
3483 $mbprintf3:
3484 $mbprintf4:
3485 $ echo "''test'"
3486 $ test_class = "charset_tests"
3487 $! Makefile test exports this
3488 $! @GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE ; \
3489 $! Only always have "utf8-20"
3490 $ gosub define_gawklocale
3491 $ set noOn
3492 $ gawk -f 'test'.awk 'test'.in 2>&1 >_'test'.tmp
3493 $ set On
3494 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
3495 $ if $status
3496 $ then
3497 $ rm _'test'.tmp;
3498 $ gosub junit_report_pass
3499 $ else
3500 $ gosub junit_report_fail_diff
3501 $ endif
3502 $ return
3503 $!
3504 $mbprintf5:
3505 $ echo "''test'"
3506 $ test_class = "charset_tests"
3507 $! Makefile test exports this
3508 $! @GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE ; \
3509 $! Only always have "utf8-20"
3510 $ gosub define_gawklocale
3511 $ set noOn
3512 $ gawk -f 'test'.awk 'test'.in 2>&1 >_'test'.tmp
3513 $ set On
3514 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
3515 $ if $status
3516 $ then
3517 $ rm _'test'.tmp;
3518 $ gosub junit_report_pass
3519 $ else
3520 $ skip_reason = "Test not currently passing on VMS. UTF-8 issue."
3521 $ gosub junit_report_skip
3522 $! gosub junit_report_fail_diff
3523 $ endif
3524 $ return
3525 $!
3526 $!
3527 $mbfw1: echo "mbfw1"
3528 $ test_class = "charset_tests"
3529 $! Makefile test exports this, ...
3530 $ !define/User GAWKLOCALE "en_US.UTF-8"
3531 $ gosub define_gawklocale
3532 $ gawk -f mbfw1.awk mbfw1.in >_mbfw1.tmp
3533 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3534 $ then
3535 $ delete sys$disk:[]_'test'.tmp;2
3536 $ endif
3537 $ cmp mbfw1.ok sys$disk:[]_mbfw1.tmp
3538 $ if $status
3539 $ then
3540 $ rm _mbfw1.tmp;
3541 $ gosub junit_report_pass
3542 $ else
3543 $ gosub junit_report_fail_diff
3544 $ endif
3545 $ return
3546 $
3547 $gsubtst6: echo "gsubtst6"
3548 $ test_class = "basic"
3549 $ define/User GAWKLOCALE "C"
3550 $ gawk -f gsubtst6.awk >_gsubtst6.tmp
3551 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3552 $ then
3553 $ delete sys$disk:[]_'test'.tmp;2
3554 $ endif
3555 $ cmp gsubtst6.ok sys$disk:[]_gsubtst6.tmp
3556 $ if $status
3557 $ then
3558 $ rm _gsubtst6.tmp;
3559 $ gosub junit_report_pass
3560 $ else
3561 $ gosub junit_report_fail_diff
3562 $ endif
3563 $ return
3564 $
3565 $mbstr1:
3566 $ echo "''test'"
3567 $ test_class = "gawk_ext"
3568 $ gosub define_gawklocale
3569 $ AWKPATH_srcdir
3570 $ gawk -f 'test'.awk 2>&1 >_'test'.tmp
3571 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
3572 $ if $status
3573 $ then
3574 $ rm _'test'.tmp;
3575 $ gosub junit_report_pass
3576 $ else
3577 $ gosub junit_report_fail_diff
3578 $ endif
3579 $ return
3580 $!
3581 $mbstr2:
3582 $ echo "''test'"
3583 $ test_class = "gawk_ext"
3584 $ gosub define_gawklocale
3585 $ AWKPATH_srcdir
3586 $ gawk -f 'test'.awk < 'test'.in 2>&1 >_'test'.tmp
3587 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
3588 $ if $status
3589 $ then
3590 $ rm _'test'.tmp;
3591 $ gosub junit_report_pass
3592 $ else
3593 $ gosub junit_report_fail_diff
3594 $ endif
3595 $ return
3596 $!
3597 $printhuge:
3598 $ echo "''test'"
3599 $ test_class = "gawk_ext"
3600 $ gosub define_gawklocale
3601 $ AWKPATH_srcdir
3602 $ gawk -f 'test'.awk 2>&1 >_'test'.tmp
3603 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
3604 $ if $status
3605 $ then
3606 $ rm _'test'.tmp;
3607 $ gosub junit_report_pass
3608 $ else
3609 $ gosub junit_report_fail_diff
3610 $ endif
3611 $ return
3612 $!
3613 $printfbad2:
3614 $printfbad3:
3615 $printfbad4:
3616 $ echo "''test'"
3617 $ test_class = "gawk_ext"
3618 $ set noOn
3619 $ gawk --lint -f 'test'.awk 'test'.in >_'test'.tmp 2>&1
3620 $ if .not. $status then call exit_code '$status' _'test'.tmp
3621 $ set On
3622 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
3623 $ if $status
3624 $ then
3625 $ rm _'test'.tmp;
3626 $ gosub junit_report_pass
3627 $ else
3628 $ gosub junit_report_fail_diff
3629 $ endif
3630 $ return
3631 $
3632 $fmtspcl: echo "fmtspcl"
3633 $ test_class = "hardware"
3634 $ skip_reason = "Not supported."
3635 $ gosub junit_report_skip
3636 $ return
3637 $!!fmtspcl:
3638 $! fmtspcl ought to work if gawk was compiled to use IEEE floating point
3639 $ if floatmode.lt.0 then gosub calc_floatmode
3640 $ if floatmode.lt.2
3641 $ then
3642 $ echo "fmtspcl: not supported"
3643 $ ! report skip ...
3644 $ return
3645 $ endif
3646 $ echo "fmtspcl"
3647 $ gawk -f fmtspcl.awk >_fmtspcl.tmp 2>&1
3648 $ cmp fmtspcl.ok sys$disk:[]_fmtspcl.tmp
3649 $ if $status
3650 $ then
3651 $ rm _fmtspcl.tmp;
3652 $ gosub junit_report_pass
3653 $ else
3654 $ gosub junit_report_fail_diff
3655 $ endif
3656 $ return
3657 $
3658 $intformat: echo "intformat"
3659 $ test_class = "hardware"
3660 $! note: we use the Alpha value for D_float; VAX value is slightly higher
3661 $! due to not losing precision by being processed via G_float
3662 $ huge_0 = "1.70141183460469213e+38" ! D_float
3663 $ huge_1 = "8.98846567431157854e+307" ! G_float
3664 $ huge_2 = "1.79769313486231570e+308" ! IEEE T_float
3665 $ if floatmode.lt.0 then gosub calc_floatmode
3666 $ hugeval = huge_'floatmode'
3667 $ set noOn
3668 $ gawk -v "HUGEVAL=''hugeval'" -f intformat.awk >_intformat.tmp 2>&1
3669 $ set On
3670 $ cmp intformat.ok sys$disk:[]_intformat.tmp
3671 $ if $status
3672 $ then
3673 $ rm _intformat.tmp;
3674 $ gosub junit_report_pass
3675 $ else
3676 $ gosub junit_report_fail_diff
3677 $ endif
3678 $ return
3679 $
3680 $! ugh... BEGINFILE functionality works fine, but test is heavily Unix-centric
3681 $beginfile1: echo "beginfile1"
3682 $ test_class = "gawk_ext"
3683 $ ! complications: "." is a filename, not the current directory
3684 $ ! (even "[]" is actually "[].", that same filename, but we can
3685 $ ! handle hacking it more easily);
3686 $ ! "no/such/file" yields syntax error rather than no such file
3687 $ ! when subdirectories no/ and no/such/ don't exist;
3688 $ ! vms test suite doesn't generate Makefile;
3689 $ ! "is a directory" and "no such file" aren't capitalized
3690 $ ! gawk -f beginfile1.awk beginfile1.awk . -
3691 $ ! ./no/such/file "Makefile" >_beginfile1.tmp 2>&1
3692 $ ! And NFS on ODS2 encodes the case in the filename with
3693 $ ! the $ character switching case.
3694 $ makefile_in = "Makefile.in"
3695 $ makefile_in_nfs_ods2 = "$M$akefile.in"
3696 $ if f$search(makefile_in_nfs_ods2) .nes. ""
3697 $ then
3698 $ makefile_in = makefile_in_nfs_ods2
3699 $ endif
3700 $ gawk -f beginfile1.awk beginfile1.awk [] -
3701 ./no-such-file "''makefile_in'" >_beginfile1.tmp 2>&1
3702 $ gawk -f - _beginfile1.tmp >_beginfile1.too
3703 { if (gsub("\\[\\]",".")) gsub("no such file or directory","is a directory")
3704 gsub("no-such-file","file"); gsub("Makefile.in","Makefile");
3705 gsub("\\$M\\$akefile.in","Makefile"); print }
3706 $ if f$search("sys$disk:[]_''test'.too;2") .nes. ""
3707 $ then
3708 $ delete sys$disk:[]_'test'.too;2
3709 $ endif
3710 $ rm _beginfile1.tmp;
3711 $ mv _beginfile1.too _beginfile1.tmp
3712 $ igncascmp beginfile1.ok sys$disk:[]_beginfile1.tmp
3713 $ if $status
3714 $ then
3715 $ rm _beginfile1.tmp;
3716 $ gosub junit_report_pass
3717 $ else
3718 $ gosub junit_report_fail_diff
3719 $ endif
3720 $ return
3721 $
3722 $dumpvars: echo "dumpvars"
3723 $ test_class = "gawk_ext"
3724 $ gawk --dump-variables 1 <dumpvars.in >_NL: 2>&1
3725 $ mv awkvars.out _dumpvars.tmp
3726 $ gawk "!/ENVIRON|PROCINFO/" _dumpvars.tmp >_dumpvars.tmp1
3727 $ if f$search("sys$disk:[]_''test'.tmp1;2") .nes. ""
3728 $ then
3729 $ delete sys$disk:[]_'test'.tmp1;2
3730 $ endif
3731 $ rm sys$disk:[]_dumpvars.tmp;*
3732 $ mv sys$disk:[]_dumpvars.tmp1 sys$disk:[]_dumpvars.tmp
3733 $ cmp dumpvars.ok sys$disk:[]_dumpvars.tmp
3734 $ if $status
3735 $ then
3736 $ rm _dumpvars.tmp;
3737 $ gosub junit_report_pass
3738 $ else
3739 $ gosub junit_report_fail_diff
3740 $ endif
3741 $ return
3742 $
3743 $!
3744 $profile0:
3745 $ echo "''test'"
3746 $ test_class = "gawk_ext"
3747 $ gawk --profile=_ap-'test'.out -f 'test'.awk 'test'.in > _NL:
3748 $ ! sed <awkprof.out 1,2d >_profile3.tmp
3749 $ gawk "NR>2" _ap-'test'.out > sys$disk:[]_awkprof.out
3750 $ if f$search("sys$disk:[]_awkprof.out;2") .nes. ""
3751 $ then
3752 $ delete sys$disk:[]_awkprof.out;2
3753 $ endif
3754 $ convert/fdl=nla0: _awkprof.out sys$disk:[]_'test'.tmp
3755 $ convert/fdl=nla0: 'test'.ok _'test'.ok
3756 $ cmp _'test'.ok sys$disk:[]_'test'.tmp
3757 $ if $status
3758 $ then
3759 $ rm _'test'.tmp;*,_'test'.ok;*,_ap-'test'.out;,_awkprof.out;
3760 $ gosub junit_report_pass
3761 $ else
3762 $ gosub junit_report_fail_diff
3763 $ endif
3764 $ return
3765 $!
3766 $profile1: echo "''test'"
3767 $ test_class = "gawk_ext"
3768 $ ! FIXME: for both gawk invocations which pipe output to SORT,
3769 $ ! two output files get created; the top version has real output
3770 $ ! but there's also an empty lower version.
3771 $! oldout = f$search("_''test'.tmp1")
3772 $ gawk -f xref.awk dtdgport.awk > _'test'.out1
3773 $ gawk --pretty-print=ap-'test'.out -f xref.awk
3774 $ gawk -f ap-'test'.out dtdgport.awk > _'test'.out2
3775 $ cmp _'test'.out1 sys$disk:[]_'test'.out2
3776 $ if $status
3777 $ then
3778 $ rm ap-'test'.out;*, _'test'.out%;*
3779 $ gosub junit_report_pass
3780 $ else
3781 $ gosub junit_report_fail_diff
3782 $ endif
3783 $ return
3784 $
3785 $profile2: echo "''test'"
3786 $ test_class = "gawk_ext"
3787 $ gawk --profile -v "sortcmd=SORT sys$input: sys$output:" -
3788 -f xref.awk dtdgport.awk > _NL:
3789 $! Test passes, but verification failing.
3790 $ skip_reason = "Verification bug in VMS 9.2-2 edit/sum access violation
3791 $ gosub junit_report_skip
3792 $ return
3793 $ ! sed <awkprof.out 1,2d >_profile2.tmp
3794 $ sumslp awkprof.out /update=sys$input: /output=_'test'.tmp
3795 -1,2
3796 /
3797 $ rm awkprof.out;
3798 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
3799 $ if $status
3800 $ then
3801 $ rm _'test'.tmp;*
3802 $ gosub junit_report_pass
3803 $ else
3804 $ gosub junit_report_fail_diff
3805 $ endif
3806 $ return
3807 $
3808 $profile4:
3809 $profile5:
3810 $profile8:
3811 $ echo "''test'"
3812 $ test_class = "gawk_ext"
3813 $ if f$search("sys$disk:[]_''test'.tmp1") .nes. ""
3814 $ then
3815 $ delete _'test'.tmp1;*
3816 $ endif
3817 $ if f$search("sys$disk:[]_''test'.tmp2;*") .nes. ""
3818 $ then
3819 $ delete sys$disk:[]_'test'.tmp2;*
3820 $ endif
3821 $ tmp_error = "_''test'.tmp2"
3822 $ define/user GAWK_NO_PP_RUN 1
3823 $ define/user sys$error 'tmp_error'
3824 $ set noOn
3825 $ gawk --pretty-print=_'test'.tmp1 -f 'test'.awk > _NL:
3826 $ gawk_status = $status
3827 $ set On
3828 $ if f$search("sys$disk:[]_''test'.tmp1;2") .nes. ""
3829 $ then
3830 $ delete sys$disk:[]_'test'.tmp1;2
3831 $ endif
3832 $ if f$search("sys$disk:[]_''test'.tmp2;2") .nes. ""
3833 $ then
3834 $ delete sys$disk:[]_'test'.tmp2;2
3835 $ endif
3836 $ append _'test'.tmp2 _'test'.tmp1
3837 $ convert/fdl=nla0: _'test'.tmp1 sys$disk:[]_'test'.tmp
3838 $ convert/fdl=nla0: 'test'.ok _'test'.ok
3839 $ if .not. gawk_status
3840 $ then
3841 $ call exit_code 'gawk_status' _'test'.tmp
3842 $ endif
3843 $ cmp sys$disk:[]_'test'.ok sys$disk:[]_'test'.tmp
3844 $ cmp_status = $status
3845 $ if gawk_status then gawk_status = cmp_status
3846 $ if gawk_status
3847 $ then
3848 $ rm _'test'.tmp;*,_'test'.ok;*,_'test'.tmp1;*
3849 $ gosub junit_report_pass
3850 $ else
3851 $ gosub junit_report_fail_diff
3852 $ endif
3853 $ return
3854 $!
3855 $profile6:
3856 $profile7:
3857 $profile3: echo "''test'"
3858 $ test_class = "gawk_ext"
3859 $ if f$search("''test'.tmp1") .nes. "" then delete 'test'.tmp1;*
3860 $ gawk --profile=ap-'test'.out -f 'test'.awk > _NL:
3861 $ ! sed <awkprof.out 1,2d >_profile3.tmp
3862 $ if f$search("sys$disk:[]_''test'.tmp1;*") .nes. ""
3863 $ then
3864 $ delete sys$disk:[]_'test'.tmp1;*
3865 $ endif
3866 $ gawk "NR>2" ap-'test'.out > sys$disk:[]_'test'.tmp1
3867 $ if f$search("sys$disk:[]_''test'.tmp1;2") .nes. ""
3868 $ then
3869 $ delete sys$disk:[]_'test'.tmp1;2
3870 $ endif
3871 $ convert/fdl=nla0: _'test'.tmp1 sys$disk:[]_'test'.tmp
3872 $ convert/fdl=nla0: 'test'.ok _'test'.ok
3873 $ cmp _'test'.ok sys$disk:[]_'test'.tmp
3874 $ if $status
3875 $ then
3876 $ rm _'test'.tmp;*,_'test'.ok;*,_'test'.tmp1;*,ap-'test'.out;*
3877 $ gosub junit_report_pass
3878 $ else
3879 $ gosub junit_report_fail_diff
3880 $ endif
3881 $ return
3882 $
3883 $next: echo "next"
3884 $ test_class = "gawk_ext"
3885 $ set noOn
3886 $ gawk "{next}" _NL: > _next.tmp 2>&1
3887 $ gawk "function f() {next}; {f()}" _NL: >>_next.tmp 2>&1
3888 $ gawk "function f() {next}; BEGIN{f()}" _NL: >>_next.tmp 2>&1
3889 $ gawk "function f() {next}; {f()}; END{f()}" _NL: >>_next.tmp 2>&1
3890 $ gawk "function f() {next}; BEGINFILE{f()}" _NL: >>_next.tmp 2>&1
3891 $ gawk "function f() {next}; {f()}; ENDFILE{f()}" _NL: >>_next.tmp 2>&1
3892 $ set On
3893 $ cmp next.ok sys$disk:[]_next.tmp
3894 $ if $status
3895 $ then
3896 $ rm _next.tmp;
3897 $ gosub junit_report_pass
3898 $ else
3899 $ gosub junit_report_fail_diff
3900 $ endif
3901 $ return
3902 $
3903 $exit: echo "exit"
3904 $ test_class = "gawk_ext"
3905 $ if .not.pipeok
3906 $ then echo "Without the PIPE command, ''test' can't be run."
3907 $ On warning then return
3908 $ pipe echo "PIPE command is available; running exit test"
3909 $ On warning then $
3910 $ pipeok = 1
3911 $ else
3912 $ echo "PIPE command is available; running exit test"
3913 $ endif
3914 $ set noOn
3915 $ call/Output=_exit.tmp do__exit
3916 $ set On
3917 $ cmp exit.ok sys$disk:[]_exit.tmp
3918 $ if $status
3919 $ then
3920 $ rm _exit.tmp;
3921 $ gosub junit_report_pass
3922 $ else
3923 $ gosub junit_report_fail_diff
3924 $ endif
3925 $ return
3926 $
3927 $do__exit: subroutine
3928 $ gawk = gawk !PIPE won't propagate local symbols from outer procedure
3929 $ x = "BEGIN{print 1; exit; print 2}; NR>1{print}; END{print 3; exit; print 4}"
3930 $ pipe gawk -- "BEGIN { print ""a\nb"" }" | gawk -- "''x'"
3931 $ echo "-- 1"
3932 $ x = "function f(){exit}; END{print NR;f();print NR}"
3933 $ pipe gawk -- "BEGIN { print ""a\nb"" }" | gawk -- "''x'"
3934 $ echo "-- 2"
3935 $ x = "function f(){exit}; NR>1 {f()}; END{print NR; f();print NR}"
3936 $ pipe gawk -- "BEGIN { print ""a\nb"" }" | gawk -- "''x'"
3937 $ echo "-- 3"
3938 $ x = "function f(){exit}; NR>1 {f()}; END{print NR;print NR}"
3939 $ pipe gawk -- "BEGIN { print ""a\nb"" }" | gawk -- "''x'"
3940 $ echo "-- 4"
3941 $ x = "function f(){exit}; BEGINFILE {f()}; NR>1 {f()}; END{print NR}"
3942 $ pipe gawk -- "BEGIN { print ""a\nb"" }" | gawk -- "''x'"
3943 $ echo "-- 5"
3944 $! Ugh; extra quotes are needed here to end up with """" after "''y'"
3945 $! expansion and finally "" when gawk actually sees its command line.
3946 $ y = "function strip(f) { sub(/.*\//, """""""", f); return f };"
3947 $ x = "BEGINFILE{if(++i==1) exit;}; END{print i, strip(FILENAME)}"
3948 $ gawk "''y'''x'" /dev/null exit.sh
3949 $ echo "-- 6"
3950 $ x = "BEGINFILE{if(++i==1) exit;}; ENDFILE{print i++}; END{print i, strip(FILENAME)}"
3951 $ gawk "''y'''x'" /dev/null exit.sh
3952 $ echo "-- 7"
3953 $ x = "function f(){exit}; BEGINFILE{i++ && f()}; END{print NR,strip(FILENAME)}"
3954 $ gawk "''y'''x'" /dev/null exit.sh
3955 $ echo "-- 8"
3956 $ x = "function f(){exit}; BEGINFILE{i++ && f()}; ENDFILE{print i}; END{print NR,strip(FILENAME)}"
3957 $ gawk "''y'''x'" /dev/null exit.sh
3958 $ echo "-- 9"
3959 $ x = "function f(){exit}; BEGINFILE{i++}; ENDFILE{f(); print i}; END{print NR,strip(FILENAME)}"
3960 $ gawk "''y'''x'" /dev/null exit.sh
3961 $ echo "-- 10"
3962 $ x = "function f(){exit}; BEGINFILE{i++}; ENDFILE{i>1 && f(); print i, strip(FILENAME)}"
3963 $ gawk "''y'''x'" /dev/null exit.sh
3964 $ echo "-- 11"
3965 $ endsubroutine !do__exit
3966 $
3967 $vms_cmd: echo "vms_cmd"
3968 $ test_class = "vms_tests"
3969 $ if f$search("vms_cmd.ok").eqs.""
3970 $ then create vms_cmd.ok
3971 World!
3972 $ endif
3973 $ gawk /Commands="BEGIN { print ""World!"" }" _NL: /Output=_vms_cmd.tmp
3974 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3975 $ then
3976 $ delete sys$disk:[]_'test'.tmp;2
3977 $ endif
3978 $ cmp vms_cmd.ok sys$disk:[]_vms_cmd.tmp
3979 $ if $status
3980 $ then
3981 $ rm _vms_cmd.tmp;,vms_cmd.ok;*
3982 $ gosub junit_report_pass
3983 $ else
3984 $ gosub junit_report_fail_diff
3985 $ endif
3986 $ return
3987 $
3988 $vms_io1: echo "vms_io1"
3989 $ test_class = "vms_tests"
3990 $ if f$search("vms_io1.ok").eqs.""
3991 $ then create vms_io1.ok
3992 Hello
3993 $ endif
3994 $ ! define/User dbg$input sys$command:
3995 $ gawk -f - >_vms_io1.tmp
3996 # prior to 3.0.4, gawk crashed doing any redirection after closing stdin
3997 BEGIN { print "Hello" >"/dev/stdout" }
3998 $ if f$search("sys$disk:[]_''test'.tmp;2") .nes. ""
3999 $ then
4000 $ delete sys$disk:[]_'test'.tmp;2
4001 $ endif
4002 $ cmp vms_io1.ok sys$disk:[]_vms_io1.tmp
4003 $ if $status
4004 $ then
4005 $ rm _vms_io1.tmp;,vms_io1.ok;*
4006 $ gosub junit_report_pass
4007 $ else
4008 $ gosub junit_report_fail_diff
4009 $ endif
4010 $ return
4011 $
4012 $vms_io2: echo "vms_io2"
4013 $ test_class = "vms_tests"
4014 $ if f$search("vms_io2.ok").eqs.""
4015 $ then create vms_io2.ok
4016 xyzzy
4017 $ endif
4018 $ ! VAXCRTL created all files in stream_LF format unless explicitly
4019 $ ! overridden by the program; with DECC$SHR, a new version of an
4020 $ ! existing file inherits the previous version's record format;
4021 $ ! for gawk versions older than 3.1.7, that resulted in
4022 $ ! "can't redirect to `File' (invalid record attributes)"
4023 $ ! when an awk program used >"File" (internally, not on command line)
4024 $ ! and File already existed as a batch log file or PIPE output file
4025 $ create /FDL=sys$input: _vms_io2.vfc
4026 file
4027 organization sequential
4028 record
4029 format VFC ! variable with fixed control area (default size 2 bytes)
4030 carriage_control print
4031 $ set noOn
4032 $ ! define/User dbg$input sys$command:
4033 $ gawk -- "BEGIN { print ""xyzzy"" >""_vms_io2.vfc"" }" >_vms_io2.tmp 2>&1
4034 $ set On
4035 $ cmp _NL: sys$disk:[]_vms_io2.tmp
4036 $ if $status then rm _vms_io2.tmp;
4037 $ cmp vms_io2.ok sys$disk:[]_vms_io2.vfc
4038 $ if $status
4039 $ then
4040 $ rm _vms_io2.vfc;*,vms_io2.ok;*
4041 $ gosub junit_report_pass
4042 $ else
4043 $ gosub junit_report_fail_diff
4044 $ endif
4045 $ return
4046 $!
4047 $!
4048 $inplace1:
4049 $inplace2:
4050 $ echo "''test'"
4051 $ if arch_name .eqs. "VAX"
4052 $ then
4053 $ skip_reason = "ODS-5 required"
4054 $ gosub junit_report_skip
4055 $ return
4056 $ endif
4057 $ set process/parse=extended ! ODS-5 only
4058 $ test_class = "shlib"
4059 $ filefunc_file = "[-]gawkapi.o"
4060 $ open/write awkfile _'test'.awk
4061 $ write awkfile "@load ""inplace"""
4062 $! write awkfile "BEGIN {print ""before""}"
4063 $ write awkfile " {gsub(/foo/, ""bar""); print}"
4064 $! write awkfile "END {print ""after""}"
4065 $ close awkfile
4066 $ copy inplace^.1.in _'test'.1
4067 $ copy inplace^.2.in _'test'.2
4068 $ set noOn
4069 $ AWKLIBPATH_dir
4070 $ gawk -f _'test'.awk _'test'.1 <inplace.in >_'test'.1.tmp 2>&1
4071 $ if .not. $status then call exit_code '$status' _'test'.1.tmp
4072 $ AWKLIBPATH_dir
4073 $ gawk -f _'test'.awk _'test'.2 <inplace.in >_'test'.2.tmp 2>&1
4074 $ if .not. $status then call exit_code '$status' _'test'.2.tmp
4075 $ set On
4076 $ cmp 'test'.1.ok sys$disk:[]_'test'.1.tmp
4077 $ if $status then rm _'test'.1.tmp;,_'test'.1;
4078 $ cmp 'test'.2.ok sys$disk:[]_'test'.2.tmp
4079 $ if $status
4080 $ then
4081 $ rm _'test'.2.tmp;,_'test'.2;,_'test'.awk;
4082 $ gosub junit_report_pass
4083 $ else
4084 $ gosub junit_report_fail_diff
4085 $ endif
4086 $ return
4087 $!
4088 $filefuncs:
4089 $ echo "''test'"
4090 $ test_class = "shlib"
4091 $ filefunc_file = "[-]gawkapi.o"
4092 $ open/write gapi 'filefunc_file'
4093 $ close gapi
4094 $ set noOn
4095 $ AWKLIBPATH_dir
4096 $ gawk -v builddir="sys$disk:[-]" -
4097 -f 'test'.awk 'test'.in >_'test'.tmp 2>&1
4098 $ if .not. $status then call exit_code '$status' _'test'.tmp
4099 $ set On
4100 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
4101 $ if $status
4102 $ then
4103 $ rm _'test'.tmp;
4104 $ gosub junit_report_pass
4105 $ else
4106 $ gosub junit_report_fail_diff
4107 $ endif
4108 $ if f$search(filefunc_file) .nes. "" then rm 'filefunc_file';*
4109 $ return
4110 $!
4111 $fnmatch:
4112 $functab4:
4113 $ordchr:
4114 $revout:
4115 $revtwoway:
4116 $time:
4117 $ echo "''test'"
4118 $ test_class = "shlib"
4119 $ filefunc_file = "[-]gawkapi.o"
4120 $ open/write gapi 'filefunc_file'
4121 $ close gapi
4122 $ set noOn
4123 $ AWKLIBPATH_dir
4124 $ gawk -f 'test'.awk 'test'.in >_'test'.tmp 2>&1
4125 $ if .not. $status then call exit_code '$status' _'test'.tmp
4126 $ set On
4127 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
4128 $ if $status
4129 $ then
4130 $ rm _'test'.tmp;
4131 $ gosub junit_report_pass
4132 $ else
4133 $ gosub junit_report_fail_diff
4134 $ endif
4135 $ if f$search(filefunc_file) .nes. "" then rm 'filefunc_file';*
4136 $ return
4137 $!
4138 $ordchr2:
4139 $ echo "''test'"
4140 $ test_class = "shlib"
4141 $ filefunc_file = "[-]gawkapi.o"
4142 $ open/write gapi 'filefunc_file'
4143 $ close gapi
4144 $ set noOn
4145 $ AWKLIBPATH_dir
4146 $ gawk --load ordchr "BEGIN {print chr(ord(""z""))}" > _'test'.tmp 2>&1
4147 $ if .not. $status then call exit_code '$status' _'test'.tmp
4148 $ set On
4149 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
4150 $ if $status
4151 $ then
4152 $ rm _'test'.tmp;
4153 $ gosub junit_report_pass
4154 $ else
4155 $ gosub junit_report_fail_diff
4156 $ endif
4157 $ if f$search(filefunc_file) .nes. "" then rm 'filefunc_file';*
4158 $ return
4159 $
4160 $!
4161 $rwarray:
4162 $ echo "''test'"
4163 $ test_class = "shlib"
4164 $ set noOn
4165 $ AWKLIBPATH_dir
4166 $ gawk -f 'test'.awk 'test'.in >_'test'.tmp 2>&1
4167 $ if .not. $status then call exit_code '$status' _'test'.tmp
4168 $ set On
4169 $ cmp orig.out new.out
4170 $ if $status
4171 $ then
4172 $ open/append tout _'test'.tmp
4173 $ write tout "old and new are equal - GOOD"
4174 $ close tout
4175 $ endif
4176 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
4177 $ if $status
4178 $ then
4179 $ rm _'test'.tmp;,orig.bin;,orig.out;,new.out;
4180 $ gosub junit_report_pass
4181 $ else
4182 $ gosub junit_report_fail_diff
4183 $ endif
4184 $ return
4185 $!
4186 $readdir:
4187 $fts:
4188 $ echo "''test'"
4189 $ test_class = "shlib"
4190 $ set noOn
4191 $ AWKLIBPATH_dir
4192 $ gawk -f 'test'.awk >_'test'.tmp 2>&1
4193 $ if .not. $status
4194 $ then
4195 $ call exit_code '$status' _'test'.tmp
4196 $ write sys$output _'test'.tmp
4197 $ gosub junit_report_fail_diff
4198 $ else
4199 $ gosub junit_report_pass
4200 $ if f$search("_''test'.tmp") .nes. "" then rm _'test'.tmp;*
4201 $ if f$search("_''test'.") .nes. "" then rm _'test'.;*
4202 $ endif
4203 $ set On
4204 $ return
4205 $!
4206 $readfile:
4207 $ echo "''test'"
4208 $ test_class = "shlib"
4209 $ if f$search("sys$disk:[-]readfile.exe") .eqs. ""
4210 $ then
4211 $ echo "Readfile extension not currently building on VMS."
4212 $ skip_reason = "Readfile not building on VMS"
4213 $ gosub junit_report_skip
4214 $ return
4215 $ else
4216 $ echo "Surprise! Found the readfile extension so attempting test."
4217 $ endif
4218 $ set noOn
4219 $ AWKLIBPATH_dir
4220 $ gawk -l readfile -
4221 "BEGIN {printf-f ""%s"", readfile("Makefile.in")}" >_'test'.tmp 2>&1
4222 $ if .not. $status then call exit_code '$status' _'test'.tmp
4223 $ cmp Makefile.in sys$disk:[]_'test'.tmp
4224 $ if $status
4225 $ then
4226 $ rm _'test'.tmp;
4227 $ gosub junit_report_pass
4228 $ else
4229 $ gosub junit_report_fail_diff
4230 $ copy Makefile.in 'test'.ok
4231 $ endif
4232 $ set On
4233 $ return
4234 $!
4235 $readfile2:
4236 $ echo "''test'"
4237 $ test_class = "shlib"
4238 $ if f$search("sys$disk:[-]readfile.exe") .eqs. ""
4239 $ then
4240 $ echo "Readfile extension not currently building on VMS."
4241 $ skip_reason = "Readfile not building on VMS"
4242 $ gosub junit_report_skip
4243 $ return
4244 $ else
4245 $ echo "Surprise! Found the readfile extension so attempting test."
4246 $ endif
4247 $ set noOn
4248 $ AWKLIBPATH_dir
4249 $ gawk -f 'test'.awk 'test'.awk >_'test'.tmp 2>&1
4250 $ if .not. $status then call exit_code '$status' _'test'.tmp
4251 $ cmp 'test'.ok sys$disk:[]_'test'.tmp
4252 $ if $status
4253 $ then
4254 $ rm _'test'.tmp;
4255 $ gosub junit_report_pass
4256 $ else
4257 $ gosub junit_report_fail_diff
4258 $ endif
4259 $ set On
4260 $ return
4261 $
4262 $clean:
4263 $ if f$search("_*.tmp") .nes."" then rm _*.tmp;*
4264 $ if f$search("_*.out") .nes."" then rm _*.out;*
4265 $ if f$search("_*.ok") .nes."" then rm _*.ok;*
4266 $ if f$search("_*.1") .nes."" then rm _*.1;*
4267 $ if f$search("_*.2") .nes."" then rm _*.2;*
4268 $ if f$search("_*.awk") .nes."" then rm _*.awk;*
4269 $ if f$search("_*.too") .nes."" then rm _*.too;*
4270 $ if f$search("awkprofile.out") .nes."" then rm awkprofile.out;*
4271 $ if f$search("out%.") .nes."" then rm out%.;*
4272 $ if f$search("strftime.in").nes."" then rm strftime.in;*
4273 $ if f$search("strftime.ok").nes."" then rm strftime.ok;*
4274 $ if f$search("test%.") .nes."" then rm test%.;*
4275 $ if f$search("seq.") .nes."" then rm seq.;*
4276 $ if f$search("_pid.in") .nes."" then rm _pid.in;*
4277 $ if f$search("[.junk]*.*").nes."" then rm [.junk]*.*;*
4278 $ if f$parse("[.junk]") .nes."" then rm []junk.dir;1
4279 $ if f$search("_vms_io2.vfc") .nes."" then rm _vms_io2.vfc;*
4280 $ return
4281 $
4282 $! try to determine what type of double precision floating point gawk uses
4283 $calc_floatmode:
4284 $ ! this is fragile; it might break if gawk changes overflow handling
4285 $ Set noOn
4286 $ gawk -- "BEGIN {print 10^308}" >_NL: 2>&1
4287 $ if $status
4288 $ then floatmode = 2 ! IEEE T_float
4289 $ else gawk -- "BEGIN {print 10^307}" >_NL: 2>&1
4290 $ if $status
4291 $ then floatmode = 1 ! Alpha/VAX G_float
4292 $ else floatmode = 0 ! VAX D_float
4293 $ endif
4294 $ endif
4295 $ Set On
4296 $ return
4297 $
4298 $! assign temporary value to logical name GAWKLOCALE unless it already has one
4299 $! [ -z "$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8
4300 $define_gawklocale:
4301 $ if f$search("sys$i18n_locale:utf8-50.locale") .nes. ""
4302 $ then
4303 $ define/user LC_ALL "utf8-50"
4304 $ else
4305 $ define/user LC_ALL "utf8-20"
4306 $ endif
4307 $ return
4308 $!
4309 $define_gawklocale_ja_jp:
4310 $! @GAWKLOCALE=ja_JP.UTF-8 ; export GAWKLOCALE ; \
4311 $ if f$search("sys$i18n_locale:ja_jp_utf-8.locale") .nes. ""
4312 $ then
4313 $ define/user LC_ALL "ja_JP_utf-8"
4314 $ else
4315 $ write sys$output "Substituting UTF8-20 for ja_JP.UTF-8"
4316 $ define/user LC_ALL "utf8-20"
4317 $ endif
4318 $ return
4319 $
4320 $! make sure that the specified file's longest-record-length field is set;
4321 $! otherwise DIFF will choke if any record is longer than 512 bytes
4322 $fixup_LRL: subroutine
4323 $ lrl = 0 !VMS V5.5-2 didn't support the LRL argument yet
4324 $ define/user sys$error _NL:
4325 $ define/user sys$output _NL:
4326 $ lrl = f$file_attribute(p1,"LRL")
4327 $ if lrl.eq.0 then lrl = f$file_attribute(p1,"MRS")
4328 $ if lrl.eq.0
4329 $ then convert/fdl=sys$input: 'p1' *.*
4330 file
4331 organization sequential
4332 record
4333 format stream_lf
4334 size 32767
4335 $ if $status .and. p2.eqs."purge" then rm 'p1';-1
4336 $ else cmp _NL: _NL: !deassign/user sys${error,output}
4337 $ endif
4338 $ endsubroutine !fixup_LRL
4339 $
4340 $! add a fake "EXIT CODE" record to the end of the temporary output file
4341 $! to simulate the ``|| echo EXIT CODE $$? >>_$@'' shell script usage
4342 $! Unix code = vms_code & (255 * 2^3) >> 3
4343 $exit_code: subroutine
4344 $ unix_status = (p1 .and. %x7f8) / 8
4345 $ if f$trnlnm("FTMP").nes."" then close/noLog ftmp
4346 $ open/Append ftmp 'p2'
4347 $ write ftmp "EXIT CODE: ",'unix_status'
4348 $ close ftmp
4349 $ endsubroutine !exit_code
4350 $
4351 $!NOTREACHED
4352 $ exit