~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to libdb/test/scr016/testone

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh -
2
 
#       $Id$
3
 
#
4
 
# Run just one Java regression test, the single argument
5
 
# is the classname within this package.
6
 
 
7
 
error()
8
 
{
9
 
        echo '' >&2
10
 
        echo "Java regression error: $@" >&2
11
 
        echo '' >&2
12
 
        ecode=1
13
 
}
14
 
 
15
 
# compares the result against the good version,
16
 
# reports differences, and removes the result file
17
 
# if there are no differences.
18
 
#
19
 
compare_result()
20
 
{
21
 
        good="$1"
22
 
        latest="$2"
23
 
        if [ ! -e "$good" ]; then
24
 
                echo "Note: $good does not exist"
25
 
                return
26
 
        fi
27
 
        tmpout=/tmp/blddb$$.tmp
28
 
        diff "$good" "$latest" > $tmpout
29
 
        if [ -s $tmpout ]; then
30
 
                nbad=`grep '^[0-9]' $tmpout | wc -l`
31
 
                error "$good and $latest differ in $nbad places."
32
 
        else
33
 
                rm $latest
34
 
        fi
35
 
        rm -f $tmpout
36
 
}
37
 
 
38
 
ecode=0
39
 
stdinflag=n
40
 
JAVA=${JAVA:-java}
41
 
JAVAC=${JAVAC:-javac}
42
 
 
43
 
# classdir is relative to TESTDIR subdirectory
44
 
classdir=./classes
45
 
 
46
 
# CLASSPATH is used by javac and java.
47
 
# We use CLASSPATH rather than the -classpath command line option
48
 
# because the latter behaves differently from JDK1.1 and JDK1.2
49
 
export CLASSPATH="$classdir:$CLASSPATH"
50
 
 
51
 
# determine the prefix of the install tree
52
 
prefix=""
53
 
while :
54
 
do
55
 
        case "$1" in
56
 
        --prefix=* )
57
 
                prefix="`echo $1 | sed -e 's/--prefix=//'`"; shift
58
 
                export LD_LIBRARY_PATH="$prefix/lib:$LD_LIBRARY_PATH"
59
 
                export CLASSPATH="$prefix/lib/db.jar:$CLASSPATH"
60
 
                ;;
61
 
        --stdin )
62
 
                stdinflag=y; shift
63
 
                ;;
64
 
        * )
65
 
                break
66
 
                ;;
67
 
        esac
68
 
done
69
 
 
70
 
if [ "$#" = 0 ]; then
71
 
        echo 'Usage: testone [ --prefix=<dir> | --stdin ] TestName'
72
 
        exit 1
73
 
fi
74
 
name="$1"
75
 
 
76
 
# class must be public
77
 
if ! grep "public.*class.*$name" $name.java > /dev/null; then
78
 
        error "public class $name is not declared in file $name.java"
79
 
        exit 1
80
 
fi
81
 
 
82
 
# compile
83
 
rm -rf TESTDIR; mkdir TESTDIR
84
 
cd ./TESTDIR
85
 
mkdir -p $classdir
86
 
${JAVAC} -d $classdir ../$name.java ../TestUtil.java > ../$name.compileout 2>&1
87
 
if [ $? != 0 -o -s ../$name.compileout ]; then
88
 
        error "compilation of $name failed, see $name.compileout"
89
 
        exit 1
90
 
fi
91
 
rm -f ../$name.compileout
92
 
 
93
 
# find input and error file
94
 
infile=../$name.testin
95
 
if [ ! -f $infile ]; then
96
 
        infile=/dev/null
97
 
fi
98
 
 
99
 
# run and diff results
100
 
rm -rf TESTDIR
101
 
if [ "$stdinflag" = y ]
102
 
then
103
 
        ${JAVA} com.sleepycat.test.$name $TEST_ARGS          >../$name.out 2>../$name.err
104
 
else
105
 
        ${JAVA} com.sleepycat.test.$name $TEST_ARGS <$infile >../$name.out 2>../$name.err
106
 
fi
107
 
cd ..
108
 
 
109
 
testerr=$name.testerr
110
 
if [ ! -f $testerr ]; then
111
 
        testerr=/dev/null
112
 
fi
113
 
 
114
 
testout=$name.testout
115
 
if [ ! -f $testout ]; then
116
 
        testout=/dev/null
117
 
fi
118
 
 
119
 
compare_result $testout $name.out
120
 
compare_result $testerr $name.err
121
 
rm -rf TESTDIR
122
 
exit $ecode