*** empty log message ***
[csql.git] / test / system / Allocator / test003.ksh
blobd273783d196df54b841ded6d2ca4d0e0b17c527d
1 #!/bin/ksh
2 # TestCase:
3 # create table with two fields and index on first field
4 # insert 100 tuple
5 # check number of tuples, totalPagesused
6 # check pagesUsed for storing hash bucket
7 # check number of index nodes, pagesUsed for storing index nodes
8 # delete 1 tuple
9 # check number of tuples, totalPagesused
10 # check pagesUsed for storing hash bucket
11 # check number of index nodes, pagesUsed for storing index nodes
14 #Run this test only under csql/test or on this directory.
15 #Otherwise, it may fail
16 EXECUTABLE=${PWD}/system/Allocator/create
17 REL_PATH=.
18 if [ -s "$EXECUTABLE" ]
19 then
20 REL_PATH=${PWD}/system/Allocator
23 if [ $VALGRIND = "true" ]
24 then
25 valgrind --tool=memcheck --leak-check=full ${REL_PATH}/create 2>> $0.valgr
26 else
27 ${REL_PATH}/create
28 if [ $? -ne 0 ]
29 then
30 exit 100;
34 echo "Tables and Indexes are created"
35 if [ $VALGRIND = "true" ]
36 then
37 valgrind --tool=memcheck --leak-check=full ${REL_PATH}/insert100 2>> $0.valgr
38 else
39 ${REL_PATH}/insert100
40 if [ $? -ne 100 ]
41 then
42 exit 100;
46 echo "Tuples inserted into table"
47 echo "Case 1: -T option for t1: with 100 tuple"
48 if [ $VALGRIND = "true" ]
49 then
50 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 2>> $0.valgr
51 else
52 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1
53 if [ $? -ne 0 ]
54 then
55 exit 1;
59 echo "Case 2: -I option for idx1 of t1, with 100 tuple"
60 if [ $VALGRIND = "true" ]
61 then
62 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 2>> $0.valgr
63 else
64 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1
65 if [ $? -ne 0 ]
66 then
67 exit 2;
71 if [ $VALGRIND = "true" ]
72 then
73 valgrind --tool=memcheck --leak-check=full ${REL_PATH}/delete1 2>> $0.valgr
74 else
75 ${REL_PATH}/delete1
76 if [ $? -ne 1 ]
77 then
78 exit 100;
82 echo "Tuples deleted from table"
83 echo "Case 3: -T option for t1: after removing 1 tuple"
84 if [ $VALGRIND = "true" ]
85 then
86 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 2>> $0.valgr
87 else
88 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1
89 if [ $? -ne 0 ]
90 then
91 exit 3;
93 fi
95 echo "Case 4: -I option for idx1 of t1, after removing 1 tuple"
96 if [ $VALGRIND = "true" ]
97 then
98 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 2>> $0.valgr
99 else
100 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1
101 if [ $? -ne 0 ]
102 then
103 exit 4;
107 ${REL_PATH}/drop
108 if [ $? -ne 0 ]
109 then
110 exit 100;
112 echo "Tables and Indexes are dropped"
114 exit 0