File: runtests

package info (click to toggle)
onak 0.6.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,276 kB
  • sloc: ansic: 13,822; sh: 398; perl: 301; sql: 21; makefile: 19
file content (59 lines) | stat: -rwxr-xr-x 1,361 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
set -e

# 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

# 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 keydb/libkeydb_*.so; do
	backend=${t##keydb/libkeydb_}
	backend=${backend%%.so}
	if [ "`echo ${TESTSDIR}/$backend-*`" != "${TESTSDIR}/$backend-*" ]; then
		echo "* testing $backend backend"
		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 ${WORKDIR}/db/
			if ! $t ${WORKDIR}/test.ini $backend; then
				echo "test $t failed" >&2
				fail=`expr $fail + 1`
			fi
			rm -rf ${WORKDIR}/db/
		done
		rm ${WORKDIR}/test.ini
	fi
done

if [ "$fail" -gt 0 ]; then
	echo "** failed $fail/$total tests" >&2
	exit 1
else
	echo "** all tests succeeded ($total)"
fi