Project:
lixa
Code Location:
https://lixa.svn.sourceforge.net/svnroot/lixa/tests//tests
/
oracle.at
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# # WARNING # This file must be manually kept synchronized with the content of # "postgresql.at", "ibmdb2.at", etc... # AT_BANNER([Oracle]) # check the schema "hr" is available and the user can connect to it AT_SETUP([ORA/0.0/0.0 Oracle availability]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_CHECK([echo "quit" | sqlplus "hr/hr" >$TESTS_TMP_FILE1 && grep "Connected to" $TESTS_TMP_FILE1], [0], [ignore], [ignore]) AT_CLEANUP # check the current user has SELECT privilege on table authors AT_SETUP([ORA/0.0/0.1 countries table exists]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_CHECK([echo "SELECT * FROM countries;" | sqlplus "hr/hr" >$TESTS_TMP_FILE1 && grep "rows selected" $TESTS_TMP_FILE1], [0], [ignore], [ignore]) AT_CLEANUP # check the current user has DELETE & INSERT privilege on table authors AT_SETUP([ORA/0.0/0.2 DELETE & INSERT INTO countries]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_CHECK([echo "DELETE FROM countries WHERE COUNTRY_ID = 'IS';" | sqlplus "hr/hr" >$TESTS_TMP_FILE1 && grep "rows* deleted" $TESTS_TMP_FILE1], [0], [ignore], [ignore]) AT_CHECK([echo "INSERT INTO countries VALUES('IS','Iceland',1);" | sqlplus "hr/hr" >$TESTS_TMP_FILE1 && grep "row created" $TESTS_TMP_FILE1], [0], [ignore], [ignore]) AT_CHECK([echo "DELETE FROM countries WHERE COUNTRY_ID = 'IS';" | sqlplus "hr/hr" >$TESTS_TMP_FILE1 && grep "row deleted" $TESTS_TMP_FILE1], [0], [ignore], [ignore]) AT_CLEANUP # try one phase commit AT_SETUP([ORA/0.1/0.0 One phase commit]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0012 ; lixa_test_exec.sh reset start case0038 1 1 0], [0], [ignore], [ignore]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0012 ; lixa_test_exec.sh noreset none case0038 1 0 0], [0], [ignore], [ignore]) AT_CLEANUP # try two phase commit AT_SETUP([ORA/0.1/0.1 Two phase commit]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_start/0 xa_end/0 xa_prepare/0 xa_commit/0 xa_close/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; lixa_test_exec.sh noreset none case0038 1 1 0], [0], [ignore], [ignore]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_start/0 xa_end/0 xa_prepare/0 xa_commit/0 xa_close/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; lixa_test_exec.sh noreset none case0038 1 0 0], [0], [ignore], [ignore]) AT_CLEANUP # try rollback after prepare AT_SETUP([ORA/0.1/0.2 Rollback after prepare]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_start/0 xa_end/0 xa_prepare/-3 xa_rollback/0 xa_close/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; lixa_test_exec.sh noreset none case0038 1 1 -2], [0], [ignore], [ignore]) AT_CLEANUP AT_SETUP([ORA/0.1/1.0 Crash after connect]) AT_CHECK([if test "$LIXA_CRASH" = "no"; then exit 77; fi]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_start/0 xa_end/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; export LIXA_CRASH_POINT=2 ; lixa_test_exec.sh noreset none case0038 1 1 0], [134], [ignore], [ignore]) AT_CLEANUP AT_SETUP([ORA/0.1/1.1 Crash in the middle of xa_open]) AT_CHECK([if test "$LIXA_CRASH" = "no"; then exit 77; fi]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_start/0 xa_end/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; export LIXA_CRASH_POINT=3 ; lixa_test_exec.sh noreset none case0038 1 1 0], [134], [ignore], [ignore]) AT_CLEANUP AT_SETUP([ORA/0.1/1.2 Crash in the middle of xa_open (2)]) AT_CHECK([if test "$LIXA_CRASH" = "no"; then exit 77; fi]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_start/0 xa_end/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; export LIXA_CRASH_POINT=4 ; lixa_test_exec.sh noreset none case0038 1 1 0], [134], [ignore], [ignore]) AT_CLEANUP AT_SETUP([ORA/0.1/1.3 Crash after xa_open]) AT_CHECK([if test "$LIXA_CRASH" = "no"; then exit 77; fi]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_start/0 xa_end/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; export LIXA_CRASH_POINT=5 ; lixa_test_exec.sh noreset none case0038 1 1 0], [134], [ignore], [ignore]) AT_CLEANUP AT_SETUP([ORA/0.1/2.0 Crash in the middle of xa_end]) AT_CHECK([if test "$LIXA_CRASH" = "no"; then exit 77; fi]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_start/0 xa_end/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; export LIXA_CRASH_POINT=11 ; lixa_test_exec.sh noreset none case0038 1 1 0], [134], [ignore], [ignore]) AT_CLEANUP AT_SETUP([ORA/0.1/2.1 Automatic recovery]) AT_CHECK([if test "$LIXA_CRASH" = "no"; then exit 77; fi]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_rollback/0 xa_start/0 xa_end/0 xa_prepare/0 xa_commit/0 xa_close/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; lixa_test_exec.sh noreset none case0038 1 1 0], [0], [ignore], [ignore]) AT_CHECK([lixad --config-file=$TESTS_ETC_DIR/lixad_conf.xml --dump=u|tee $TESTS_TMP_FILE1 ; grep 'recovery failed: 1' $TESTS_TMP_FILE1], [1], [ignore], [ignore]) AT_CLEANUP AT_SETUP([ORA/0.1/2.2 Crash after end]) AT_CHECK([if test "$LIXA_CRASH" = "no"; then exit 77; fi]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_start/0 xa_end/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; export LIXA_CRASH_POINT=12 ; lixa_test_exec.sh noreset none case0038 1 0 0], [134], [ignore], [ignore]) AT_CLEANUP AT_SETUP([ORA/0.1/2.3 Automatic recovery]) AT_CHECK([if test "$LIXA_CRASH" = "no"; then exit 77; fi]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_rollback/0 xa_start/0 xa_end/0 xa_prepare/0 xa_commit/0 xa_close/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; lixa_test_exec.sh noreset none case0038 1 0 0], [0], [ignore], [ignore]) AT_CHECK([lixad --config-file=$TESTS_ETC_DIR/lixad_conf.xml --dump=u|tee $TESTS_TMP_FILE1 ; grep 'recovery failed: 1' $TESTS_TMP_FILE1], [1], [ignore], [ignore]) AT_CLEANUP # crash in the middle of prepare AT_SETUP([ORA/0.1/3.0 Crash in the middle of prepare]) AT_CHECK([if test "$LIXA_CRASH" = "no"; then exit 77; fi]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_start/0 xa_end/0 xa_prepare/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; export LIXA_CRASH_POINT=14 ; lixa_test_exec.sh noreset none case0038 1 1 0], [134], [ignore], [ignore]) AT_CLEANUP AT_SETUP([ORA/0.1/3.1 Automatic recovery]) AT_CHECK([if test "$LIXA_CRASH" = "no"; then exit 77; fi]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_commit/0 xa_start/0 xa_end/0 xa_prepare/0 xa_commit/0 xa_close/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; lixa_test_exec.sh noreset none case0038 1 0 0], [0], [ignore], [ignore]) AT_CLEANUP # crash after prepare AT_SETUP([ORA/0.1/4.0 Crash after prepare]) AT_CHECK([if test "$LIXA_CRASH" = "no"; then exit 77; fi]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_start/0 xa_end/0 xa_prepare/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; export LIXA_CRASH_POINT=15 ; lixa_test_exec.sh noreset none case0038 1 1 0], [134], [ignore], [ignore]) AT_CLEANUP AT_SETUP([ORA/0.1/4.1 Automatic recovery]) AT_CHECK([if test "$LIXA_CRASH" = "no"; then exit 77; fi]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_commit/0 xa_start/0 xa_end/0 xa_prepare/0 xa_commit/0 xa_close/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; lixa_test_exec.sh noreset none case0038 1 0 0], [0], [ignore], [ignore]) AT_CLEANUP # crash after prepare AT_SETUP([ORA/0.1/5.0 Crash after prepare]) AT_CHECK([if test "$LIXA_CRASH" = "no"; then exit 77; fi]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_start/0 xa_end/0 xa_prepare/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; export LIXA_CRASH_POINT=15 ; lixa_test_exec.sh noreset stop case0038 1 1 0], [134], [ignore], [ignore]) AT_CLEANUP AT_SETUP([ORA/0.1/5.1 Manual recovery]) AT_CHECK([if test "$LIXA_CRASH" = "no"; then exit 77; fi]) AT_CHECK([if test "$HAVE_ORACLE" = "no"; then exit 77; fi]) AT_DATA([monkey1s.conf], [[# monkey R.M. config xa_open/0 xa_recover/0 xa_close/0 ]]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; lixa_test_exec.sh reset start lixar -p >$TESTS_TMP_FILE1], [0], [ignore], [ignore]) AT_CHECK([grep '^xid=' $TESTS_TMP_FILE1 | cut -d "'" -f 2 > $TESTS_TMP_FILE2], [0], [ignore], [ignore]) AT_CHECK([export LIXA_PROFILE=CASE_PROF_0013 ; lixa_test_exec.sh noreset stop lixar -p -r -X $TESTS_TMP_FILE2], [0], [ignore], [ignore]) AT_CLEANUP
