blob: cac7abd3a4367d6af6ea09a798196cf1a182a14e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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 "$"
}
|