4 # Work out where everything is
6 # Binary should be in current directory
8 echo "** onak binary doesn't exist, cannot run test suite" >&2
13 # Tests live in the t/ dir underneath where this script is
14 TESTSDIR=$(dirname $(readlink -f "$0"))/t
16 # We create a temporary directory to work in
17 WORKDIR=$(mktemp -d -t onak-test.XXXXXXXX)
23 export BUILDDIR TESTSDIR WORKDIR
25 echo "BUILDDIR: ${BUILDDIR}"
26 echo "TESTSDIR: ${TESTSDIR}"
27 echo "WORKDIR : ${WORKDIR}"
32 for t in libkeydb_*.so; do
33 backend=${t##libkeydb_}
34 backend=${backend%%.so}
35 if [ "`echo ${TESTSDIR}/$backend-*`" != "${TESTSDIR}/$backend-*" ]; then
36 echo "* testing $backend backend [conf]"
37 (sed -e "s;BUILDDIR;${BUILDDIR};" -e "s;WORKDIR;${WORKDIR};" \
38 ${TESTSDIR}/test-in.conf ; \
39 echo db_backend $backend) > ${WORKDIR}/test.conf
40 for t in ${TESTSDIR}/$backend-*.t ${TESTSDIR}/all-*.t; do
41 total=`expr $total + 1`
43 if ! $t ${WORKDIR}/test.conf $backend; then
44 echo "test $t failed" >&2
49 rm ${WORKDIR}/test.conf
52 if [ "`echo ${TESTSDIR}/$backend-*`" != "${TESTSDIR}/$backend-*" ]; then
53 echo "* testing $backend backend [ini]"
54 sed -e "s;BUILDDIR;${BUILDDIR};" -e "s;WORKDIR;${WORKDIR};" \
55 -e "s;DB;${backend};" \
56 ${TESTSDIR}/test-in.ini > ${WORKDIR}/test.ini
57 for t in ${TESTSDIR}/$backend-*.t ${TESTSDIR}/all-*.t; do
58 total=`expr $total + 1`
60 if ! $t ${WORKDIR}/test.ini $backend; then
61 echo "test $t failed" >&2
66 rm ${WORKDIR}/test.ini
70 if [ "$fail" -gt 0 ]; then
71 echo "** failed $fail/$total tests" >&2
74 echo "** all tests succeeded ($total)"