os/persistentdata/persistentstorage/sql/TEST/testexecute/SQLite/config/Robustness.ini.EMULATOR
Update contrib.
     2 // ///////////////////////////////////////////////////////////////////////////
 
     4 // Used by Robustness.script, SYSLIB-SQL-CIT-1705.
 
     6 // This config file defines operations to test robustness of the SQLite
 
     7 // system, under low disk conditions.
 
    10 Delete0=T:\Robustness0.db
 
    11 ExpectedError0=KErrNotFound
 
    12 Create1=T:\Robustness0.db
 
    13 Exec2=Create Table Sometable(Someint int primary key, Somereal real, Sometext text);
 
    14 // Add a small amount of data and check it.
 
    15 NewBlock3=AddBlock10-1
 
    16 NewBlock4=CheckBlock10-1
 
    17 // Fill the disk to within 100K of full. First fill to within 150k so we have
 
    18 // an easy way of quickly getting 50K of disk back - by deleting 'fillfile'.
 
    19 NewBlock5=FillDisk150K
 
    20 NewBlock6=FillDisk100K
 
    23 // Fill the disk until an out of disk error occurs. Then close the
 
    24 // database because once it's reported a disk full error all bets are off..
 
    28 // This will return things to 50K of disk free (because we filled to 150K,
 
    29 // then to 100K with this file).
 
    30 Delete10=T:\fillfile.txt
 
    32 // Re-open the database. This is the point of the test - the database should
 
    34 Open11=T:\Robustness0.db
 
    36 // Delete the data that we used to fill the disk. This is easy, our 'AddBlock'
 
    37 // data has 'Someint' values that are negative, the filldisk data is positive.
 
    38 Exec12=Delete From Sometable where Someint >= 0;
 
    40 // Check the original block is still ok...
 
    41 NewBlock13=CheckBlock10-1
 
    43 NewBlock14=AddBlock10-2
 
    44 NewBlock15=CheckBlock10-2
 
    47 Delete17=T:\Robustness0.db
 
    48 Delete18=T:\fillfile2.txt
 
    51 // Add two records to the table.
 
    53 Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
 
    54 Function1=WriteBigTable
 
    59 Text=Z:\TEF_SQL\TestData\reference1.txt
 
    60 EventuallyExpectedError=KErrNone
 
    64 // Add ten records to the table.
 
    66 Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
 
    67 Function1=WriteBigTable
 
    72 Text=Z:\TEF_SQL\TestData\reference1.txt
 
    73 EventuallyExpectedError=KErrNone
 
    77 // Add ten different records to the table.
 
    79 Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
 
    80 Function1=WriteBigTable
 
    85 Text=Z:\TEF_SQL\TestData\reference1.txt
 
    86 EventuallyExpectedError=KErrNone
 
    90 // Check the records added by AddBlock10-1
 
    92 Prepare0=Select * from Sometable;
 
    94 Function2=ReadBigTable
 
    99 Text=Z:\TEF_SQL\TestData\reference1.txt
 
   100 EventuallyExpectedError=KErrNone
 
   103 // Check both blocks.
 
   105 Prepare0=Select * from Sometable;
 
   107 Function2=ReadBigTable
 
   112 Text=Z:\TEF_SQL\TestData\reference1.txt
 
   113 EventuallyExpectedError=KErrNone
 
   118 // /////////////////////////////////////////////////////////////////////////// 
 
   120 // Fill the disk to within 4M of full. Unnecessary on the emulator.
 
   124 // Fill the disk to within 150K of full.
 
   126 Function0=NearFillDisk
 
   127 FillFile=T:\fillfile2.txt
 
   131 // Fill the disk to within 100K of full.
 
   133 Function0=NearFillDisk
 
   134 FillFile=T:\fillfile.txt
 
   138 // Use 8k text chunks to fill the disk up not so quickly.
 
   140 Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
 
   141 Function1=WriteBigTable
 
   146 Text=Z:\TEF_SQL\TestData\reference1.txt
 
   147 EventuallyExpectedError=KErrDiskFull
 
   151 // Fill the disk with small records, slow. We should close the database once the
 
   152 // i/o error has been seen - unless we have space reserved.
 
   154 Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
 
   155 Function1=WriteBigTable
 
   161 EventuallyExpectedError=KErrDiskFull
 
   165 // ///////////////////////////////////////////////////////////////////////////
 
   167 // Used by SYSLIB-SQL-CIT-1741
 
   169 // This block has two concurrent, synchronized threads. It checks that
 
   170 // a database can be modified when the disk is utterly full if disk space
 
   171 // has been reserved, looks for appropriate errors and so forth.
 
   173 // This block is initially triggered by 'FillTest' which is working
 
   174 // on a separate db on the same disk at the same time.
 
   177 Delete1=T:\Robustness5.db
 
   178 ExpectedError1=KErrNotFound
 
   180 Create2=T:\Robustness5.db
 
   181 // Reserve 100K of space.
 
   182 ReserveDriveSpace3=102400
 
   183 Exec4=Create Table Sometable(Someint int primary key, Somereal real, Sometext text);
 
   186 // Fill the disk to within 100K of full.
 
   187 NewBlock6=FillDisk100K
 
   189 // Fill the remaining 100K with db writes. Do NOT close - we have reserved space.
 
   192 // Get the reserved space.
 
   195 // And add two more records. No error should occur, we have reserved space now.
 
   196 // Two of these records is <15K.
 
   197 NewBlock9=AddBlock2-1
 
   200 // Wake up 'FillTest'. There is very little disk space left (<8k?) at this
 
   201 // point but it will be using very small records so it'll manage some.
 
   203 // Goes to FillTest Step 7.
 
   206 // FillTest has filled the disk remaining with small records.
 
   207 // Our reserved disk space is actually shared so the following delete will
 
   208 // fail - the reserve has gone. Two records, about 15k.
 
   209 Exec13=delete from Sometable where Someint>=0 and Someint<2;
 
   210 ExpectedError13=KErrDiskFull
 
   211 ReleaseReserveAccess14=
 
   215 // Goes to FillTest Step 13.
 
   217 // Right, we're done. Clean up. Try releasing the reserve again, just to
 
   218 // see if it will break anything.. Naturally we must do this before the
 
   219 // RSqlDatabase::Close, we must have a valid object to do anything.
 
   220 ReleaseReserveAccess18=
 
   223 Delete21=T:\Robustness5.db
 
   224 Delete22=T:\fillfile.txt
 
   227 // Runs concurrently with DeleteTest.
 
   229 Delete0=T:\Robustness4.db
 
   230 ExpectedError0=KErrNotFound
 
   231 Create1=T:\Robustness4.db
 
   232 Exec2=Create Table Sometable(Someint int primary key, Somereal real, Sometext text);
 
   233 // Add some data to the database.
 
   234 NewBlock3=AddBlock10-1
 
   235 NewBlock4=CheckBlock10-1
 
   236 // Now trigger the 'DeleteTest' block - this fills the whole disk with a
 
   237 // separate database and signals us back when it's done.
 
   239 // Goes to DeleteTest step 1.
 
   241 // Attempt to add more data to our database.  Some will work, especially as
 
   242 // our records are small. The 'FillTest-1' block is expecting an error.
 
   243 Prepare7=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
 
   247 // Wake up 'DeleteTest' again. It's going to delete a record or two.
 
   248 // Goes to DeleteTest Step 13.
 
   253 // We can't do any db operations now - this thread never had reserved disk space
 
   254 // so all we can do is close down.
 
   257 Delete14=T:\Robustness4.db
 
   259 // Goes to DeleteTest step 18.
 
   263 // Called by FillTest. Fills the (small) amount of remaining disk.
 
   265 Function0=WriteBigTable
 
   270 Text=Shine On You Crazy Diamond
 
   271 EventuallyExpectedError=KErrDiskFull
 
   274 // ///////////////////////////////////////////////////////////////////////////
 
   276 // Used by SYSLIB-SQL-CIT-1704
 
   278 // Here we create a database and add some data to it. Then we ATTACH another
 
   279 // database (creating it in the process) on a completely different partition.
 
   280 // We fill that partition with 'FillDisk' and then try to add one more record,
 
   281 // which should fail. Then we attempt to delete the attached database,
 
   282 // expecting 'KErrInUse', then we DETACH it and once more try to write to it,
 
   283 // which of course fails. Then we delete it.
 
   285 Delete0=C:\Robustness2.db
 
   286 ExpectedError0=KErrNotFound
 
   287 Delete1=T:\Robustness3.db
 
   288 ExpectedError1=KErrNotFound
 
   289 Create2=C:\Robustness2.db
 
   291 Exec4=Create Table Maintable(MyInt int primary key, MyReal real, MyText text);
 
   292 NewBlock5=AttachAddBlock
 
   294 Exec6=Attach "T:\Robustness3.db" as TheAttached;
 
   295 Exec7=Create Table TheAttached.Sometable(Someint int, Somereal real, Sometext text);
 
   297 // Fill the disk to within 100K of full (with a file..)
 
   298 NewBlock8=FillDisk150K
 
   299 NewBlock9=FillDisk100K
 
   301 // Fill up the drive with the attached database, first with big records,
 
   306 // Re-open and re-attach.. Fill right to the limit with small records.
 
   307 Open12=C:\Robustness2.db
 
   308 Exec13=Attach "T:\Robustness3.db" as TheAttached;
 
   312 // Re-open and re-attach...
 
   313 Open16=C:\Robustness2.db
 
   314 Exec17=Attach "T:\Robustness3.db" as TheAttached;
 
   316 // Verify we can add no more.
 
   317 Exec18=Insert into Sometable values(-90009, 2.718281828, "Hovercraft");
 
   318 ExpectedError18=KErrDiskFull
 
   320 // Close, re-open and re-attach, bets are off once we have a disk error.
 
   322 Open20=C:\Robustness2.db
 
   323 Exec21=Attach "T:\Robustness3.db" as TheAttached;
 
   325 // Verify the attached db is locked.
 
   326 Delete22=T:\Robustness3.db
 
   327 ExpectedError22=KErrInUse
 
   329 // Beyond this point we can't expect anything to work (necessarily) because
 
   330 // there isn't any disk space left. So grab free off 50K to make sure
 
   331 // (the fill to within 100K of full file which was created after filling
 
   332 // to within 150K of full).
 
   333 Delete23=T:\fillfile.txt
 
   337 // The number of lines common to both tables is highly dependent on exactly
 
   338 // how much space was left when the disk was filled. We really can't know
 
   339 // how many lines there will be so lets just check there are some.. Even
 
   340 // this might fail if the amount of space was very small..
 
   341 Prepare26=Select * from Maintable, Sometable where(MyInt = Someint);
 
   344 // Keep the reserve for the moment or we can't be sure things will run.
 
   346 // We're in the middle of an RSqlStatement operation so this detach will
 
   348 Exec29=Detach TheAttached;
 
   349 ExpectedError29=KSqlErrGeneral
 
   350 LastErrorMessage30=database TheAttached is locked
 
   351 // Statement has NOT expired, because DETACH should have failed..
 
   354 Exec33=Detach TheAttached;
 
   355 Exec34=Select * from Sometable;
 
   356 ExpectedError34=KSqlErrGeneral
 
   357 LastErrorMessage35=no such table: Sometable
 
   359 // Now try to delete it again. This attempt should be successful.
 
   360 Delete36=T:\Robustness3.db
 
   361 // This test has been done before..
 
   362 Delete37=C:\Robustness2.db
 
   363 ExpectedError37=KErrInUse
 
   364 ReleaseReserveAccess38=
 
   367 Delete41=C:\Robustness2.db
 
   368 Delete42=T:\fillfile2.txt
 
   371 // Just add a little to the database..
 
   373 Prepare0=Insert into Maintable(MyInt, MyReal, MyText) values(:FInt, :FReal, :FText);
 
   374 Function1=WriteBigTable
 
   378 Multiplier=9.869604401
 
   379 Text=Hey, here's some text.
 
   380 EventuallyExpectedError=KErrNone