X-Git-Url: http://the.earth.li/gitweb/?p=onak.git;a=blobdiff_plain;f=runtests;h=3a74d2456e28d1d40b69a93a595a47d6c0c823a9;hp=968cfc03fad5696d6f928f7bedf5809604fd017d;hb=743957a08f068529d3add3e8485678b4e5034195;hpb=2682946a339e46d392eebcb7597ef2073720df0d diff --git a/runtests b/runtests index 968cfc0..3a74d24 100755 --- a/runtests +++ b/runtests @@ -1,35 +1,53 @@ #!/bin/sh set -e -fail=0 -total=0 +# Work out where everything is +# Binary should be in current directory if [ ! -e onak ]; then echo "** onak binary doesn't exist, cannot run test suite" >&2 exit 1 fi +BUILDDIR=$PWD -if [ -e t/db/ ]; then - rm -rf t/db/ -fi +# Tests live in the t/ dir underneath where this script is +TESTSDIR=$(dirname $(readlink -f "$0"))/t + +# We create a temporary directory to work in +WORKDIR=$(mktemp -d -t onak-test.XXXXXXXX) +trap cleanup exit +cleanup () { + rm -rf "$WORKDIR" +} + +export BUILDDIR TESTSDIR WORKDIR + +echo "BUILDDIR: ${BUILDDIR}" +echo "TESTSDIR: ${TESTSDIR}" +echo "WORKDIR : ${WORKDIR}" + +fail=0 +total=0 -for t in libkeydb_*.so; do - backend=${t##libkeydb_} +for t in keydb/libkeydb_*.so; do + backend=${t##keydb/libkeydb_} backend=${backend%%.so} - if [ "`echo t/$backend-*`" != "t/$backend-*" ]; then + if [ "`echo ${TESTSDIR}/$backend-*`" != "${TESTSDIR}/$backend-*" ]; then echo "* testing $backend backend" - (sed -e "s;DIR;`pwd`;" t/test-in.conf ; \ - echo db_backend $backend) > t/test.conf - for t in t/$backend-*.t t/all-*.t; do + sed -e "s;BUILDDIR;${BUILDDIR};" -e "s;WORKDIR;${WORKDIR};" \ + -e "s;DB;${backend};" \ + ${TESTSDIR}/test-in.ini > ${WORKDIR}/test.ini + touch ${WORKDIR}/blacklist + for t in ${TESTSDIR}/$backend-*.t ${TESTSDIR}/all-*.t; do total=`expr $total + 1` - mkdir t/db/ - if ! $t $backend; then + mkdir ${WORKDIR}/db/ + if ! $t ${WORKDIR}/test.ini $backend; then echo "test $t failed" >&2 fail=`expr $fail + 1` fi - rm -rf t/db/ + rm -rf ${WORKDIR}/db/ done - rm t/test.conf + rm ${WORKDIR}/test.ini fi done @@ -37,5 +55,5 @@ if [ "$fail" -gt 0 ]; then echo "** failed $fail/$total tests" >&2 exit 1 else - echo "** all tests succeeded" + echo "** all tests succeeded ($total)" fi