]> the.earth.li Git - onak.git/blob - runtests
Deprecate the .conf configuration file format
[onak.git] / runtests
1 #!/bin/sh
2 set -e
3
4 # Work out where everything is
5
6 # Binary should be in current directory
7 if [ ! -e onak ]; then
8         echo "** onak binary doesn't exist, cannot run test suite" >&2
9         exit 1
10 fi
11 BUILDDIR=$PWD
12
13 # Tests live in the t/ dir underneath where this script is
14 TESTSDIR=$(dirname $(readlink -f "$0"))/t
15
16 # We create a temporary directory to work in
17 WORKDIR=$(mktemp -d -t onak-test.XXXXXXXX)
18 trap cleanup exit
19 cleanup () {
20         rm -rf "$WORKDIR"
21 }
22
23 export BUILDDIR TESTSDIR WORKDIR
24
25 echo "BUILDDIR: ${BUILDDIR}"
26 echo "TESTSDIR: ${TESTSDIR}"
27 echo "WORKDIR : ${WORKDIR}"
28
29 fail=0
30 total=0
31
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"
37                 sed -e "s;BUILDDIR;${BUILDDIR};" -e "s;WORKDIR;${WORKDIR};" \
38                         -e "s;DB;${backend};" \
39                         ${TESTSDIR}/test-in.ini > ${WORKDIR}/test.ini
40                 for t in ${TESTSDIR}/$backend-*.t ${TESTSDIR}/all-*.t; do
41                         total=`expr $total + 1`
42                         mkdir ${WORKDIR}/db/
43                         if ! $t ${WORKDIR}/test.ini $backend; then
44                                 echo "test $t failed" >&2
45                                 fail=`expr $fail + 1`
46                         fi
47                         rm -rf ${WORKDIR}/db/
48                 done
49                 rm ${WORKDIR}/test.ini
50         fi
51 done
52
53 if [ "$fail" -gt 0 ]; then
54         echo "** failed $fail/$total tests" >&2
55         exit 1
56 else
57         echo "** all tests succeeded ($total)"
58 fi