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 |
FB="4.0.1"
|
12 |
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
|
13 |
|
14 |
eval set -- "$TEMP"
|
15 |
|
16 |
while true ; do
|
17 |
case "$1" in
|
18 |
-h) usage; exit 1;;
|
19 |
|
20 |
\-3) FB="3.0.5"; shift 1;;
|
21 |
|
22 |
\-4) FB="4.0.1"; shift 1;;
|
23 |
|
24 |
-d) FB="master"; shift 1;;
|
25 |
|
26 |
-f) FB=$2; shift 2;;
|
27 |
|
28 |
--) shift; break;;
|
29 |
|
30 |
*) echo "Unrecognised argument $1"; usage; exit 1;;
|
31 |
|
32 |
esac
|
33 |
done
|
34 |
|
35 |
export FIREBIRD=/opt/firebird/$FB
|
36 |
echo "FIREBIRD=$FIREBIRD"
|
37 |
export LD_LIBRARY_PATH=$FIREBIRD/lib
|
38 |
ISQL=$FIREBIRD/bin/isql
|
39 |
if [ ! -x $ISQL ]; then
|
40 |
echo "Unable to find isql utility"
|
41 |
exit 1
|
42 |
fi
|
43 |
|
44 |
RUNISQL="$ISQL -user SYSDBA -pass masterkey localhost:employee"
|
45 |
TESTISQL="$ISQL -user TESTER -pass testing localhost:employee"
|
46 |
rm libfbudrtests.so
|
47 |
|
48 |
if [ ! -d "$FIREBIRD" ]; then
|
49 |
echo "$FIREBIRD not found"
|
50 |
else
|
51 |
rm -r testunits
|
52 |
fpcmake
|
53 |
make
|
54 |
if [ ! -f libfbudrtests.so ]; then
|
55 |
echo "Compilation failed"
|
56 |
exit 1
|
57 |
fi
|
58 |
cp libfbudrtests.so $FIREBIRD/plugins/udr
|
59 |
PID=`ps ax|grep $FB/bin/fbguard|grep -v grep|awk '{print $1;}'`
|
60 |
if [ -n "$PID" ]; then
|
61 |
sudo kill -TERM $PID
|
62 |
fi
|
63 |
sleep 1
|
64 |
echo "starting $FB/bin/fbguard"
|
65 |
sudo $FIREBIRD/bin/fbguard&
|
66 |
sleep 2
|
67 |
|
68 |
echo "Running UDR Lib Testsuite" >testout.log
|
69 |
|
70 |
echo "Adding SQL Definitions"
|
71 |
$RUNISQL < AddDefs.sql
|
72 |
for FN in `ls Test*.sql`; do
|
73 |
echo "Running `basename -s .sql $FN`"
|
74 |
echo "------------------------" >>testout.log
|
75 |
echo "Running `basename -s .sql $FN`" >>testout.log
|
76 |
echo "------------------------" >>testout.log
|
77 |
sed "s|\`pwd\`|`pwd`|" $FN| $RUNISQL 2>&1 |tee -a testout.log
|
78 |
echo "Repeat with USER=TESTER" >>testout.log
|
79 |
sed "s|\`pwd\`|`pwd`|" $FN| $TESTISQL 2>&1 |tee -a testout.log
|
80 |
done
|
81 |
echo "Dropping definitions"
|
82 |
$RUNISQL < dropdefs.sql
|
83 |
|
84 |
|
85 |
echo "Tests Completed"
|
86 |
echo "UDR Log Contents" >>testout.log
|
87 |
echo "----------------" >>testout.log
|
88 |
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
|
89 |
if [ -f Reference.log ] ; then
|
90 |
echo "Diff output is"
|
91 |
diff Reference.log testout.log
|
92 |
fi
|
93 |
fi
|