5
# Check to make sure that regression tests for C++ run.
7
TEST_CXX_SRCDIR=../test/scr015 # must be a relative directory
9
# All paths must be relative to a subdirectory of the build directory
10
LIBS="-L.. -ldb -ldb_cxx"
11
CXXFLAGS="-I.. -I../../dbinc"
13
# Test must be run from a local build directory, not from a test
16
[ -f db_config.h ] || {
17
echo 'FAIL: chk.cxxtests must be run from a local build directory.'
20
[ -d ../docs_src ] || {
21
echo 'FAIL: chk.cxxtests must be run from a local build directory.'
24
[ -f libdb.a ] || make libdb.a || {
25
echo 'FAIL: unable to build libdb.a'
28
[ -f libdb_cxx.a ] || make libdb_cxx.a || {
29
echo 'FAIL: unable to build libdb_cxx.a'
32
CXX=`sed -e '/^CXX=/!d' -e 's/^CXX=//' -e 's/.*mode=compile *//' Makefile`
33
echo " ====== cxx tests using $CXX"
34
testnames=`cd $TEST_CXX_SRCDIR; ls *.cpp | sed -e 's/\.cpp$//'`
36
for testname in $testnames; do
37
if grep -x $testname $TEST_CXX_SRCDIR/ignore > /dev/null; then
38
echo " **** cxx test $testname ignored"
42
echo " ==== cxx test $testname"
43
rm -rf TESTCXX; mkdir TESTCXX
45
testprefix=../$TEST_CXX_SRCDIR/$testname
47
${CXX} ${CXXFLAGS} -o $testname $testprefix.cpp ${LIBS} > ../$testname.compileout 2>&1 || {
48
echo "FAIL: compilation of $testname failed, see ../$testname.compileout"
51
rm -f ../$testname.compileout
52
infile=$testprefix.testin
53
[ -f $infile ] || infile=/dev/null
54
goodoutfile=$testprefix.testout
55
[ -f $goodoutfile ] || goodoutfile=/dev/null
56
gooderrfile=$testprefix.testerr
57
[ -f $gooderrfile ] || gooderrfile=/dev/null
58
./$testname <$infile >../$testname.out 2>../$testname.err
59
cmp ../$testname.out $goodoutfile > /dev/null || {
60
echo "FAIL: $testname output differs: see ../$testname.out, $goodoutfile"
63
cmp ../$testname.err $gooderrfile > /dev/null || {
64
echo "FAIL: $testname error differs: see ../$testname.err, $gooderrfile"
68
rm -f $testname.err $testname.out