1#!/bin/sh -
2#
3# $Id$
4#
5# Run the collections/bind test suite.
6
7# NOTES:
8# This test requires one JAR not included with the Berkeley DB
9# distribution:  JUnit (junit.jar) I've been using the 8/31/2002 version
10# of JUnit.  You can download this JAR from http://jakarta.apache.org/
11#
12# JUNIT_JAR=/Users/gburd/Unix/opt/junit/junit.jar
13
14[ "x$JUNIT_JAR" = "x" ] && {
15	echo 'FAIL: unset environment variable JUNIT_JAR for junit.jar.'
16	exit 1
17}
18
19[ -f $JUNIT_JAR ] || {
20	echo 'FAIL: JUNIT_JAR not a valid path to the junit.jar.'
21	exit 1
22}
23
24case `uname` in
25	*CYGWIN*)
26	d=../../build_windows/Win32/Debug
27	DB_LIB_DIR="$d"
28	REQUIRED_JARS="`cygpath -m $JUNIT_JAR`"
29	CP_SEP=";"
30	PATH="../../build_windows/Win32/Debug:$PATH"
31	export PATH;;
32	*)
33	d=../../build_unix
34	REQUIRED_JARS=$JUNIT_JAR
35	DB_LIB_DIR="$d/.libs"
36	CP_SEP=":"
37	;;
38esac
39TESTDESTDIR=${TESTDESTDIR:-testdestdir}
40DB_JAR="$d/db.jar"
41export DB_JAR
42export REQUIRED_JARS
43export CP_SEP
44
45# Build the tests.
46
47make clean
48
49[ -f ./dbtest.jar ] || (make dbtest.jar) || {
50	echo 'FAIL: unable to find or build dbtest.jar'
51	exit 1
52}
53
54# Perform initialization needed before StoredClassCatalogTest is run in
55# the tests below.  The testserial directory must be first in the classpath.
56
57c="com.sleepycat.collections.test.serial.StoredClassCatalogTestInit"
58echo "Running: $c"
59if java -Djava.library.path=$DB_LIB_DIR -Dtestdestdir=$TESTDESTDIR \
60    -cp "testserial${CP_SEP}$REQUIRED_JARS${CP_SEP}$DB_JAR${CP_SEP}./dbtest.jar" $c ; then
61        :
62else
63    echo "FAIL: test program failed"
64    exit 1
65fi
66
67# Run the tests.
68
69for f in `find classes -name "*Test.class"`; do
70    c=`echo "$f" | sed -e 's/classes\///' -e 's/\.class//' -e 's/\//./g'`
71    echo "Running: $c"
72    if java -Djava.library.path=$DB_LIB_DIR -Dtestdestdir=$TESTDESTDIR\
73	    -cp $REQUIRED_JARS${CP_SEP}$DB_JAR${CP_SEP}./dbtest.jar $c ; then
74            :
75    else
76        echo "FAIL: test program failed"
77        exit 1
78    fi
79done
80
81exit 0
82