diff options
Diffstat (limited to 'vms/vmstest.com')
-rw-r--r-- | vms/vmstest.com | 161 |
1 files changed, 133 insertions, 28 deletions
diff --git a/vms/vmstest.com b/vms/vmstest.com index 25404373..6d46c4d7 100644 --- a/vms/vmstest.com +++ b/vms/vmstest.com @@ -25,6 +25,7 @@ $ rm = "delete/noConfirm/noLog" $ mv = "rename/New_Vers" $ gawk = "$sys$disk:[-]gawk" $ AWKPATH_srcdir = "define/User AWKPATH sys$disk:[]" +$ AWKLIBPATH_dir = "define/User AWKLIBPATH sys$disk:[-]" $ $ listdepth = 0 $ pipeok = 0 @@ -159,6 +160,13 @@ $ type sys$input: $ list = "inetechu inetecht inetdayu inetdayt" $ gosub list_of_tests $ return +$! +$extension: echo "extension...." +$ list = "inplace1 filefuncs fnmatch fts functab4 ordchr" - + + " readdir revout revtwoway rwarray time" + gosub list_of_tests + return + $ $! list_of_tests: process 'list', a space-separated list of tests. $! Some tests assign their own 'list' and call us recursively, @@ -578,7 +586,7 @@ $defref: echo "defref" $ set noOn $ AWKPATH_srcdir $ gawk --lint -f defref.awk >_defref.tmp 2>&1 -$ if .not.$status then call exit_code 2 _defref.tmp +$ if .not. $status then call exit_code '$status' _defref.tmp $ set On $ cmp defref.ok sys$disk:[]_defref.tmp $ if $status then rm _defref.tmp; @@ -594,6 +602,8 @@ $ $strftime: echo "strftime" $ ! this test could fail on slow machines or on a second boundary, $ ! so if it does, double check the actual results +$ ! This test needs SYS$TIMEZONE_NAME and SYS$TIMEZONE_RULE +$ ! to be properly defined. $!! date | gawk -v "OUTPUT"=_strftime.tmp -f strftime.awk $ now = f$time() $ wkd = f$extract(0,3,f$cvtime(now,,"WEEKDAY")) @@ -601,11 +611,12 @@ $ mon = f$cvtime(now,"ABSOLUTE","MONTH") $ mon = f$extract(0,1,mon) + f$edit(f$extract(1,2,mon),"LOWERCASE") $ day = f$cvtime(now,,"DAY") $ tim = f$extract(0,8,f$cvtime(now,,"TIME")) -$ tz = "" +$! Can not use tz as it shows up in the C environment. +$ timezone = f$trnlnm("SYS$TIMEZONE_NAME") $ yr = f$cvtime(now,,"YEAR") $ if f$trnlnm("FTMP").nes."" then close/noLog ftmp $ open/Write ftmp strftime.in -$ write ftmp wkd," ",mon," ",day," ",tim," ",tz," ",yr +$ write ftmp wkd," ",mon," ",day," ",tim," ",timezone," ",yr $ close ftmp $ gawk -v "OUTPUT"=_strftime.tmp -f strftime.awk strftime.in $ set noOn @@ -637,7 +648,7 @@ $ $incdupe: echo "''test'" $ set noOn $ gawk --lint -i inclib -i inclib.awk "BEGIN {print sandwich(""a"", ""b"", ""c"")}" > _'test'.tmp 2>&1 -$ if .not. $status then call exit_code 1 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp;* $ set On @@ -646,7 +657,7 @@ $ $incdupe2: echo "''test'" $ set noOn $ gawk --lint -f inclib -f inclib.awk >_'test'.tmp 2>&1 -$ if .not. $status then call exit_code 1 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp;* $ set On @@ -661,7 +672,7 @@ $ $incdupe4: echo "''test'" $ set NoOn $ gawk --lint -f hello -i hello.awk >_'test'.tmp 2>&1 -$ if .not. $status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp;* $ set On @@ -670,7 +681,7 @@ $ $incdupe5: echo "''test'" $ set NoOn $ gawk --lint -i hello -f hello.awk >_'test'.tmp 2>&1 -$ if .not. $status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp;* $ set On @@ -679,7 +690,7 @@ $ $incdupe6: echo "''test'" $ set NoOn $ gawk --lint -i inchello -f hello.awk >_'test'.tmp 2>&1 -$ if .not. $status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp;* $ set On @@ -688,7 +699,7 @@ $ $incdupe7: echo "''test'" $ set NoOn $ gawk --lint -f hello -i inchello >_'test'.tmp 2>&1 -$ if .not. $status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp;* $ set On @@ -706,7 +717,7 @@ $symtab2: $symtab3: echo "''test'" $ set noOn $ gawk -f 'test'.awk >_'test'.tmp 2>&1 -$ if .not. $status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp;* $ set On @@ -717,7 +728,7 @@ $symtab5: $symtab7: echo "''test'" $ set noOn $ gawk -f 'test'.awk <'test'.in >_'test'.tmp 2>&1 -$ if .not. $status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp;* $ set On @@ -897,7 +908,7 @@ $noparms: echo "noparms" $ set noOn $ AWKPATH_srcdir $ gawk -f noparms.awk >_noparms.tmp 2>&1 -$ if .not.$status then call exit_code 1 _noparms.tmp +$ if .not. $status then call exit_code '$status' _noparms.tmp $ set On $ cmp noparms.ok sys$disk:[]_noparms.tmp $ if $status then rm _noparms.tmp; @@ -938,7 +949,12 @@ $ gawk -f nasty.awk >_nasty.tmp $ call fixup_LRL nasty.ok $ call fixup_LRL _nasty.tmp "purge" $ cmp nasty.ok sys$disk:[]_nasty.tmp -$ if $status then rm _nasty.tmp; +$ if $status +$ then +$ rm _nasty.tmp; +$ file = "lcl_root:[]nasty.ok" +$ if f$search(file) .nes. "" then rm 'file';* +$ endif $ set On $ return $ @@ -948,7 +964,12 @@ $ gawk -f nasty2.awk >_nasty2.tmp $ call fixup_LRL nasty2.ok $ call fixup_LRL _nasty2.tmp "purge" $ cmp nasty2.ok sys$disk:[]_nasty2.tmp -$ if $status then rm _nasty2.tmp; +$ if $status +$ then +$ rm _nasty2.tmp; +$ file = "lcl_root:[]nasty2.ok" +$ if f$search(file) .nes. "" then rm 'file';* +$ endif $ set On $ return $ @@ -968,7 +989,7 @@ $subslash: $ echo "''test'" $ set noOn $ gawk -f 'test'.awk >_'test'.tmp 2>&1 -$ if .not.$status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ set On $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp; @@ -1077,7 +1098,7 @@ $lintwarn: echo "lintwarn" $ set noOn $ AWKPATH_srcdir $ gawk --lint -f lintwarn.awk >_lintwarn.tmp 2>&1 -$ if .not.$status then call exit_code 1 _lintwarn.tmp +$ if .not. $status then call exit_code '$status' _lintwarn.tmp $ set On $ cmp lintwarn.ok sys$disk:[]_lintwarn.tmp $ if $status then rm _lintwarn.tmp; @@ -1120,7 +1141,7 @@ $sclifin: $ echo "''test'" $ set noOn $ gawk -f 'test'.awk 'test'.in >_'test'.tmp 2>&1 -$ if .not.$status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ set On $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp; @@ -1132,7 +1153,7 @@ $ ! $ echo "''test'" $ set noOn $ gawk -f 'test'.awk <'test'.in >_'test'.tmp 2>&1 -$ if .not.$status then call exit_code 2 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ set On $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp; @@ -1157,7 +1178,7 @@ $unterm: $ echo "''test'" $ set noOn $ gawk -f 'test'.awk 'test'.in >_'test'.tmp 2>&1 -$ if .not.$status then call exit_code 1 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ set On $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp; @@ -1217,7 +1238,7 @@ $synerr2: $ echo "''test'" $ set noOn $ gawk -f 'test'.awk >_'test'.tmp 2>&1 -$ if .not.$status then call exit_code 1 _'test'.tmp +$ if .not. $status then call exit_code '$status' _'test'.tmp $ set On $ cmp 'test'.ok sys$disk:[]_'test'.tmp $ if $status then rm _'test'.tmp; @@ -1237,7 +1258,7 @@ $ $space: echo "space" $ set noOn $ gawk -f " " space.awk >_space.tmp 2>&1 -$ if .not.$status then call exit_code 2 _space.tmp +$ if .not. $status then call exit_code '$status' _space.tmp $ set On $! we get a different error from what space.ok expects $ gawk "{gsub(""file specification syntax error"", ""no such file or directory""); print}" - @@ -1320,7 +1341,7 @@ $ $! This test is somewhat suspect for vms due to exit code manipulation $exitval1: echo "exitval1" $ gawk -f exitval1.awk >_exitval1.tmp 2>&1 -$ if $status then call exit_code 0 _exitval1.tmp +$ if $status then call exit_code '$status' _exitval1.tmp $ cmp exitval1.ok sys$disk:[]_exitval1.tmp $ if $status then rm _exitval1.tmp; $ return @@ -1424,7 +1445,7 @@ $! nofile.ok expects no/such/file, but using that name in the test would $! yield "file specification syntax error" instead of "no such file..." $ set noOn $ gawk "{}" no-such-file >_nofile.tmp 2>&1 -$ if .not.$status then call exit_code 2 _nofile.tmp +$ if .not. $status then call exit_code '$status' _nofile.tmp $ set On $! restore altered file name $ gawk "{gsub(""no-such-file"", ""no/such/file""); print}" _nofile.tmp >_nofile.too @@ -1496,7 +1517,7 @@ $ $mixed1: echo "mixed1" $ set noOn $ gawk -f /dev/null --source "BEGIN {return junk}" >_mixed1.tmp 2>&1 -$ if .not.$status then call exit_code 1 _mixed1.tmp +$ if .not. $status then call exit_code '$status' _mixed1.tmp $ set On $ cmp mixed1.ok sys$disk:[]_mixed1.tmp $ if $status then rm _mixed1.tmp; @@ -1758,7 +1779,7 @@ World! $ endif $ gawk /Commands="BEGIN { print ""World!"" }" _NL: /Output=_vms_cmd.tmp $ cmp vms_cmd.ok sys$disk:[]_vms_cmd.tmp -$ if $status then rm _vms_cmd.tmp; +$ if $status then rm _vms_cmd.tmp;,vms_cmd.ok;* $ return $ $vms_io1: echo "vms_io1" @@ -1771,7 +1792,7 @@ $ gawk -f - >_vms_io1.tmp # prior to 3.0.4, gawk crashed doing any redirection after closing stdin BEGIN { print "Hello" >"/dev/stdout" } $ cmp vms_io1.ok sys$disk:[]_vms_io1.tmp -$ if $status then rm _vms_io1.tmp; +$ if $status then rm _vms_io1.tmp;,vms_io1.ok;* $ return $ $vms_io2: echo "vms_io2" @@ -1799,7 +1820,89 @@ $ set On $ cmp _NL: sys$disk:[]_vms_io2.tmp $ if $status then rm _vms_io2.tmp; $ cmp vms_io2.ok sys$disk:[]_vms_io2.vfc -$ if $status then rm _vms_io2.vfc;* +$ if $status then rm _vms_io2.vfc;*,vms_io2.ok;* +$ return +$! +$! +$inplace1: +$ set process/parse=extended ! ODS-5 only +$ echo "''test'" +$ filefunc_file = "[-]gawkapi.o" +$ open/write awkfile _'test'.awk +$ write awkfile "@load ""inplace""" +$! write awkfile "BEGIN {print ""before""}" +$ write awkfile " {gsub(/foo/, ""bar""); print}" +$! write awkfile "END {print ""after""}" +$ close awkfile +$ copy inplace^.1.in _'test'.1 +$ copy inplace^.2.in _'test'.2 +$ set noOn +$ AWKLIBPATH_dir +$ gawk -f _'test'.awk _'test'.1 <inplace.in >_'test'.1.tmp 2>&1 +$ if .not. $status then call exit_code '$status' _'test'.1.tmp +$ AWKLIBPATH_dir +$ gawk -f _'test'.awk _'test'.2 <inplace.in >_'test'.2.tmp 2>&1 +$ if .not. $status then call exit_code '$status' _'test'.2.tmp +$ set On +$ cmp 'test'.1.ok sys$disk:[]_'test'.1.tmp +$ if $status then rm _'test'.1.tmp;,_'test'.1; +$ cmp 'test'.2.ok sys$disk:[]_'test'.2.tmp +$ if $status then rm _'test'.2.tmp;,_'test'.2;,_'test'.awk; +$ return +$! +$filefuncs: +$fnmatch: +$functab4: +$ordchr: +$revout: +$revtwoway: +$time: +$ echo "''test'" +$ filefunc_file = "[-]gawkapi.o" +$ open/write gapi 'filefunc_file' +$ close gapi +$ set noOn +$ AWKLIBPATH_dir +$ gawk -f 'test'.awk 'test'.in >_'test'.tmp 2>&1 +$ if .not. $status then call exit_code '$status' _'test'.tmp +$ set On +$ cmp 'test'.ok sys$disk:[]_'test'.tmp +$ if $status then rm _'test'.tmp; +$ if f$search(filefunc_file) .nes. "" then rm 'filefunc_file';* +$ return +$! +$rwarray: +$ echo "''test'" +$ set noOn +$ AWKLIBPATH_dir +$ gawk -f 'test'.awk 'test'.in >_'test'.tmp 2>&1 +$ if .not. $status then call exit_code '$status' _'test'.tmp +$ set On +$ cmp orig.out new.out +$ if $status +$ then +$ open/append tout _'test'.tmp +$ write tout "old and new are equal - GOOD" +$ close tout +$ endif +$ cmp 'test'.ok sys$disk:[]_'test'.tmp +$ if $status then rm _'test'.tmp;,orig.bin;,orig.out;,new.out; +$ return +$! +$readdir: +$fts: +$ echo "''test'" +$ set noOn +$ AWKLIBPATH_dir +$ gawk -f 'test'.awk >_'test'.tmp 2>&1 +$ if .not. $status +$ then +$ call exit_code '$status' _'test'.tmp +$ write sys$output _'test'.tmp +$ else +$ rm _'test'.tmp;*,_'test'.;* +$ endif +$ set On $ return $ $clean: @@ -1869,10 +1972,12 @@ $ endsubroutine !fixup_LRL $ $! add a fake "EXIT CODE" record to the end of the temporary output file $! to simulate the ``|| echo EXIT CODE $$? >>_$@'' shell script usage +$! Unix code = vms_code & (255 * 2^3) >> 3 $exit_code: subroutine +$ unix_status = (p1 .and. %x7f8) / 8 $ if f$trnlnm("FTMP").nes."" then close/noLog ftmp $ open/Append ftmp 'p2' -$ write ftmp "EXIT CODE: ",p1 +$ write ftmp "EXIT CODE: ",'unix_status' $ close ftmp $ endsubroutine !exit_code $ |