1 |
#!/bin/sh
|
2 |
usage()
|
3 |
{
|
4 |
echo "Run UDR tests"
|
5 |
echo "dotest.sh [-3] [-4] "
|
6 |
}
|
7 |
|
8 |
BUILD=
|
9 |
#Parse Parameters
|
10 |
TEMP=`getopt h34db:f: "$@"`
|
11 |
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
|
12 |
|
13 |
eval set -- "$TEMP"
|
14 |
|
15 |
while true ; do
|
16 |
case "$1" in
|
17 |
-h) usage; exit 1;;
|
18 |
|
19 |
\-3) FB="3.0.5"; shift 1;;
|
20 |
|
21 |
\-4) FB="4.0.1"; shift 1;;
|
22 |
|
23 |
-d) FB="dev"; shift 1;;
|
24 |
|
25 |
-f) FB=$2; shift 2;;
|
26 |
|
27 |
--) shift; break;;
|
28 |
|
29 |
*) echo "Unrecognised argument $1"; usage; exit 1;;
|
30 |
|
31 |
esac
|
32 |
done
|
33 |
|
34 |
export FIREBIRD=/opt/firebird$FB
|
35 |
echo "FIREBIRD=$FIREBIRD"
|
36 |
export LD_LIBRARY_PATH=$FIREBIRD/lib
|
37 |
ISQL=$FIREBIRD/bin/isql
|
38 |
if [ ! -x $ISQL ]; then
|
39 |
echo "Unable to find isql utility"
|
40 |
exit 1
|
41 |
fi
|
42 |
|
43 |
RUNISQL="$ISQL -user SYSDBA -pass masterkey localhost:employee"
|
44 |
|
45 |
if [ ! -d "$FIREBIRD" ]; then
|
46 |
echo "$FIREBIRD not found"
|
47 |
else
|
48 |
rm -r testunits
|
49 |
fpcmake
|
50 |
make
|
51 |
if [ ! -f libfbudrtests.so ]; then
|
52 |
echo "Compilation failed"
|
53 |
exit 1
|
54 |
fi
|
55 |
cp libfbudrtests.so $FIREBIRD/plugins/udr
|
56 |
sudo /opt/stopfb
|
57 |
sudo /opt/startfb.sh
|
58 |
|
59 |
echo "Running UDR Lib Testsuite" >testout.log
|
60 |
|
61 |
echo "Adding SQL Definitions"
|
62 |
$RUNISQL < AddDefs.sql
|
63 |
for FN in `ls Test*.sql`; do
|
64 |
echo "Running `basename -s .sql $FN`"
|
65 |
echo "------------------------" >>testout.log
|
66 |
echo "Running `basename -s .sql $FN`" >>testout.log
|
67 |
echo "------------------------" >>testout.log
|
68 |
sed "s|\`pwd\`|`pwd`|" $FN| $RUNISQL >>testout.log 2>&1
|
69 |
done
|
70 |
echo "Dropping definitions"
|
71 |
$RUNISQL < dropdefs.sql
|
72 |
|
73 |
|
74 |
echo "Tests Completed"
|
75 |
echo "UDR Log Contents" >>testout.log
|
76 |
echo "----------------" >>testout.log
|
77 |
cat $FIREBIRD/fbudrtests.log |sed 's|[0-9]\+-[0-9]\+-[0-9]\+ [0-9]\+:[0-9]\+:[0-9]\+\.[0-9]\+|dd-mm-yy hh:mm:ss.zzzz|' >>testout.log
|
78 |
if [ -f Reference.log ] ; then
|
79 |
echo "Diff output is"
|
80 |
diff Reference.log testout.log
|
81 |
fi
|
82 |
fi
|