*** empty log message ***
[csql.git] / test / system / Allocator / test002.ksh
blobfa98fc2d7497e9b657e847269b682d0bfbbe06ab
1 #!/bin/ksh
2 # TestCase:
3 # create table with two fields and index on first field
4 # insert 1000 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 1000 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
13 #Run this test only under csql/test or on this directory.
14 #Otherwise, it may fail
15 EXECUTABLE=${PWD}/system/Allocator/create
16 REL_PATH=.
17 if [ -s "$EXECUTABLE" ]
18 then
19 REL_PATH=${PWD}/system/Allocator
22 if [ $VALGRIND = "true" ]
23 then
24 valgrind --tool=memcheck --leak-check=full ${REL_PATH}/create 2> $0.valgr
25 else
26 ${REL_PATH}/create
27 if [ $? -ne 0 ]
28 then
29 exit 1;
32 echo "Tables and Indexes are created"
34 if [ $VALGRIND = "true" ]
35 then
36 valgrind --tool=memcheck --leak-check=full ${REL_PATH}/insert1000 2>> $0.valgr
37 else
38 ${REL_PATH}/insert1000
39 echo "Tuples inserted into table"
40 echo "Case 1: -T option for t1: with 1000 tuple"
43 echo "Tables and Indexes are created"
44 if [ $VALGRIND = "true" ]
45 then
46 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 2>> $0.valgr
47 else
48 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1
49 if [ $? -ne 0 ]
50 then
51 exit 2;
54 echo "Case 2: -I option for idx1 of t1, with 1000 tuple"
55 if [ $VALGRIND = "true" ]
56 then
57 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 2>> $0.valgr
58 else
59 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1
60 if [ $? -ne 0 ]
61 then
62 exit 2;
66 if [ $VALGRIND = "true" ]
67 then
68 valgrind --tool=memcheck --leak-check=full ${REL_PATH}/delete1000 2>> $0.valgr
69 else
70 ${REL_PATH}/delete1000
73 echo "Tuples deleted from table"
74 echo "Case 3: -T option for t1: after removing 1000 tuple"
75 if [ $VALGRIND = "true" ]
76 then
77 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 2>> $0.valgr
78 else
79 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1
80 if [ $? -ne 0 ]
81 then
82 exit 3;
85 echo "Case 4: -I option for idx1 of t1, after removing 1000 tuple"
86 if [ $VALGRIND = "true" ]
87 then
88 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 2>> $0.valgr
89 else
90 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1
91 if [ $? -ne 0 ]
92 then
93 exit 4;
96 ${REL_PATH}/drop
97 if [ $? -ne 0 ]
98 then
99 exit 100;
101 echo "Tables and Indexes are dropped"
103 exit 0