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