1 |
tony |
315 |
#!/bin/sh |
2 |
|
|
|
3 |
tony |
323 |
usage() |
4 |
|
|
{ |
5 |
|
|
echo "runtest.sh [-L <lazarus root directory> ] -f <fbintf package directory> [-p <SYSDBA password] [-t <testid>]" |
6 |
|
|
} |
7 |
|
|
|
8 |
|
|
cd `dirname $0` |
9 |
|
|
|
10 |
tony |
315 |
#Test suite Configuration parameters |
11 |
|
|
#These may be modified if needed to suite local requirements |
12 |
|
|
|
13 |
|
|
TESTOUTDIR=/tmp/ibx-testsuite |
14 |
|
|
USERNAME=SYSDBA |
15 |
|
|
PASSWORD=masterkey |
16 |
tony |
323 |
EMPLOYEEDB=${SYSDBAPWD:-employee} |
17 |
tony |
315 |
NEWDBNAME=$TESTOUTDIR/testsuite1.fdb |
18 |
|
|
NEWDBNAME2=$TESTOUTDIR/testsuite2.fdb |
19 |
|
|
BAKFILE=$TESTOUTDIR/testsuite.gbk |
20 |
|
|
LOGFILE=testout.`date +%N`.log |
21 |
tony |
323 |
LAZARUS=$HOME/lazarus |
22 |
tony |
315 |
|
23 |
|
|
if [ -d "../fbintf" ]; then |
24 |
|
|
export FBINTF="../fbintf" |
25 |
|
|
elif [ -d "../../fbintf" ]; then |
26 |
|
|
export FBINTF="../../fbintf" |
27 |
|
|
else |
28 |
|
|
echo "Error: unable to locate Pascal Firebird Interface API" |
29 |
|
|
exit 2 |
30 |
|
|
fi |
31 |
tony |
323 |
#parse command line |
32 |
tony |
315 |
|
33 |
tony |
323 |
TEMP=`getopt hL:f:p:t: "$@"` |
34 |
|
|
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi |
35 |
|
|
|
36 |
|
|
eval set -- "$TEMP" |
37 |
|
|
|
38 |
|
|
while true ; do |
39 |
|
|
case "$1" in |
40 |
|
|
-h) usage; exit 1;; |
41 |
|
|
|
42 |
|
|
-t) TEST="-t $2"; shift 2;; |
43 |
|
|
|
44 |
|
|
-L) LAZARUS="$2"; shift 2;; |
45 |
|
|
|
46 |
|
|
-f) FBINTF="$2"; shift 2;; |
47 |
|
|
|
48 |
|
|
-p) PASSWORD="$2"; shift 2;; |
49 |
|
|
|
50 |
|
|
--) shift; break;; |
51 |
|
|
|
52 |
|
|
*) echo "Unrecognised argument $1"; usage; exit 1;; |
53 |
|
|
|
54 |
|
|
esac |
55 |
|
|
done |
56 |
|
|
|
57 |
|
|
|
58 |
tony |
315 |
INCDIR="$FBINTF/client/3.0/firebird $FBINTF/client/include" |
59 |
|
|
UNITDIR="$FBINTF $FBINTF/client $FBINTF/client/3.0/firebird $FBINTF/client/2.5 $FBINTF/client/3.0 $LAZARUS/components/lazutils" |
60 |
|
|
|
61 |
|
|
cd `dirname $0` |
62 |
|
|
mkdir -p $TESTOUTDIR |
63 |
|
|
chmod 777 $TESTOUTDIR |
64 |
|
|
export FPCDIR=/usr/lib/fpc/`fpc -iV` |
65 |
|
|
fpcmake |
66 |
|
|
make clean |
67 |
|
|
make INCDIR="$INCDIR" UNITDIR="$UNITDIR" |
68 |
|
|
if [ -x testsuite ]; then |
69 |
|
|
if [ -n "$FIREBIRD" ]; then |
70 |
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$FIREBIRD/lib |
71 |
|
|
fi |
72 |
|
|
echo "" |
73 |
|
|
echo "Starting Testsuite" |
74 |
|
|
echo "" |
75 |
tony |
323 |
./testsuite -u $USERNAME -p $PASSWORD -e $EMPLOYEEDB -n $NEWDBNAME -s $NEWDBNAME2 -b $BAKFILE -o $LOGFILE $TEST |
76 |
tony |
315 |
echo "Comparing results with reference log" |
77 |
|
|
echo "" |
78 |
|
|
if grep 'ODS Major Version = 11' $LOGFILE >/dev/null; then |
79 |
|
|
diff FB2reference.log $LOGFILE >diff.log |
80 |
|
|
elif grep 'ODS Major Version = 12' $LOGFILE >/dev/null; then |
81 |
|
|
diff FB3reference.log $LOGFILE >diff.log |
82 |
|
|
else |
83 |
|
|
diff FB4reference.log $LOGFILE >diff.log |
84 |
|
|
fi |
85 |
|
|
# cat diff.log |
86 |
|
|
echo "`cat diff.log|wc -l` lines in diff" |
87 |
|
|
else |
88 |
|
|
echo "Unable to run test suite" |
89 |
|
|
fi |
90 |
|
|
echo "Log File is $LOGFILE" |
91 |
|
|
rm -r testunits |
92 |
|
|
rm testsuite |
93 |
|
|
exit 0 |
94 |
|
|
|