diff options
Diffstat (limited to 'test/Gentests.vms')
-rw-r--r-- | test/Gentests.vms | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/test/Gentests.vms b/test/Gentests.vms new file mode 100644 index 00000000..cac7abd3 --- /dev/null +++ b/test/Gentests.vms @@ -0,0 +1,102 @@ +# Gentests.vms - supplements Gentests to generate tests in vms format +# gawk -v "VMSTESTS=1" -f Gentests -f Gentests.vms Makefile.am *.awk *.in >Maketests.vms + +/^FAIL_CODE1 *=/,/[^\\]$/ { + gsub(/(^FAIL_CODE1 *=|\\$)/,"") + for (i = 1; i <= NF; i++) + fail_code1[$i] + next +} + +END { + if (VMSTESTS) vmsepilog() +} + +# wildcard expansion done by gawk's vms_arg_fixup() to simulate shell +# globbing produces full filenames: device:[directory]name.type;# +# and by default also forces the value into upper case +function vmsargvfixup( i, f) +{ + # we're forcing lowercase below; need to override for some files + vmscasefixup["makefile.in"] = "Makefile.in" + + for (i = 2; i < ARGC; i++) { + f = ARGV[i] + sub(/^.+[]>]/, "", f) # strip dev+dir prefix + sub(/\;[0-9]+$/, "", f) # strip version suffix + f = tolower(f) + if (f in vmscasefixup) f = vmscasefixup[f] + ARGV[i] = f + } + + vmsprolog() # insert some stuff into the output file +} + +# output sufficient for the simplest tests in vms/vmstest.com +function vmsgenerate(x, s, o) +{ + # generate a gosub-style subroutine; start with its label + printf "$" x ":" + + s = "" + if (x in lint) { + s = s " --lint" + delete lint[x] + } + if (x in lint_old) { + s = s " --lint-old" + delete lint_old[x] + } + if (x".in" in files) { + s = s " <" x ".in" + delete files[x".in"] + } + + o = "_" x ".tmp" + print "\techo \"" x "\"" + print "$\tAWKPATH_srcdir" + print "$\tgawk -f " x ".awk" s " >" o " 2>&1" + print "$\tif .not.$status then call exit_code \"" o "\" " \ + ((x in fail_code1) ? "1" : "2") + print "$\tcmp " x ".ok " o + print "$\tif $status" + print "$\tthen\trm " o ";" + print "$\telse\techo \"test \"\"" x "\"\" failed\"" + print "$\tendif" + print "$\treturn" + + return +} + +# prolog for Maketests.vms +function vmsprolog() +{ + print "$" + print "$\techo\t= \"write sys$output\"" + print "$\tcmp\t= \"diff/Output=_NL:/Maximum=1\"" + print "$\trm\t= \"delete/noConfirm/noLog\"" + print "$\tgawk\t= \"$sys$disk:[-]gawk.exe\"" + print "$\tAWKPATH_srcdir = \"define/User AWKPATH sys$disk:[]\"" + print "$" + + print "$\tset noOn" + print "$ gosub 'p1'" + print "$\tset On" + print "$ exit" + print "$" +} + +# epilog for Maketests.vms +function vmsepilog() +{ + print "$" + print "$! add a fake \"EXIT CODE\" record to the end of temporary output file" + print "$! to simulate the ``|| echo EXIT CODE $$? >>_$@'' shell script usage" + print "$exit_code: subroutine" + print "$\tif f$trnlnm(\"FTMP\").nes.\"\" then close/noLog ftmp" + print "$\topen/Append ftmp 'p1'" + print "$\twrite ftmp \"EXIT CODE: \",p2" + print "$\tclose ftmp" + print "$ endsubroutine !exit_code" + print "$" +} |