*** empty log message ***
[csql.git] / test / system / Allocator / test004.ksh
blob434d5c8280955e0264ac20167a80817c2ece073b
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 all tuples
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 100;
32 echo "Tables and Indexes are created"
33 if [ $VALGRIND = "true" ]
34 then
35 valgrind --tool=memcheck --leak-check=full ${REL_PATH}/insert100 2> $0.valgr
36 else
37 ${REL_PATH}/insert100
38 if [ $? -ne 100 ]
39 then
40 exit 100;
44 echo "Tuples inserted into table"
45 echo "Case 1: -T option for t1: with 100 tuple"
46 if [ $VALGRIND = "true" ]
47 then
48 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1 2> $0.valgr
49 else
50 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -T t1
51 if [ $? -ne 0 ]
52 then
53 exit 1;
56 echo "Case 2: -I option for idx1 of t1, with 100 tuple"
57 if [ $VALGRIND = "true" ]
58 then
59 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1 2> $0.valgr
60 else
61 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -I t1idx1
62 if [ $? -ne 0 ]
63 then
64 exit 2;
67 if [ $VALGRIND = "true" ]
68 then
69 valgrind --tool=memcheck --leak-check=full ${REL_PATH}/deleteAll 2> $0.valgr
70 else
71 ${REL_PATH}/deleteAll
72 fi
73 echo "Tuples deleted from table"
74 echo "Case 3: -T option for t1: after removing all 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 all 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;
95 fi
96 ${REL_PATH}/drop
97 if [ $? -ne 0 ]
98 then
99 exit 100;
101 echo "Tables and Indexes are dropped"
103 exit 0