summaryrefslogtreecommitdiff
path: root/db-4.8.30/test/scr020/chk.inc
blob: d73e89866853612365083274d7204a3cfa87ada2 (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
#!/bin/sh -
#
# $Id$
#
# Check for inclusion of db_config.h after "const" or other includes.

d=../..

# Test must be run from the top-level directory, not from a test directory.
[ -f $d/LICENSE ] || {
	echo 'FAIL: cannot find source distribution directory.'
	exit 1
}

t1=__1
t2=__2

(cd $d && find . -name '*.[chys]' -o -name '*.cpp' |
    xargs egrep -l '#include.*db_config.h') | tee /tmp/o |
    sed -e '/dbdemo.c$/d' \
        -e '/db_java_wrap.c$/d' \
	-e '/ex_apprec.c$/d' > $t1

(for i in `cat $t1`; do
	egrep -w 'db_config.h|const' /dev/null $d/$i | head -1
done) > $t2

if egrep const $t2 > /dev/null; then
	echo 'FAIL: found const before include of db_config.h'
	egrep const $t2
	exit 1
fi

:> $t2
for i in `cat $t1`; do
	egrep -w '#include' /dev/null $d/$i | head -1 >> $t2
done

if egrep -v db_config.h $t2 > /dev/null; then
	echo 'FAIL: found includes before include of db_config.h'
	egrep -v db_config.h $t2
	exit 1
fi

exit 0