File: chk.cxxtests

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 (71 lines) | stat: -rw-r--r-- 2,020 bytes parent folder | download | duplicates (12)
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
#!/bin/sh -
#
# $Id$
#
# Check to make sure that regression tests for C++ run.

TEST_CXX_SRCDIR=../test/cxx  # must be a relative directory

# All paths must be relative to a subdirectory of the build directory
LIBS="-L.. -ldb_cxx"
CXXFLAGS="-I.. -I../../src/dbinc"

[ `uname` = "Linux" ] && LIBS="$LIBS -lpthread"

# Test must be run from a local build directory, not from a test
# directory.
[ -f db_config.h ] || {
	echo 'FAIL: chk.cxxtests must be run from a local build directory.'
	exit 1
}
[ -d ../src ] || {
	echo 'FAIL: chk.cxxtests must be run from a local build directory.'
	exit 1
}
[ -f libdb.a ] || make libdb.a || {
	echo 'FAIL: unable to build libdb.a'
	exit 1
}
[ -f libdb_cxx.a ] || make libdb_cxx.a || {
	echo 'FAIL: unable to build libdb_cxx.a'
	exit 1
}
CXX=`sed -e '/^CXX=/!d' -e 's/^CXX=//' -e 's/.*mode=compile *//' Makefile`
echo "  ====== cxx tests using $CXX"
testnames=`cd $TEST_CXX_SRCDIR; ls *.cpp | sed -e 's/\.cpp$//'`

for testname in $testnames; do
	if grep -x $testname $TEST_CXX_SRCDIR/ignore > /dev/null; then
		echo "    **** cxx test $testname ignored"
		continue
	fi

	echo "    ==== cxx test $testname"
	rm -rf TESTCXX; mkdir TESTCXX
	cd ./TESTCXX
	testprefix=../$TEST_CXX_SRCDIR/$testname

	${CXX} ${CXXFLAGS} -o $testname $testprefix.cpp ${LIBS} > $testname.compileout 2>&1 || {
		echo "FAIL: compilation of $testname failed, see TESTCXX/$testname.compileout"
		exit 1
	}
	rm -f $testname.compileout
	infile=$testprefix.testin
	[ -f $infile ] || infile=/dev/null
	goodoutfile=$testprefix.testout
	[ -f $goodoutfile ] || goodoutfile=/dev/null
	gooderrfile=$testprefix.testerr
	[ -f $gooderrfile ] || gooderrfile=/dev/null
	./$testname <$infile > $testname.out 2> $testname.err
	cmp $testname.out $goodoutfile > /dev/null || {
		echo "FAIL: $testname output differs: see $testname.out, $goodoutfile"
		exit 1
	}
	cmp $testname.err $gooderrfile > /dev/null || {
		echo "FAIL: $testname error differs: see $testname.err, $gooderrfile"
		exit 1
	}
	cd ..
done
rm -rf TESTCXX
exit 0