os/persistentdata/persistentstorage/sql/TEST/testexecute/SQLite/config/Robustness.ini.EMULATOR
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sql/TEST/testexecute/SQLite/config/Robustness.ini.EMULATOR	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,384 @@
     1.4 +
     1.5 +// ///////////////////////////////////////////////////////////////////////////
     1.6 +//
     1.7 +// Used by Robustness.script, SYSLIB-SQL-CIT-1705.
     1.8 +//
     1.9 +// This config file defines operations to test robustness of the SQLite
    1.10 +// system, under low disk conditions.
    1.11 +//
    1.12 +[Top]
    1.13 +Delete0=T:\Robustness0.db
    1.14 +ExpectedError0=KErrNotFound
    1.15 +Create1=T:\Robustness0.db
    1.16 +Exec2=Create Table Sometable(Someint int primary key, Somereal real, Sometext text);
    1.17 +// Add a small amount of data and check it.
    1.18 +NewBlock3=AddBlock10-1
    1.19 +NewBlock4=CheckBlock10-1
    1.20 +// Fill the disk to within 100K of full. First fill to within 150k so we have
    1.21 +// an easy way of quickly getting 50K of disk back - by deleting 'fillfile'.
    1.22 +NewBlock5=FillDisk150K
    1.23 +NewBlock6=FillDisk100K
    1.24 +
    1.25 +NoOperation7=
    1.26 +// Fill the disk until an out of disk error occurs. Then close the
    1.27 +// database because once it's reported a disk full error all bets are off..
    1.28 +NewBlock8=FillDisk1
    1.29 +Close9=
    1.30 +
    1.31 +// This will return things to 50K of disk free (because we filled to 150K,
    1.32 +// then to 100K with this file).
    1.33 +Delete10=T:\fillfile.txt
    1.34 +
    1.35 +// Re-open the database. This is the point of the test - the database should
    1.36 +// still be usable.
    1.37 +Open11=T:\Robustness0.db
    1.38 +
    1.39 +// Delete the data that we used to fill the disk. This is easy, our 'AddBlock'
    1.40 +// data has 'Someint' values that are negative, the filldisk data is positive.
    1.41 +Exec12=Delete From Sometable where Someint >= 0;
    1.42 +
    1.43 +// Check the original block is still ok...
    1.44 +NewBlock13=CheckBlock10-1
    1.45 +
    1.46 +NewBlock14=AddBlock10-2
    1.47 +NewBlock15=CheckBlock10-2
    1.48 +
    1.49 +Close16=
    1.50 +Delete17=T:\Robustness0.db
    1.51 +Delete18=T:\fillfile2.txt
    1.52 +EndBlock19=
    1.53 +
    1.54 +// Add two records to the table.
    1.55 +[AddBlock2-1]
    1.56 +Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
    1.57 +Function1=WriteBigTable
    1.58 +LowCount=-30
    1.59 +HighCount=-29
    1.60 +CountStep=1
    1.61 +Multiplier=-1.859785
    1.62 +Text=Z:\TEF_SQL\TestData\reference1.txt
    1.63 +EventuallyExpectedError=KErrNone
    1.64 +St_Close2=
    1.65 +EndBlock3=
    1.66 +
    1.67 +// Add ten records to the table.
    1.68 +[AddBlock10-1]
    1.69 +Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
    1.70 +Function1=WriteBigTable
    1.71 +LowCount=-20
    1.72 +HighCount=-11
    1.73 +CountStep=1
    1.74 +Multiplier=-1.859785
    1.75 +Text=Z:\TEF_SQL\TestData\reference1.txt
    1.76 +EventuallyExpectedError=KErrNone
    1.77 +St_Close2=
    1.78 +EndBlock3=
    1.79 +
    1.80 +// Add ten different records to the table.
    1.81 +[AddBlock10-2]
    1.82 +Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
    1.83 +Function1=WriteBigTable
    1.84 +LowCount=-10
    1.85 +HighCount=-1
    1.86 +CountStep=1
    1.87 +Multiplier=-1.859785
    1.88 +Text=Z:\TEF_SQL\TestData\reference1.txt
    1.89 +EventuallyExpectedError=KErrNone
    1.90 +St_Close2=
    1.91 +EndBlock3=
    1.92 +
    1.93 +// Check the records added by AddBlock10-1
    1.94 +[CheckBlock10-1]
    1.95 +Prepare0=Select * from Sometable;
    1.96 +Next1=KSqlAtRow
    1.97 +Function2=ReadBigTable
    1.98 +LowCount=-20
    1.99 +HighCount=-11
   1.100 +CountStep=1
   1.101 +Multiplier=-1.859785
   1.102 +Text=Z:\TEF_SQL\TestData\reference1.txt
   1.103 +EventuallyExpectedError=KErrNone
   1.104 +St_Close3=
   1.105 +EndBlock4=
   1.106 +// Check both blocks.
   1.107 +[CheckBlock10-2]
   1.108 +Prepare0=Select * from Sometable;
   1.109 +Next1=KSqlAtRow
   1.110 +Function2=ReadBigTable
   1.111 +LowCount=-20
   1.112 +HighCount=-1
   1.113 +CountStep=1
   1.114 +Multiplier=-1.859785
   1.115 +Text=Z:\TEF_SQL\TestData\reference1.txt
   1.116 +EventuallyExpectedError=KErrNone
   1.117 +St_Close3=
   1.118 +EndBlock4=
   1.119 +
   1.120 +
   1.121 +// /////////////////////////////////////////////////////////////////////////// 
   1.122 +
   1.123 +// Fill the disk to within 4M of full. Unnecessary on the emulator.
   1.124 +[FillDisk4M]
   1.125 +EndBlock0=
   1.126 +
   1.127 +// Fill the disk to within 150K of full.
   1.128 +[FillDisk150K]
   1.129 +Function0=NearFillDisk
   1.130 +FillFile=T:\fillfile2.txt
   1.131 +DiskFree=153600
   1.132 +EndBlock1=
   1.133 +
   1.134 +// Fill the disk to within 100K of full.
   1.135 +[FillDisk100K]
   1.136 +Function0=NearFillDisk
   1.137 +FillFile=T:\fillfile.txt
   1.138 +DiskFree=102400
   1.139 +EndBlock1=
   1.140 +
   1.141 +// Use 8k text chunks to fill the disk up not so quickly.
   1.142 +[FillDisk1]
   1.143 +Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
   1.144 +Function1=WriteBigTable
   1.145 +LowCount=0
   1.146 +HighCount=999999
   1.147 +CountStep=1
   1.148 +Multiplier=299792458
   1.149 +Text=Z:\TEF_SQL\TestData\reference1.txt
   1.150 +EventuallyExpectedError=KErrDiskFull
   1.151 +St_Close2=
   1.152 +EndBlock3=
   1.153 +
   1.154 +// Fill the disk with small records, slow. We should close the database once the
   1.155 +// i/o error has been seen - unless we have space reserved.
   1.156 +[FillDisk2]
   1.157 +Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
   1.158 +Function1=WriteBigTable
   1.159 +LowCount=1000000
   1.160 +HighCount=1999999
   1.161 +CountStep=1
   1.162 +Multiplier=299792458
   1.163 +Text=S
   1.164 +EventuallyExpectedError=KErrDiskFull
   1.165 +St_Close2=
   1.166 +EndBlock3=
   1.167 +
   1.168 +// ///////////////////////////////////////////////////////////////////////////
   1.169 +//
   1.170 +// Used by SYSLIB-SQL-CIT-1741
   1.171 +// 
   1.172 +// This block has two concurrent, synchronized threads. It checks that
   1.173 +// a database can be modified when the disk is utterly full if disk space
   1.174 +// has been reserved, looks for appropriate errors and so forth.
   1.175 +//
   1.176 +// This block is initially triggered by 'FillTest' which is working
   1.177 +// on a separate db on the same disk at the same time.
   1.178 +[DeleteTest]
   1.179 +WaitA0=1
   1.180 +Delete1=T:\Robustness5.db
   1.181 +ExpectedError1=KErrNotFound
   1.182 +
   1.183 +Create2=T:\Robustness5.db
   1.184 +// Reserve 100K of space.
   1.185 +ReserveDriveSpace3=102400
   1.186 +Exec4=Create Table Sometable(Someint int primary key, Somereal real, Sometext text);
   1.187 +NoOperation5=
   1.188 +
   1.189 +// Fill the disk to within 100K of full.
   1.190 +NewBlock6=FillDisk100K
   1.191 +
   1.192 +// Fill the remaining 100K with db writes. Do NOT close - we have reserved space.
   1.193 +NewBlock7=FillDisk1
   1.194 +
   1.195 +// Get the reserved space.
   1.196 +GetReserveAccess8=
   1.197 +
   1.198 +// And add two more records. No error should occur, we have reserved space now.
   1.199 +// Two of these records is <15K.
   1.200 +NewBlock9=AddBlock2-1
   1.201 +NoOperation10=
   1.202 +
   1.203 +// Wake up 'FillTest'. There is very little disk space left (<8k?) at this
   1.204 +// point but it will be using very small records so it'll manage some.
   1.205 +SignalB11=1
   1.206 +// Goes to FillTest Step 7.
   1.207 +WaitA12=1
   1.208 +
   1.209 +// FillTest has filled the disk remaining with small records.
   1.210 +// Our reserved disk space is actually shared so the following delete will
   1.211 +// fail - the reserve has gone. Two records, about 15k.
   1.212 +Exec13=delete from Sometable where Someint>=0 and Someint<2;
   1.213 +ExpectedError13=KErrDiskFull
   1.214 +ReleaseReserveAccess14=
   1.215 +LastErrorMessage15=
   1.216 +SignalB16=1
   1.217 +WaitA17=1
   1.218 +// Goes to FillTest Step 13.
   1.219 +
   1.220 +// Right, we're done. Clean up. Try releasing the reserve again, just to
   1.221 +// see if it will break anything.. Naturally we must do this before the
   1.222 +// RSqlDatabase::Close, we must have a valid object to do anything.
   1.223 +ReleaseReserveAccess18=
   1.224 +FreeReservedSpace19=
   1.225 +Close20=
   1.226 +Delete21=T:\Robustness5.db
   1.227 +Delete22=T:\fillfile.txt
   1.228 +EndBlock23=
   1.229 +
   1.230 +// Runs concurrently with DeleteTest.
   1.231 +[FillTest]
   1.232 +Delete0=T:\Robustness4.db
   1.233 +ExpectedError0=KErrNotFound
   1.234 +Create1=T:\Robustness4.db
   1.235 +Exec2=Create Table Sometable(Someint int primary key, Somereal real, Sometext text);
   1.236 +// Add some data to the database.
   1.237 +NewBlock3=AddBlock10-1
   1.238 +NewBlock4=CheckBlock10-1
   1.239 +// Now trigger the 'DeleteTest' block - this fills the whole disk with a
   1.240 +// separate database and signals us back when it's done.
   1.241 +SignalA5=1
   1.242 +// Goes to DeleteTest step 1.
   1.243 +WaitB6=1
   1.244 +// Attempt to add more data to our database.  Some will work, especially as
   1.245 +// our records are small. The 'FillTest-1' block is expecting an error.
   1.246 +Prepare7=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
   1.247 +NewBlock8=FillTest-1
   1.248 +St_Close9=
   1.249 +
   1.250 +// Wake up 'DeleteTest' again. It's going to delete a record or two.
   1.251 +// Goes to DeleteTest Step 13.
   1.252 +SignalA10=1
   1.253 +WaitB11=1
   1.254 +NoOperation12=
   1.255 +
   1.256 +// We can't do any db operations now - this thread never had reserved disk space
   1.257 +// so all we can do is close down.
   1.258 +
   1.259 +Close13=
   1.260 +Delete14=T:\Robustness4.db
   1.261 +NoOperation15=
   1.262 +// Goes to DeleteTest step 18.
   1.263 +SignalA16=1
   1.264 +EndBlock17=
   1.265 +
   1.266 +// Called by FillTest. Fills the (small) amount of remaining disk.
   1.267 +[FillTest-1]
   1.268 +Function0=WriteBigTable
   1.269 +LowCount=12000000
   1.270 +HighCount=12999999
   1.271 +CountStep=1
   1.272 +Multiplier=299792458
   1.273 +Text=Shine On You Crazy Diamond
   1.274 +EventuallyExpectedError=KErrDiskFull
   1.275 +EndBlock1=
   1.276 +
   1.277 +// ///////////////////////////////////////////////////////////////////////////
   1.278 +//
   1.279 +// Used by SYSLIB-SQL-CIT-1704
   1.280 +//
   1.281 +// Here we create a database and add some data to it. Then we ATTACH another
   1.282 +// database (creating it in the process) on a completely different partition.
   1.283 +// We fill that partition with 'FillDisk' and then try to add one more record,
   1.284 +// which should fail. Then we attempt to delete the attached database,
   1.285 +// expecting 'KErrInUse', then we DETACH it and once more try to write to it,
   1.286 +// which of course fails. Then we delete it.
   1.287 +[Attach]
   1.288 +Delete0=C:\Robustness2.db
   1.289 +ExpectedError0=KErrNotFound
   1.290 +Delete1=T:\Robustness3.db
   1.291 +ExpectedError1=KErrNotFound
   1.292 +Create2=C:\Robustness2.db
   1.293 +NoOperation3=
   1.294 +Exec4=Create Table Maintable(MyInt int primary key, MyReal real, MyText text);
   1.295 +NewBlock5=AttachAddBlock
   1.296 +
   1.297 +Exec6=Attach "T:\Robustness3.db" as TheAttached;
   1.298 +Exec7=Create Table TheAttached.Sometable(Someint int, Somereal real, Sometext text);
   1.299 +
   1.300 +// Fill the disk to within 100K of full (with a file..)
   1.301 +NewBlock8=FillDisk150K
   1.302 +NewBlock9=FillDisk100K
   1.303 +
   1.304 +// Fill up the drive with the attached database, first with big records,
   1.305 +// then small.
   1.306 +NewBlock10=FillDisk1
   1.307 +Close11=
   1.308 +
   1.309 +// Re-open and re-attach.. Fill right to the limit with small records.
   1.310 +Open12=C:\Robustness2.db
   1.311 +Exec13=Attach "T:\Robustness3.db" as TheAttached;
   1.312 +NewBlock14=FillDisk2
   1.313 +Close15=
   1.314 +
   1.315 +// Re-open and re-attach...
   1.316 +Open16=C:\Robustness2.db
   1.317 +Exec17=Attach "T:\Robustness3.db" as TheAttached;
   1.318 +
   1.319 +// Verify we can add no more.
   1.320 +Exec18=Insert into Sometable values(-90009, 2.718281828, "Hovercraft");
   1.321 +ExpectedError18=KErrDiskFull
   1.322 +
   1.323 +// Close, re-open and re-attach, bets are off once we have a disk error.
   1.324 +Close19=
   1.325 +Open20=C:\Robustness2.db
   1.326 +Exec21=Attach "T:\Robustness3.db" as TheAttached;
   1.327 +
   1.328 +// Verify the attached db is locked.
   1.329 +Delete22=T:\Robustness3.db
   1.330 +ExpectedError22=KErrInUse
   1.331 +
   1.332 +// Beyond this point we can't expect anything to work (necessarily) because
   1.333 +// there isn't any disk space left. So grab free off 50K to make sure
   1.334 +// (the fill to within 100K of full file which was created after filling
   1.335 +// to within 150K of full).
   1.336 +Delete23=T:\fillfile.txt
   1.337 +NoOperation24=
   1.338 +NoOperation25=
   1.339 +
   1.340 +// The number of lines common to both tables is highly dependent on exactly
   1.341 +// how much space was left when the disk was filled. We really can't know
   1.342 +// how many lines there will be so lets just check there are some.. Even
   1.343 +// this might fail if the amount of space was very small..
   1.344 +Prepare26=Select * from Maintable, Sometable where(MyInt = Someint);
   1.345 +Next27=KSqlAtRow
   1.346 +Next28=KSqlAtRow
   1.347 +// Keep the reserve for the moment or we can't be sure things will run.
   1.348 +
   1.349 +// We're in the middle of an RSqlStatement operation so this detach will
   1.350 +// fail.
   1.351 +Exec29=Detach TheAttached;
   1.352 +ExpectedError29=KSqlErrGeneral
   1.353 +LastErrorMessage30=database TheAttached is locked
   1.354 +// Statement has NOT expired, because DETACH should have failed..
   1.355 +Next31=KSqlAtRow
   1.356 +St_Close32=
   1.357 +Exec33=Detach TheAttached;
   1.358 +Exec34=Select * from Sometable;
   1.359 +ExpectedError34=KSqlErrGeneral
   1.360 +LastErrorMessage35=no such table: Sometable
   1.361 +
   1.362 +// Now try to delete it again. This attempt should be successful.
   1.363 +Delete36=T:\Robustness3.db
   1.364 +// This test has been done before..
   1.365 +Delete37=C:\Robustness2.db
   1.366 +ExpectedError37=KErrInUse
   1.367 +ReleaseReserveAccess38=
   1.368 +FreeReservedSpace39=
   1.369 +Close40=
   1.370 +Delete41=C:\Robustness2.db
   1.371 +Delete42=T:\fillfile2.txt
   1.372 +EndBlock43=
   1.373 +
   1.374 +// Just add a little to the database..
   1.375 +[AttachAddBlock]
   1.376 +Prepare0=Insert into Maintable(MyInt, MyReal, MyText) values(:FInt, :FReal, :FText);
   1.377 +Function1=WriteBigTable
   1.378 +LowCount=0
   1.379 +HighCount=49
   1.380 +CountStep=1
   1.381 +Multiplier=9.869604401
   1.382 +Text=Hey, here's some text.
   1.383 +EventuallyExpectedError=KErrNone
   1.384 +St_Close2=
   1.385 +EndBlock3=
   1.386 +
   1.387 +