summaryrefslogtreecommitdiff
path: root/db-4.8.30/test/scr021/chk.flags
blob: 89f669fae193730823f42cfffdedc962a5b5d053 (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
#!/bin/sh -
#
# $Id$
#
# Check flag name-spaces.

d=../..
t1=__1
t2=__2

if cc -g -Wall -I.. t.c -o t; then
	:
else
	echo "FAIL: unable to compile test program t.c"
	exit 1
fi

if ./t $d/*/*.[ch] $d/*/*.in > $t1; then
	:
else
	echo "FAIL: test program failed"
	exit 1
fi

echo 'Checking "dbenv" variables with flags other than DB_ENV_XXX'
grep 'dbenv,' $t1 |
sed -e '/DB_ENV_/d' \
    -e '/env_method.c.*, mapped_flags*)/d' \
    -e '/env_region.c.*, flags_orig*)/d' \
    > $t2
[ -s $t2 ] && {
	cat $t2
	exit 1
}

echo 'Checking DB_ENV_XXX flags with variables other than "dbenv"'
grep 'DB_ENV_' $t1 |
sed -e '/dbenv,/d' \
    -e '/(dbenv),/d' \
    > $t2
[ -s $t2 ] && {
	cat $t2
	exit 1
}

echo 'Checking "env" variables with flags other than ENV_XXX'
grep '[^b]env,' $t1 |
sed -e '/[^B]ENV_/d' \
    -e '/env_method.c.*, mapped_flags*)/d' \
    > $t2
[ -s $t2 ] && {
	cat $t2
	exit 1
}

echo 'Checking ENV_XXX flags with variables other than "env"'
grep '[^A-Z_]ENV_' $t1 |
sed -e '/[^b]env,/d' \
    -e '/(env),/d' \
    > $t2
[ -s $t2 ] && {
	cat $t2
	exit 1
}

echo 'Checking dbenv "verbose" field with flags other than DB_VERB_XXX'
grep -- 'dbenv->verbose,' $t1 |
sed -e '/DB_VERB_/d' \
    -e '/env_method.c.*, which)/d' \
    > $t2
[ -s $t2 ] && {
	cat $t2
	exit 1
}

echo 'Checking DB_VER_XXX flags with other than dbenv "verbose" field'
grep -- 'DB_VERB_' $t1 |
sed -e '/dbenv->verbose,/d' \
    > $t2
[ -s $t2 ] && {
	cat $t2
	exit 1
}

echo 'Checking "db" variables with flags other than DB_AM_XXX'
cp $t1 /tmp/_f
grep 'dbp,' $t1 |
sed -e '/DB_AM_/d' \
    -e '/dbp, mapped_flag)/d' \
    > $t2
[ -s $t2 ] && {
	cat $t2
	exit 1
}

echo 'Checking DB_AM_XXX flags with variables other than "db"'
grep 'DB_AM_' $t1 |
sed \
    -e '/(&db,/d' \
    -e '/(db,/d' \
    -e '/_method.c:.*outflagsp,/d' \
    -e '/partition.c:.*pdbp,/d' \
    -e '/rep_backup.c:.*->flags,/d' \
    -e /'rep_backup.c:.*->db_flags,/d' \
    -e '/db.c:.*save_flags,/d' \
    -e '/((*[	 ]*db_rep->rep_db)*,/d' \
    -e '/((*[	 ]*dbc)*->dbp,/d' \
    -e '/((*[	 ]*dbc_arg->dbp)*,/d' \
    -e '/((*[	 ]*dbp)*,/d' \
    -e '/((*[	 ]*dbp)*->s_primary,/d' \
    -e '/((D),/d' \
    -e '/((sdbp),/d' \
    -e '/(fdbp,/d' \
    -e '/(file_dbp,/d' \
    -e '/(ldbp,/d' \
    -e '/(msgfp->db_flags,/d' \
    -e '/(mdbp,/d' \
    -e '/(pdbp,/d' \
    -e '/(pginfo, /d' \
    -e '/(rfp->db_flags,/d' \
    -e '/(sdbp,/d' \
    -e '/(subdbp,/d' \
    -e '/fop_util.c:.*(t2dbp,/d' \
    -e '/fop_util.c:.*(tmpdbp,/d' \
    > $t2
[ -s $t2 ] && {
	cat $t2
	exit 1
}

echo 'Checking "dbc" variables flags with flags other than DBC_XXX'
echo Checking DBC flags...
cat $t1 |
grep 'dbc,' |
sed -e '/DBC_/d' \
    -e '/db_cam.c:.*tmp_read_locking)/d' 
    > $t2
[ -s $t2 ] && {
	cat $t2
	exit 1
}

echo 'Checking DBC_XXX flags with variables other than "dbc"'
grep 'DBC_' $t1 |
sed -e '/((*dbc)*,/d' \
    -e '/(dbc_arg,/d' \
    -e '/(dbc_c,/d' \
    -e '/(dbc_n,/d' \
    -e '/(dbc_orig,/d' \
    -e '/(opd,/d' \
    -e '/(pdbc,/d' \
    -e '/[(*]put_state[p]*,/d' \
    -e '/(sdbc,/d' \
    -e '/partition.c:.*_dbc,/d' \
    -e '/partition.c:.*_cursor,/d'
    > $t2
[ -s $t2 ] && {
	cat $t2
	exit 1
}

echo Checking for bad use of macros...
egrep 'case .*F_SET\(|case .*F_CLR\(' $d/*/*.c > $t1
egrep 'for .*F_SET\(|for .*F_CLR\(' $d/*/*.c >> $t1
egrep 'if .*F_SET\(|if .*F_CLR\(' $d/*/*.c >> $t1
egrep 'switch .*F_SET\(|switch .*F_CLR\(' $d/*/*.c >> $t1
egrep 'while .*F_SET\(|while .*F_CLR\(' $d/*/*.c >> $t1
[ -s $t1 ] && {
	echo 'if statement followed by non-test macro'
	cat $t1
	exit 1
}

exit 0