*** empty log message ***
[csql.git] / test / system / trans / test001.ksh
blobb385efafdd59561c084af62c86b226c90188d0f9
1 #!/bin/ksh
2 # TestCase:
3 # check used and free transacation slots in transaction table
4 # create table
5 # for i = 1 to 120
6 # insert 1 tuple in 1 transaction and commit
7 # end for
8 # check used and free transacation slots in transaction table
10 #Run this test only under csql/test or on this directory.
11 #Otherwise, it may fail
12 EXECUTABLE=${PWD}/system/trans/create
13 REL_PATH=.
14 if [ -s "$EXECUTABLE" ]
15 then
16 REL_PATH=${PWD}/system/trans
18 if [ $VALGRIND = "true" ]
19 then
20 valgrind --tool=memcheck --leak-check=full ${REL_PATH}/create 2> $0.valgr
21 else
22 ${REL_PATH}/create
23 if [ $? -ne 0 ]
24 then
25 echo "create table failed"
26 exit 100;
30 echo "Case 1: -d option with no transactions"
31 if [ $VALGRIND = "true" ]
32 then
33 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D trans 2>> $0.valgr
34 else
35 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D trans
36 if [ $? -ne 0 ]
37 then
38 exit 1;
42 count=120
43 while [ ${count} -gt 0 ]
44 do
45 count=`expr ${count} - 1`
46 if [ $VALGRIND = "true" ]
47 then
48 valgrind --tool=memcheck --leak-check=full ${REL_PATH}/insert1andCommit 2>> $0.valgr
49 else
50 ${REL_PATH}/insert1andCommit >/tmp/tstlog
51 if [ $? -ne 1 ]
52 then
53 echo "insert failed"
54 exit 100;
57 done
58 echo "Case 2: -d option after 120 commits"
59 if [ $VALGRIND = "true" ]
60 then
61 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D trans 2>> $0.valgr
62 else
63 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D trans
64 if [ $? -ne 0 ]
65 then
66 exit 1;
69 ${REL_PATH}/drop
70 if [ $? -ne 0 ]
71 then
72 echo "drop table failed"
73 exit 100;
75 exit 0