adding test scripts
[csql.git] / test / cache / Gateway / test012an.ksh
blob9b51115787734e2d54cdfb249d4f982b54de0e76
1 #!/bin/ksh
3 # 12.csqlserver not running
4 # a)connect,select
5 # oncached table in mysql(should work), cached table (work), csql table (fail)
7 #Run this test only under csql/test or on this directory.
8 #Otherwise, it may fail
9 input=${PWD}/cache/Gateway/mysqlinputtest1.sql
10 REL_PATH=.
11 if [ -s "$input" ]
12 then
13 REL_PATH=${PWD}/cache/Gateway
15 rm -f /tmp/csql.conf
17 cp $REL_PATH/csql.conf /tmp/csql.conf
18 echo CSQL_SQL_SERVER=true >>/tmp/csql.conf
19 echo PORT=6022 >>/tmp/csql.conf
20 export CSQL_CONFIG_FILE=/tmp/csql.conf
22 echo DSN=$DSN >>$CSQL_CONFIG_FILE
23 DS="$DSN $DBUSER $PASSWORD"
24 rm -f /tmp/csql/csqlds.conf
25 touch /tmp/csql/csqlds.conf
26 $CSQL_INSTALL_ROOT/bin/csqlds -U $DBUSER -P $PASSWORD -D $DSN -N $TDB -a
27 if [ $? -ne 0 ]
28 then
29 exit 1;
32 if [ $DSN = "oracle" ]
33 then
34 isql $DS < $REL_PATH/orainputt1.oracle >/dev/null 2>&1
35 elif [ $DSN = "sybase" ]
36 then
37 isql $DS < $REL_PATH/sybaseinputtest1.sql >/dev/null 2>&1
38 elif [ $DSN = "db2" ]
39 then
40 isql $DS < $REL_PATH/db2inputtest1.sql >/dev/null 2>&1
41 else
42 isql $DS < $REL_PATH/mysqlinputtest1.sql >/dev/null 2>&1
45 if [ $? -ne 0 ]
46 then
47 echo "DSN is not set for target db"
48 exit 1
51 if [ $DSN = "oracle" ]
52 then
53 isql $DS < $REL_PATH/orainputt2.oracle >/dev/null 2>&1
54 elif [ $DSN = "sybase" ]
55 then
56 isql $DS < $REL_PATH/sybaseinputtest12.sql > /dev/null 2>&1
57 elif [ $DSN = "db2" ]
58 then
59 isql $DS < $REL_PATH/db2inputtest12.sql > /dev/null 2>&1
60 else
61 isql $DS < $REL_PATH/mysqlinputtest12.sql >/dev/null 2>&1
64 if [ $? -ne 0 ]
65 then
66 cp /tmp/csql.conf $CSQL_CONFIG_FILE
67 exit 1;
69 # edit /tmp/csql/csqltable.conf
70 rm -f /tmp/csql/csqltable.conf
71 touch /tmp/csql/csqltable.conf
72 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
73 pid=$!
74 sleep 5
76 $CSQL_INSTALL_ROOT/bin/cachetable -t t1 -d $DSN
77 if [ $? -ne 0 ]
78 then
79 kill -9 $pid
80 ipcrm -M 1199 -M 2277
81 kill `ps -el | grep csqlsqlserver | gawk -F" " '{ print $4 }'`
82 exit 3;
85 if [ $DSN = "oracle" ]
86 then
87 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/orainputt3.oracle >/dev/null 2>&1
88 else
89 $CSQL_INSTALL_ROOT/bin/csql -s $REL_PATH/csqlinputtest12.sql >/dev/null 2>&1
92 kill -9 $pid
93 ipcrm -M 1199 -M 2277
95 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6022 -g -s $REL_PATH/selectstart2.sql
96 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6022 -g -s $REL_PATH/selectstar.sql
97 $CSQL_INSTALL_ROOT/bin/csql -H localhost -P 6022 -g -s $REL_PATH/selectstart3.sql
98 isql $DS < $REL_PATH/dropt1t2t3.sql > /dev/null 2>&1
100 rm -f /tmp/csql/csqltable.conf
101 touch /tmp/csql/csqltable.conf
102 kill `ps -el | grep csqlsqlserver | gawk -F" " '{ print $4 }'`
103 exit 0;