summaryrefslogtreecommitdiff
path: root/db/test/scr008/chk.pubdef
blob: a5ba2beae3e730f642f9c50e44c445972801d1cb (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#!/bin/sh -
#
# Reconcile the list of public defines with the man pages and the Java files.

d=../..
docs=../../../db.docs

[ -f $d/LICENSE ] || {
	echo 'FAIL: cannot find source distribution directory.'
	exit 1
}

p=$d/dist/pubdef.in

exitv=0

cat <<END_OF_TEXT
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Check that pubdef.in has everything listed in m4.links.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
END_OF_TEXT

f=$docs/m4/m4.links
sed -n \
    -e 's/^\$1, \(DB_[^,]*\).*/\1/p' \
    -e d < $f |
while read name; do
	if `egrep -w "$name" $p > /dev/null`; then
		:
	else
		echo "$f: $name is missing from $p"
		exitv=1
	fi
done

cat <<END_OF_TEXT
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Check that m4.links has everything listed in pubdef.in.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
END_OF_TEXT

f=$docs/m4/m4.links
sed '/^#/d' $p |
while read name isdoc isinc isjava; do
	if `egrep -w "^.1, $name" $f > /dev/null`; then
		[ "X$isdoc" != "XD" ] && {
			echo "$name should not appear in $f"
			exitv=1
		}
	else
		[ "X$isdoc" = "XD" ] && {
			echo "$name does not appear in $f"
			exitv=1;
		}
	fi
done

cat <<END_OF_TEXT
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Check that pubdef.in has everything listed in db.in.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
END_OF_TEXT

f=$d/dbinc/db.in
sed -n \
    -e 's/^#define[	 ]*\(DB_[A-Z_0-9][A-Z_0-9]*\).*/\1/p' \
    -e 's/^[	 ]*\(DB_[A-Z_]*\)=[0-9].*/\1/p' \
    -e d < $f |
while read name; do
	if `egrep -w "$name" $p > /dev/null`; then
		:
	else
		echo "$f: $name is missing from $p"
		exitv=1
	fi
done

cat <<END_OF_TEXT
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Check that db.in has everything listed in pubdef.in.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
END_OF_TEXT

f=$d/dbinc/db.in
sed '/^#/d' $p |
while read name isdoc isinc isjava; do
	if `egrep -w "#define[	 ]$name|[	 ][	 ]*$name=[0-9][0-9]*" \
	    $f > /dev/null`; then
		[ "X$isinc" != "XI" ] && {
			echo "$name should not appear in $f"
			exitv=1
		}
	else
		[ "X$isinc" = "XI" ] && {
			echo "$name does not appear in $f"
			exitv=1
		}
	fi
done

cat <<END_OF_TEXT
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Check that pubdef.in has everything listed in DbConstants.java.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
END_OF_TEXT

f=$d/java/src/com/sleepycat/db/release/DbConstants.java
sed -n -e 's/.*static final int[	 ]*\([^ 	]*\).*/\1/p' < $f |
while read name; do
	if `egrep -w "$name" $p > /dev/null`; then
		:
	else
		echo "$f: $name is missing from $p"
		exitv=1
	fi
done

cat <<END_OF_TEXT
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Check that DbConstants.java has everything listed in pubdef.in.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
END_OF_TEXT

f=$d/java/src/com/sleepycat/db/release/DbConstants.java
sed '/^#/d' $p |
while read name isdoc isinc isjava; do
	if `egrep -w "static final int[	 ]$name =" $f > /dev/null`; then
		[ "X$isjava" != "XJ" ] && {
			echo "$name should not appear in $f"
			exitv=1
		}
	else
		[ "X$isjava" = "XJ" ] && {
			echo "$name does not appear in $f"
			exitv=1
		}
	fi
done

cat <<END_OF_TEXT
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Check that pubdef.in has everything listed in Db.java.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
END_OF_TEXT

f=$d/java/src/com/sleepycat/db/Db.java
sed -n -e 's/.*static final int[	 ]*\([^ 	;]*\).*/\1/p' < $f |
while read name; do
	if `egrep -w "$name" $p > /dev/null`; then
		:
	else
		echo "$f: $name is missing from $p"
		exitv=1;
	fi
done
sed -n -e 's/^[	 ]*\([^	 ]*\) = DbConstants\..*/\1/p' < $f |
while read name; do
	if `egrep -w "$name" $p > /dev/null`; then
		:
	else
		echo "$f: $name is missing from $p"
		exitv=1
	fi
done

cat <<END_OF_TEXT
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Check that Db.java has all of the Java case values listed in pubdef.in.
Any C entries should appear assigned to an initialization value.
Any J entries should appear assigned to the DbConstants value.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
END_OF_TEXT

f=$d/java/src/com/sleepycat/db/Db.java
sed '/^#/d' $p |
while read name isdoc isinc isjava; do
	case "$isjava" in
	C)
		if `egrep \
		    "public final static int[	 ]$name = [0-9-]*;" \
		    $f > /dev/null`; then
			:
		else
			echo "SFI (C type): $name does not appear in $f"
			exitv=1
		fi;;
	J)
		if `egrep \
		    "public final static int[	 ]$name;" $f > /dev/null`; then
			:
		else
			echo "SFI (J type): $name does not appear in $f"
			exitv=1
		fi
		if `egrep \
		    "$name = DbConstants.$name;" $f > /dev/null`; then
			:
		else
			echo "DbConstants: $name does not appear in $f"
			exitv=1
		fi;;
	\*)
		;;
	*)
		echo "Unknown isjava field: $isjava"
		exit 1;;
	esac
done

exit $exitv