*** empty log message ***
[csql.git] / test / tools / catalog / test006.ksh
blob442ee05fdb05c667fc916c1e7adbc8fb99e40553
1 #!/bin/ksh
2 # Test Case
3 #create table t2 (f1,f2,f3) ,with primary key(f1) and index on f3 .check with -D chunk
4 #insert 20 tuples and check with -D chunk
5 #delete 10 tuples and check with -D chunk
6 #drop t2 check with -D chunk
8 CSQL_CONF=${PWD}/tools/catalog/csql.conf
9 input=${PWD}/tools/catalog/create.sql
10 REL_PATH=.
11 if [ -s "$input" -a -s "$CSQL_CONF" ]
12 then
13 REL_PATH=${PWD}/tools/catalog
15 export CSQL_CONFIG_FILE=$REL_PATH/csql.conf
17 $CSQL_INSTALL_ROOT/bin/csqlserver >/dev/null 2>&1 &
18 pid=$!
19 sleep 5
21 if [ "$VALGRIND" = "true" ]
22 then
23 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s $REL_PATH/create1.sql 2> $0.valgr
24 else
25 $CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s $REL_PATH/create1.sql
26 if [ $? -ne 0 ]
27 then
28 exit 1;
31 echo "Table created"
33 echo "Case 1: With -D chunk option after table creation:"
34 if [ "$VALGRIND" = "true" ]
35 then
36 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D chunk 2>> $0.valgr
37 else
38 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D chunk
39 if [ $? -ne 0 ]
40 then
41 exit 2;
45 if [ "$VALGRIND" = "true" ]
46 then
47 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s $REL_PATH/insert.sql 2>> $0.valgr
48 else
49 $CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s $REL_PATH/insert.sql
50 if [ $? -ne 0 ]
51 then
52 exit 3;
56 echo "Tuples insered"
57 echo "Case 2: With -D chunk option after insert 20 tuples:"
58 if [ "$VALGRIND" = "true" ]
59 then
60 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D chunk 2>> $0.valgr
61 else
62 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D chunk
63 if [ $? -ne 0 ]
64 then
65 exit 4;
69 if [ "$VALGRIND" = "true" ]
70 then
71 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s $REL_PATH/delete.sql 2>> $0.valgr
72 else
73 $CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s $REL_PATH/delete.sql
74 if [ $? -ne 0 ]
75 then
76 exit 5;
80 echo "10 tuples deleted"
82 echo "Case 3: With -D chunk option after deleting 10 tuples :"
83 if [ "$VALGRIND" = "true" ]
84 then
85 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D chunk 2>> $0.valgr
86 else
87 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D chunk
88 if [ $? -ne 0 ]
89 then
90 exit 6;
94 if [ "$VALGRIND" = "true" ]
95 then
96 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s $REL_PATH/dropIndex.sql 2>> $0.valgr
97 else
98 $CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s $REL_PATH/dropIndex.sql
99 if [ $? -ne 0 ]
100 then
101 exit 7;
104 echo "Index droped"
106 echo "Case 4: With -D chunk option after Index droped :"
107 if [ "$VALGRIND" = "true" ]
108 then
109 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D chunk 2>> $0.valgr
110 else
111 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D chunk
112 if [ $? -ne 0 ]
113 then
114 exit 8;
118 if [ "$VALGRIND" = "true" ]
119 then
120 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s $REL_PATH/dropt2.sql 2>> $0.valgr
121 else
122 $CSQL_INSTALL_ROOT/bin/csql -u root -p manager -s $REL_PATH/dropt2.sql
123 if [ $? -ne 0 ]
124 then
125 exit 9;
128 echo "t2 table droped with index"
130 echo "Case 5: With -D chunk option after drop t2 :"
131 if [ "$VALGRIND" = "true" ]
132 then
133 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D chunk 2>> $0.valgr
134 else
135 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D chunk
136 if [ $? -ne 0 ]
137 then
138 exit 10;
142 kill -9 $pid
143 ipcrm -M 1199 -M 2277
144 exit 0;