File: chk.ctests

package info (click to toggle)
db5.3 5.3.28%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 158,500 kB
  • sloc: ansic: 448,411; java: 111,824; tcl: 80,544; sh: 44,264; cs: 33,697; cpp: 21,604; perl: 14,557; xml: 10,799; makefile: 4,077; javascript: 1,998; yacc: 1,003; awk: 965; sql: 801; erlang: 342; python: 216; php: 24; asm: 14
file content (70 lines) | stat: -rw-r--r-- 1,312 bytes parent folder | download | duplicates (11)
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
#!/bin/sh -
#
# $Id$
#
# Check to make sure we can run DB 1.85 code.
d=../../
b=./tmp_build/
s=$d/src

mkdir -p $b

[ -f $d/LICENSE ] || {
	echo 'FAIL: Test must be run from scr directory.'
	exit 1
}

nocleanup=0
while [ $# -gt 0 ]
do 
	case "$1" in
	-nocleanup)
		nocleanup=1; shift;;
	*)
		echo "Unrecognized option: $1, ignoring"
		shift;;
	esac
done

opts="--enable-compat185 --disable-shared"
echo "Building DB library, this can take a while."
(cd $b && ../../../dist/configure $opts > /dev/null && make libdb.a > /dev/null) || {
	echo 'FAIL: unable to build libdb.a'
	exit 1
}

# if compiling on linux blade server, add -pthread on cc
CINC="-I$b -I$s -I$s/dbinc"
[ `uname` = "Linux" ] && CINC="$CINC -pthread"

for i in `ls test_*.c`; do

	echo "=== Running $i ===" | tee -a compile.out
	if cc -g -Wall $CINC $i $b/libdb.a -o t >> compile.out 2>&1; then
		:
	else
		echo "FAIL: unable to compile test program $i"
		exit 1
	fi

	if ./t; then
		:
	else
		echo "FAIL: test program failed"
		exit 1
	fi
	rm -f ./t
done

# Cleanup.
# TODO: The test should be consistent, so this cleanup isn't so haphazard.
#       Alternatively we could build each test in a sub-dir and cleanup after
#       individual runs.
rm a.db __db.* output
rm -rf ./TESTDIR

if [ nocleanup = 0 ]; then
	rm -rf compile.out $b
fi

exit 0