*** empty log message ***
[csql.git] / test / system / trans / test002.ksh
blobe266cf918e805c3024c51699643e4b88a3e8d6e3
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 abort
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;
29 echo "Case 1: -d option with no transactions"
30 if [ $VALGRIND = "true" ]
31 then
32 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D trans 2>> $0.valgr
33 else
34 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D trans
35 if [ $? -ne 0 ]
36 then
37 exit 1;
41 count=120
42 while [ ${count} -gt 0 ]
43 do
44 count=`expr ${count} - 1`
45 if [ $VALGRIND = "true" ]
46 then
47 valgrind --tool=memcheck --leak-check=full ${REL_PATH}/insert1andAbort 2>> $0.valgr
48 else
49 ${REL_PATH}/insert1andAbort >/tmp/tstlog
50 if [ $? -ne 1 ]
51 then
52 echo "insert failed"
53 exit 100;
56 done
57 echo "Case 2: -d option after 120 aborts"
58 if [ $VALGRIND = "true" ]
59 then
60 valgrind --tool=memcheck --leak-check=full $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D trans 2>> $0.valgr
61 else
62 $CSQL_INSTALL_ROOT/bin/catalog -u root -p manager -D trans
63 if [ $? -ne 0 ]
64 then
65 exit 1;
68 ${REL_PATH}/drop
69 if [ $? -ne 0 ]
70 then
71 echo "drop table failed"
72 exit 100;
74 exit 0