]> the.earth.li Git - onak.git/blob - runtests
Fix compilation with later versions of Nettle
[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 keydb/libkeydb_*.so; do
33         backend=${t##keydb/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                 touch ${WORKDIR}/blacklist
41                 for t in ${TESTSDIR}/$backend-*.t ${TESTSDIR}/all-*.t; do
42                         total=`expr $total + 1`
43                         mkdir ${WORKDIR}/db/
44                         if ! $t ${WORKDIR}/test.ini $backend; then
45                                 echo "test $t failed" >&2
46                                 fail=`expr $fail + 1`
47                         fi
48                         rm -rf ${WORKDIR}/db/
49                 done
50                 rm ${WORKDIR}/test.ini
51         fi
52 done
53
54 if [ "$fail" -gt 0 ]; then
55         echo "** failed $fail/$total tests" >&2
56         exit 1
57 else
58         echo "** all tests succeeded ($total)"
59 fi