5
# Check to make sure that regression tests for Java run.
7
TEST_JAVA_SRCDIR=../test/scr016 # must be a relative directory
11
# CLASSPATH is used by javac and java.
12
# We use CLASSPATH rather than the -classpath command line option
13
# because the latter behaves differently from JDK1.1 and JDK1.2
14
export CLASSPATH="./classes:../db.jar"
15
export LD_LIBRARY_PATH="../.libs"
18
# All paths must be relative to a subdirectory of the build directory
19
LIBS="-L.. -ldb -ldb_cxx"
20
CXXFLAGS="-I.. -I../../dbinc"
22
# Test must be run from a local build directory, not from a test
25
[ -f db_config.h ] || {
26
echo 'FAIL: chk.javatests must be run from a local build directory.'
29
[ -d ../docs_src ] || {
30
echo 'FAIL: chk.javatests must be run from a local build directory.'
33
version=`sed -e 's/.* \([0-9]*\.[0-9]*\)\..*/\1/' -e q ../README `
34
[ -f libdb_java-$version.la ] || make libdb_java-$version.la || {
35
echo "FAIL: unable to build libdb_java-$version.la"
38
[ -f db.jar ] || make db.jar || {
39
echo 'FAIL: unable to build db.jar'
42
testnames=`cd $TEST_JAVA_SRCDIR; ls *.java | sed -e 's/\.java$//'`
44
for testname in $testnames; do
45
if grep -x $testname $TEST_JAVA_SRCDIR/ignore > /dev/null; then
46
echo " **** java test $testname ignored"
50
echo " ==== java test $testname"
51
rm -rf TESTJAVA; mkdir -p TESTJAVA/classes
53
testprefix=../$TEST_JAVA_SRCDIR/$testname
54
${JAVAC} -d ./classes $testprefix.java ../$TEST_JAVA_SRCDIR/TestUtil.java > ../$testname.compileout 2>&1 || {
56
echo "FAIL: compilation of $testname failed, see ../$testname.compileout"
59
rm -f ../$testname.compileout
60
infile=$testprefix.testin
61
[ -f $infile ] || infile=/dev/null
62
goodoutfile=$testprefix.testout
63
[ -f $goodoutfile ] || goodoutfile=/dev/null
64
gooderrfile=$testprefix.testerr
65
[ -f $gooderrfile ] || gooderrfile=/dev/null
66
${JAVA} com.sleepycat.test.$testname <$infile >../$testname.out 2>../$testname.err
67
cmp ../$testname.out $goodoutfile > /dev/null || {
68
echo "FAIL: $testname output differs: see ../$testname.out, $goodoutfile"
71
cmp ../$testname.err $gooderrfile > /dev/null || {
72
echo "FAIL: $testname error differs: see ../$testname.err, $gooderrfile"
76
rm -f $testname.err $testname.out