sl@0
|
1 |
|
sl@0
|
2 |
// ///////////////////////////////////////////////////////////////////////////
|
sl@0
|
3 |
//
|
sl@0
|
4 |
// Used by Robustness.script, SYSLIB-SQL-CIT-1705.
|
sl@0
|
5 |
//
|
sl@0
|
6 |
// This config file defines operations to test robustness of the SQLite
|
sl@0
|
7 |
// system, under low disk conditions.
|
sl@0
|
8 |
//
|
sl@0
|
9 |
[Top]
|
sl@0
|
10 |
Delete0=T:\Robustness0.db
|
sl@0
|
11 |
ExpectedError0=KErrNotFound
|
sl@0
|
12 |
Create1=T:\Robustness0.db
|
sl@0
|
13 |
Exec2=Create Table Sometable(Someint int primary key, Somereal real, Sometext text);
|
sl@0
|
14 |
// Add a small amount of data and check it.
|
sl@0
|
15 |
NewBlock3=AddBlock10-1
|
sl@0
|
16 |
NewBlock4=CheckBlock10-1
|
sl@0
|
17 |
// Fill the disk to within 100K of full. First fill to within 150k so we have
|
sl@0
|
18 |
// an easy way of quickly getting 50K of disk back - by deleting 'fillfile'.
|
sl@0
|
19 |
NewBlock5=FillDisk150K
|
sl@0
|
20 |
NewBlock6=FillDisk100K
|
sl@0
|
21 |
|
sl@0
|
22 |
NoOperation7=
|
sl@0
|
23 |
// Fill the disk until an out of disk error occurs. Then close the
|
sl@0
|
24 |
// database because once it's reported a disk full error all bets are off..
|
sl@0
|
25 |
NewBlock8=FillDisk1
|
sl@0
|
26 |
Close9=
|
sl@0
|
27 |
|
sl@0
|
28 |
// This will return things to 50K of disk free (because we filled to 150K,
|
sl@0
|
29 |
// then to 100K with this file).
|
sl@0
|
30 |
Delete10=T:\fillfile.txt
|
sl@0
|
31 |
|
sl@0
|
32 |
// Re-open the database. This is the point of the test - the database should
|
sl@0
|
33 |
// still be usable.
|
sl@0
|
34 |
Open11=T:\Robustness0.db
|
sl@0
|
35 |
|
sl@0
|
36 |
// Delete the data that we used to fill the disk. This is easy, our 'AddBlock'
|
sl@0
|
37 |
// data has 'Someint' values that are negative, the filldisk data is positive.
|
sl@0
|
38 |
Exec12=Delete From Sometable where Someint >= 0;
|
sl@0
|
39 |
|
sl@0
|
40 |
// Check the original block is still ok...
|
sl@0
|
41 |
NewBlock13=CheckBlock10-1
|
sl@0
|
42 |
|
sl@0
|
43 |
NewBlock14=AddBlock10-2
|
sl@0
|
44 |
NewBlock15=CheckBlock10-2
|
sl@0
|
45 |
|
sl@0
|
46 |
Close16=
|
sl@0
|
47 |
Delete17=T:\Robustness0.db
|
sl@0
|
48 |
Delete18=T:\fillfile2.txt
|
sl@0
|
49 |
EndBlock19=
|
sl@0
|
50 |
|
sl@0
|
51 |
// Add two records to the table.
|
sl@0
|
52 |
[AddBlock2-1]
|
sl@0
|
53 |
Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
|
sl@0
|
54 |
Function1=WriteBigTable
|
sl@0
|
55 |
LowCount=-30
|
sl@0
|
56 |
HighCount=-29
|
sl@0
|
57 |
CountStep=1
|
sl@0
|
58 |
Multiplier=-1.859785
|
sl@0
|
59 |
Text=Z:\TEF_SQL\TestData\reference1.txt
|
sl@0
|
60 |
EventuallyExpectedError=KErrNone
|
sl@0
|
61 |
St_Close2=
|
sl@0
|
62 |
EndBlock3=
|
sl@0
|
63 |
|
sl@0
|
64 |
// Add ten records to the table.
|
sl@0
|
65 |
[AddBlock10-1]
|
sl@0
|
66 |
Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
|
sl@0
|
67 |
Function1=WriteBigTable
|
sl@0
|
68 |
LowCount=-20
|
sl@0
|
69 |
HighCount=-11
|
sl@0
|
70 |
CountStep=1
|
sl@0
|
71 |
Multiplier=-1.859785
|
sl@0
|
72 |
Text=Z:\TEF_SQL\TestData\reference1.txt
|
sl@0
|
73 |
EventuallyExpectedError=KErrNone
|
sl@0
|
74 |
St_Close2=
|
sl@0
|
75 |
EndBlock3=
|
sl@0
|
76 |
|
sl@0
|
77 |
// Add ten different records to the table.
|
sl@0
|
78 |
[AddBlock10-2]
|
sl@0
|
79 |
Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
|
sl@0
|
80 |
Function1=WriteBigTable
|
sl@0
|
81 |
LowCount=-10
|
sl@0
|
82 |
HighCount=-1
|
sl@0
|
83 |
CountStep=1
|
sl@0
|
84 |
Multiplier=-1.859785
|
sl@0
|
85 |
Text=Z:\TEF_SQL\TestData\reference1.txt
|
sl@0
|
86 |
EventuallyExpectedError=KErrNone
|
sl@0
|
87 |
St_Close2=
|
sl@0
|
88 |
EndBlock3=
|
sl@0
|
89 |
|
sl@0
|
90 |
// Check the records added by AddBlock10-1
|
sl@0
|
91 |
[CheckBlock10-1]
|
sl@0
|
92 |
Prepare0=Select * from Sometable;
|
sl@0
|
93 |
Next1=KSqlAtRow
|
sl@0
|
94 |
Function2=ReadBigTable
|
sl@0
|
95 |
LowCount=-20
|
sl@0
|
96 |
HighCount=-11
|
sl@0
|
97 |
CountStep=1
|
sl@0
|
98 |
Multiplier=-1.859785
|
sl@0
|
99 |
Text=Z:\TEF_SQL\TestData\reference1.txt
|
sl@0
|
100 |
EventuallyExpectedError=KErrNone
|
sl@0
|
101 |
St_Close3=
|
sl@0
|
102 |
EndBlock4=
|
sl@0
|
103 |
// Check both blocks.
|
sl@0
|
104 |
[CheckBlock10-2]
|
sl@0
|
105 |
Prepare0=Select * from Sometable;
|
sl@0
|
106 |
Next1=KSqlAtRow
|
sl@0
|
107 |
Function2=ReadBigTable
|
sl@0
|
108 |
LowCount=-20
|
sl@0
|
109 |
HighCount=-1
|
sl@0
|
110 |
CountStep=1
|
sl@0
|
111 |
Multiplier=-1.859785
|
sl@0
|
112 |
Text=Z:\TEF_SQL\TestData\reference1.txt
|
sl@0
|
113 |
EventuallyExpectedError=KErrNone
|
sl@0
|
114 |
St_Close3=
|
sl@0
|
115 |
EndBlock4=
|
sl@0
|
116 |
|
sl@0
|
117 |
|
sl@0
|
118 |
// ///////////////////////////////////////////////////////////////////////////
|
sl@0
|
119 |
|
sl@0
|
120 |
// Fill the disk to within 4M of full. Unnecessary on the emulator.
|
sl@0
|
121 |
[FillDisk4M]
|
sl@0
|
122 |
EndBlock0=
|
sl@0
|
123 |
|
sl@0
|
124 |
// Fill the disk to within 150K of full.
|
sl@0
|
125 |
[FillDisk150K]
|
sl@0
|
126 |
Function0=NearFillDisk
|
sl@0
|
127 |
FillFile=T:\fillfile2.txt
|
sl@0
|
128 |
DiskFree=153600
|
sl@0
|
129 |
EndBlock1=
|
sl@0
|
130 |
|
sl@0
|
131 |
// Fill the disk to within 100K of full.
|
sl@0
|
132 |
[FillDisk100K]
|
sl@0
|
133 |
Function0=NearFillDisk
|
sl@0
|
134 |
FillFile=T:\fillfile.txt
|
sl@0
|
135 |
DiskFree=102400
|
sl@0
|
136 |
EndBlock1=
|
sl@0
|
137 |
|
sl@0
|
138 |
// Use 8k text chunks to fill the disk up not so quickly.
|
sl@0
|
139 |
[FillDisk1]
|
sl@0
|
140 |
Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
|
sl@0
|
141 |
Function1=WriteBigTable
|
sl@0
|
142 |
LowCount=0
|
sl@0
|
143 |
HighCount=999999
|
sl@0
|
144 |
CountStep=1
|
sl@0
|
145 |
Multiplier=299792458
|
sl@0
|
146 |
Text=Z:\TEF_SQL\TestData\reference1.txt
|
sl@0
|
147 |
EventuallyExpectedError=KErrDiskFull
|
sl@0
|
148 |
St_Close2=
|
sl@0
|
149 |
EndBlock3=
|
sl@0
|
150 |
|
sl@0
|
151 |
// Fill the disk with small records, slow. We should close the database once the
|
sl@0
|
152 |
// i/o error has been seen - unless we have space reserved.
|
sl@0
|
153 |
[FillDisk2]
|
sl@0
|
154 |
Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
|
sl@0
|
155 |
Function1=WriteBigTable
|
sl@0
|
156 |
LowCount=1000000
|
sl@0
|
157 |
HighCount=1999999
|
sl@0
|
158 |
CountStep=1
|
sl@0
|
159 |
Multiplier=299792458
|
sl@0
|
160 |
Text=S
|
sl@0
|
161 |
EventuallyExpectedError=KErrDiskFull
|
sl@0
|
162 |
St_Close2=
|
sl@0
|
163 |
EndBlock3=
|
sl@0
|
164 |
|
sl@0
|
165 |
// ///////////////////////////////////////////////////////////////////////////
|
sl@0
|
166 |
//
|
sl@0
|
167 |
// Used by SYSLIB-SQL-CIT-1741
|
sl@0
|
168 |
//
|
sl@0
|
169 |
// This block has two concurrent, synchronized threads. It checks that
|
sl@0
|
170 |
// a database can be modified when the disk is utterly full if disk space
|
sl@0
|
171 |
// has been reserved, looks for appropriate errors and so forth.
|
sl@0
|
172 |
//
|
sl@0
|
173 |
// This block is initially triggered by 'FillTest' which is working
|
sl@0
|
174 |
// on a separate db on the same disk at the same time.
|
sl@0
|
175 |
[DeleteTest]
|
sl@0
|
176 |
WaitA0=1
|
sl@0
|
177 |
Delete1=T:\Robustness5.db
|
sl@0
|
178 |
ExpectedError1=KErrNotFound
|
sl@0
|
179 |
|
sl@0
|
180 |
Create2=T:\Robustness5.db
|
sl@0
|
181 |
// Reserve 100K of space.
|
sl@0
|
182 |
ReserveDriveSpace3=102400
|
sl@0
|
183 |
Exec4=Create Table Sometable(Someint int primary key, Somereal real, Sometext text);
|
sl@0
|
184 |
NoOperation5=
|
sl@0
|
185 |
|
sl@0
|
186 |
// Fill the disk to within 100K of full.
|
sl@0
|
187 |
NewBlock6=FillDisk100K
|
sl@0
|
188 |
|
sl@0
|
189 |
// Fill the remaining 100K with db writes. Do NOT close - we have reserved space.
|
sl@0
|
190 |
NewBlock7=FillDisk1
|
sl@0
|
191 |
|
sl@0
|
192 |
// Get the reserved space.
|
sl@0
|
193 |
GetReserveAccess8=
|
sl@0
|
194 |
|
sl@0
|
195 |
// And add two more records. No error should occur, we have reserved space now.
|
sl@0
|
196 |
// Two of these records is <15K.
|
sl@0
|
197 |
NewBlock9=AddBlock2-1
|
sl@0
|
198 |
NoOperation10=
|
sl@0
|
199 |
|
sl@0
|
200 |
// Wake up 'FillTest'. There is very little disk space left (<8k?) at this
|
sl@0
|
201 |
// point but it will be using very small records so it'll manage some.
|
sl@0
|
202 |
SignalB11=1
|
sl@0
|
203 |
// Goes to FillTest Step 7.
|
sl@0
|
204 |
WaitA12=1
|
sl@0
|
205 |
|
sl@0
|
206 |
// FillTest has filled the disk remaining with small records.
|
sl@0
|
207 |
// Our reserved disk space is actually shared so the following delete will
|
sl@0
|
208 |
// fail - the reserve has gone. Two records, about 15k.
|
sl@0
|
209 |
Exec13=delete from Sometable where Someint>=0 and Someint<2;
|
sl@0
|
210 |
ExpectedError13=KErrDiskFull
|
sl@0
|
211 |
ReleaseReserveAccess14=
|
sl@0
|
212 |
LastErrorMessage15=
|
sl@0
|
213 |
SignalB16=1
|
sl@0
|
214 |
WaitA17=1
|
sl@0
|
215 |
// Goes to FillTest Step 13.
|
sl@0
|
216 |
|
sl@0
|
217 |
// Right, we're done. Clean up. Try releasing the reserve again, just to
|
sl@0
|
218 |
// see if it will break anything.. Naturally we must do this before the
|
sl@0
|
219 |
// RSqlDatabase::Close, we must have a valid object to do anything.
|
sl@0
|
220 |
ReleaseReserveAccess18=
|
sl@0
|
221 |
FreeReservedSpace19=
|
sl@0
|
222 |
Close20=
|
sl@0
|
223 |
Delete21=T:\Robustness5.db
|
sl@0
|
224 |
Delete22=T:\fillfile.txt
|
sl@0
|
225 |
EndBlock23=
|
sl@0
|
226 |
|
sl@0
|
227 |
// Runs concurrently with DeleteTest.
|
sl@0
|
228 |
[FillTest]
|
sl@0
|
229 |
Delete0=T:\Robustness4.db
|
sl@0
|
230 |
ExpectedError0=KErrNotFound
|
sl@0
|
231 |
Create1=T:\Robustness4.db
|
sl@0
|
232 |
Exec2=Create Table Sometable(Someint int primary key, Somereal real, Sometext text);
|
sl@0
|
233 |
// Add some data to the database.
|
sl@0
|
234 |
NewBlock3=AddBlock10-1
|
sl@0
|
235 |
NewBlock4=CheckBlock10-1
|
sl@0
|
236 |
// Now trigger the 'DeleteTest' block - this fills the whole disk with a
|
sl@0
|
237 |
// separate database and signals us back when it's done.
|
sl@0
|
238 |
SignalA5=1
|
sl@0
|
239 |
// Goes to DeleteTest step 1.
|
sl@0
|
240 |
WaitB6=1
|
sl@0
|
241 |
// Attempt to add more data to our database. Some will work, especially as
|
sl@0
|
242 |
// our records are small. The 'FillTest-1' block is expecting an error.
|
sl@0
|
243 |
Prepare7=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
|
sl@0
|
244 |
NewBlock8=FillTest-1
|
sl@0
|
245 |
St_Close9=
|
sl@0
|
246 |
|
sl@0
|
247 |
// Wake up 'DeleteTest' again. It's going to delete a record or two.
|
sl@0
|
248 |
// Goes to DeleteTest Step 13.
|
sl@0
|
249 |
SignalA10=1
|
sl@0
|
250 |
WaitB11=1
|
sl@0
|
251 |
NoOperation12=
|
sl@0
|
252 |
|
sl@0
|
253 |
// We can't do any db operations now - this thread never had reserved disk space
|
sl@0
|
254 |
// so all we can do is close down.
|
sl@0
|
255 |
|
sl@0
|
256 |
Close13=
|
sl@0
|
257 |
Delete14=T:\Robustness4.db
|
sl@0
|
258 |
NoOperation15=
|
sl@0
|
259 |
// Goes to DeleteTest step 18.
|
sl@0
|
260 |
SignalA16=1
|
sl@0
|
261 |
EndBlock17=
|
sl@0
|
262 |
|
sl@0
|
263 |
// Called by FillTest. Fills the (small) amount of remaining disk.
|
sl@0
|
264 |
[FillTest-1]
|
sl@0
|
265 |
Function0=WriteBigTable
|
sl@0
|
266 |
LowCount=12000000
|
sl@0
|
267 |
HighCount=12999999
|
sl@0
|
268 |
CountStep=1
|
sl@0
|
269 |
Multiplier=299792458
|
sl@0
|
270 |
Text=Shine On You Crazy Diamond
|
sl@0
|
271 |
EventuallyExpectedError=KErrDiskFull
|
sl@0
|
272 |
EndBlock1=
|
sl@0
|
273 |
|
sl@0
|
274 |
// ///////////////////////////////////////////////////////////////////////////
|
sl@0
|
275 |
//
|
sl@0
|
276 |
// Used by SYSLIB-SQL-CIT-1704
|
sl@0
|
277 |
//
|
sl@0
|
278 |
// Here we create a database and add some data to it. Then we ATTACH another
|
sl@0
|
279 |
// database (creating it in the process) on a completely different partition.
|
sl@0
|
280 |
// We fill that partition with 'FillDisk' and then try to add one more record,
|
sl@0
|
281 |
// which should fail. Then we attempt to delete the attached database,
|
sl@0
|
282 |
// expecting 'KErrInUse', then we DETACH it and once more try to write to it,
|
sl@0
|
283 |
// which of course fails. Then we delete it.
|
sl@0
|
284 |
[Attach]
|
sl@0
|
285 |
Delete0=C:\Robustness2.db
|
sl@0
|
286 |
ExpectedError0=KErrNotFound
|
sl@0
|
287 |
Delete1=T:\Robustness3.db
|
sl@0
|
288 |
ExpectedError1=KErrNotFound
|
sl@0
|
289 |
Create2=C:\Robustness2.db
|
sl@0
|
290 |
NoOperation3=
|
sl@0
|
291 |
Exec4=Create Table Maintable(MyInt int primary key, MyReal real, MyText text);
|
sl@0
|
292 |
NewBlock5=AttachAddBlock
|
sl@0
|
293 |
|
sl@0
|
294 |
Exec6=Attach "T:\Robustness3.db" as TheAttached;
|
sl@0
|
295 |
Exec7=Create Table TheAttached.Sometable(Someint int, Somereal real, Sometext text);
|
sl@0
|
296 |
|
sl@0
|
297 |
// Fill the disk to within 100K of full (with a file..)
|
sl@0
|
298 |
NewBlock8=FillDisk150K
|
sl@0
|
299 |
NewBlock9=FillDisk100K
|
sl@0
|
300 |
|
sl@0
|
301 |
// Fill up the drive with the attached database, first with big records,
|
sl@0
|
302 |
// then small.
|
sl@0
|
303 |
NewBlock10=FillDisk1
|
sl@0
|
304 |
Close11=
|
sl@0
|
305 |
|
sl@0
|
306 |
// Re-open and re-attach.. Fill right to the limit with small records.
|
sl@0
|
307 |
Open12=C:\Robustness2.db
|
sl@0
|
308 |
Exec13=Attach "T:\Robustness3.db" as TheAttached;
|
sl@0
|
309 |
NewBlock14=FillDisk2
|
sl@0
|
310 |
Close15=
|
sl@0
|
311 |
|
sl@0
|
312 |
// Re-open and re-attach...
|
sl@0
|
313 |
Open16=C:\Robustness2.db
|
sl@0
|
314 |
Exec17=Attach "T:\Robustness3.db" as TheAttached;
|
sl@0
|
315 |
|
sl@0
|
316 |
// Verify we can add no more.
|
sl@0
|
317 |
Exec18=Insert into Sometable values(-90009, 2.718281828, "Hovercraft");
|
sl@0
|
318 |
ExpectedError18=KErrDiskFull
|
sl@0
|
319 |
|
sl@0
|
320 |
// Close, re-open and re-attach, bets are off once we have a disk error.
|
sl@0
|
321 |
Close19=
|
sl@0
|
322 |
Open20=C:\Robustness2.db
|
sl@0
|
323 |
Exec21=Attach "T:\Robustness3.db" as TheAttached;
|
sl@0
|
324 |
|
sl@0
|
325 |
// Verify the attached db is locked.
|
sl@0
|
326 |
Delete22=T:\Robustness3.db
|
sl@0
|
327 |
ExpectedError22=KErrInUse
|
sl@0
|
328 |
|
sl@0
|
329 |
// Beyond this point we can't expect anything to work (necessarily) because
|
sl@0
|
330 |
// there isn't any disk space left. So grab free off 50K to make sure
|
sl@0
|
331 |
// (the fill to within 100K of full file which was created after filling
|
sl@0
|
332 |
// to within 150K of full).
|
sl@0
|
333 |
Delete23=T:\fillfile.txt
|
sl@0
|
334 |
NoOperation24=
|
sl@0
|
335 |
NoOperation25=
|
sl@0
|
336 |
|
sl@0
|
337 |
// The number of lines common to both tables is highly dependent on exactly
|
sl@0
|
338 |
// how much space was left when the disk was filled. We really can't know
|
sl@0
|
339 |
// how many lines there will be so lets just check there are some.. Even
|
sl@0
|
340 |
// this might fail if the amount of space was very small..
|
sl@0
|
341 |
Prepare26=Select * from Maintable, Sometable where(MyInt = Someint);
|
sl@0
|
342 |
Next27=KSqlAtRow
|
sl@0
|
343 |
Next28=KSqlAtRow
|
sl@0
|
344 |
// Keep the reserve for the moment or we can't be sure things will run.
|
sl@0
|
345 |
|
sl@0
|
346 |
// We're in the middle of an RSqlStatement operation so this detach will
|
sl@0
|
347 |
// fail.
|
sl@0
|
348 |
Exec29=Detach TheAttached;
|
sl@0
|
349 |
ExpectedError29=KSqlErrGeneral
|
sl@0
|
350 |
LastErrorMessage30=database TheAttached is locked
|
sl@0
|
351 |
// Statement has NOT expired, because DETACH should have failed..
|
sl@0
|
352 |
Next31=KSqlAtRow
|
sl@0
|
353 |
St_Close32=
|
sl@0
|
354 |
Exec33=Detach TheAttached;
|
sl@0
|
355 |
Exec34=Select * from Sometable;
|
sl@0
|
356 |
ExpectedError34=KSqlErrGeneral
|
sl@0
|
357 |
LastErrorMessage35=no such table: Sometable
|
sl@0
|
358 |
|
sl@0
|
359 |
// Now try to delete it again. This attempt should be successful.
|
sl@0
|
360 |
Delete36=T:\Robustness3.db
|
sl@0
|
361 |
// This test has been done before..
|
sl@0
|
362 |
Delete37=C:\Robustness2.db
|
sl@0
|
363 |
ExpectedError37=KErrInUse
|
sl@0
|
364 |
ReleaseReserveAccess38=
|
sl@0
|
365 |
FreeReservedSpace39=
|
sl@0
|
366 |
Close40=
|
sl@0
|
367 |
Delete41=C:\Robustness2.db
|
sl@0
|
368 |
Delete42=T:\fillfile2.txt
|
sl@0
|
369 |
EndBlock43=
|
sl@0
|
370 |
|
sl@0
|
371 |
// Just add a little to the database..
|
sl@0
|
372 |
[AttachAddBlock]
|
sl@0
|
373 |
Prepare0=Insert into Maintable(MyInt, MyReal, MyText) values(:FInt, :FReal, :FText);
|
sl@0
|
374 |
Function1=WriteBigTable
|
sl@0
|
375 |
LowCount=0
|
sl@0
|
376 |
HighCount=49
|
sl@0
|
377 |
CountStep=1
|
sl@0
|
378 |
Multiplier=9.869604401
|
sl@0
|
379 |
Text=Hey, here's some text.
|
sl@0
|
380 |
EventuallyExpectedError=KErrNone
|
sl@0
|
381 |
St_Close2=
|
sl@0
|
382 |
EndBlock3=
|
sl@0
|
383 |
|
sl@0
|
384 |
|