persistentstorage/sql/TEST/testexecute/SQLite/config/Robustness.ini.EMULATOR
changeset 0 08ec8eefde2f
child 29 cce6680bbf1c
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 
       
     2 // ///////////////////////////////////////////////////////////////////////////
       
     3 //
       
     4 // Used by Robustness.script, SYSLIB-SQL-CIT-1705.
       
     5 //
       
     6 // This config file defines operations to test robustness of the SQLite
       
     7 // system, under low disk conditions.
       
     8 //
       
     9 [Top]
       
    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
       
    21 
       
    22 Exec7=Begin Transaction;
       
    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..
       
    25 NewBlock8=FillDisk1
       
    26 Close9=
       
    27 
       
    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
       
    31 
       
    32 // Re-open the database. This is the point of the test - the database should
       
    33 // still be usable.
       
    34 Open11=T:\Robustness0.db
       
    35 
       
    36 // Check the original block is still ok...
       
    37 NewBlock12=CheckBlock10-1
       
    38 
       
    39 // Delete the data that we used to fill the disk. This is easy, our 'AddBlock'
       
    40 // data has 'Someint' values that are negative, the filldisk data is positive.
       
    41 Exec13=Delete From Sometable where Someint >= 0;
       
    42 
       
    43 NewBlock14=AddBlock10-2
       
    44 NewBlock15=CheckBlock10-2
       
    45 
       
    46 Close16=
       
    47 Delete17=T:\Robustness0.db
       
    48 Delete18=T:\fillfile2.txt
       
    49 EndBlock19=
       
    50 
       
    51 // Add two records to the table.
       
    52 [AddBlock2-1]
       
    53 Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
       
    54 Function1=WriteBigTable
       
    55 LowCount=-30
       
    56 HighCount=-29
       
    57 CountStep=1
       
    58 Multiplier=-1.859785
       
    59 Text=Z:\TEF_SQL\TestData\reference1.txt
       
    60 EventuallyExpectedError=KErrNone
       
    61 St_Close2=
       
    62 EndBlock3=
       
    63 
       
    64 // Add ten records to the table.
       
    65 [AddBlock10-1]
       
    66 Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
       
    67 Function1=WriteBigTable
       
    68 LowCount=-20
       
    69 HighCount=-11
       
    70 CountStep=1
       
    71 Multiplier=-1.859785
       
    72 Text=Z:\TEF_SQL\TestData\reference1.txt
       
    73 EventuallyExpectedError=KErrNone
       
    74 St_Close2=
       
    75 EndBlock3=
       
    76 
       
    77 // Add ten different records to the table.
       
    78 [AddBlock10-2]
       
    79 Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
       
    80 Function1=WriteBigTable
       
    81 LowCount=-10
       
    82 HighCount=-1
       
    83 CountStep=1
       
    84 Multiplier=-1.859785
       
    85 Text=Z:\TEF_SQL\TestData\reference1.txt
       
    86 EventuallyExpectedError=KErrNone
       
    87 St_Close2=
       
    88 EndBlock3=
       
    89 
       
    90 // Check the records added by AddBlock10-1
       
    91 [CheckBlock10-1]
       
    92 Prepare0=Select * from Sometable;
       
    93 Next1=KSqlAtRow
       
    94 Function2=ReadBigTable
       
    95 LowCount=-20
       
    96 HighCount=-11
       
    97 CountStep=1
       
    98 Multiplier=-1.859785
       
    99 Text=Z:\TEF_SQL\TestData\reference1.txt
       
   100 EventuallyExpectedError=KErrNone
       
   101 St_Close3=
       
   102 EndBlock4=
       
   103 // Check both blocks.
       
   104 [CheckBlock10-2]
       
   105 Prepare0=Select * from Sometable;
       
   106 Next1=KSqlAtRow
       
   107 Function2=ReadBigTable
       
   108 LowCount=-20
       
   109 HighCount=-1
       
   110 CountStep=1
       
   111 Multiplier=-1.859785
       
   112 Text=Z:\TEF_SQL\TestData\reference1.txt
       
   113 EventuallyExpectedError=KErrNone
       
   114 St_Close3=
       
   115 EndBlock4=
       
   116 
       
   117 
       
   118 // /////////////////////////////////////////////////////////////////////////// 
       
   119 
       
   120 // Fill the disk to within 4M of full. Unnecessary on the emulator.
       
   121 [FillDisk4M]
       
   122 EndBlock0=
       
   123 
       
   124 // Fill the disk to within 150K of full.
       
   125 [FillDisk150K]
       
   126 Function0=NearFillDisk
       
   127 FillFile=T:\fillfile2.txt
       
   128 DiskFree=153600
       
   129 EndBlock1=
       
   130 
       
   131 // Fill the disk to within 100K of full.
       
   132 [FillDisk100K]
       
   133 Function0=NearFillDisk
       
   134 FillFile=T:\fillfile.txt
       
   135 DiskFree=102400
       
   136 EndBlock1=
       
   137 
       
   138 // Use 8k text chunks to fill the disk up not so quickly.
       
   139 [FillDisk1]
       
   140 Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
       
   141 Function1=WriteBigTable
       
   142 LowCount=0
       
   143 HighCount=999999
       
   144 CountStep=1
       
   145 Multiplier=299792458
       
   146 Text=Z:\TEF_SQL\TestData\reference1.txt
       
   147 EventuallyExpectedError=KErrDiskFull
       
   148 St_Close2=
       
   149 EndBlock3=
       
   150 
       
   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.
       
   153 [FillDisk2]
       
   154 Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText);
       
   155 Function1=WriteBigTable
       
   156 LowCount=1000000
       
   157 HighCount=1999999
       
   158 CountStep=1
       
   159 Multiplier=299792458
       
   160 Text=S
       
   161 EventuallyExpectedError=KErrDiskFull
       
   162 St_Close2=
       
   163 EndBlock3=
       
   164 
       
   165 // ///////////////////////////////////////////////////////////////////////////
       
   166 //
       
   167 // Used by SYSLIB-SQL-CIT-1741
       
   168 // 
       
   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.
       
   172 //
       
   173 // This block is initially triggered by 'FillTest' which is working
       
   174 // on a separate db on the same disk at the same time.
       
   175 [DeleteTest]
       
   176 WaitA0=1
       
   177 Delete1=T:\Robustness5.db
       
   178 ExpectedError1=KErrNotFound
       
   179 
       
   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);
       
   184 NoOperation5=
       
   185 
       
   186 // Fill the disk to within 100K of full.
       
   187 NewBlock6=FillDisk100K
       
   188 
       
   189 // Fill the remaining 100K with db writes. Do NOT close - we have reserved space.
       
   190 NewBlock7=FillDisk1
       
   191 
       
   192 // Get the reserved space.
       
   193 GetReserveAccess8=
       
   194 
       
   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
       
   198 NoOperation10=
       
   199 
       
   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.
       
   202 SignalB11=1
       
   203 // Goes to FillTest Step 7.
       
   204 WaitA12=1
       
   205 
       
   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=
       
   212 LastErrorMessage15=
       
   213 SignalB16=1
       
   214 WaitA17=1
       
   215 // Goes to FillTest Step 13.
       
   216 
       
   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=
       
   221 FreeReservedSpace19=
       
   222 Close20=
       
   223 Delete21=T:\Robustness5.db
       
   224 Delete22=T:\fillfile.txt
       
   225 EndBlock23=
       
   226 
       
   227 // Runs concurrently with DeleteTest.
       
   228 [FillTest]
       
   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.
       
   238 SignalA5=1
       
   239 // Goes to DeleteTest step 1.
       
   240 WaitB6=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);
       
   244 NewBlock8=FillTest-1
       
   245 St_Close9=
       
   246 
       
   247 // Wake up 'DeleteTest' again. It's going to delete a record or two.
       
   248 // Goes to DeleteTest Step 13.
       
   249 SignalA10=1
       
   250 WaitB11=1
       
   251 NoOperation12=
       
   252 
       
   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.
       
   255 
       
   256 Close13=
       
   257 Delete14=T:\Robustness4.db
       
   258 NoOperation15=
       
   259 // Goes to DeleteTest step 18.
       
   260 SignalA16=1
       
   261 EndBlock17=
       
   262 
       
   263 // Called by FillTest. Fills the (small) amount of remaining disk.
       
   264 [FillTest-1]
       
   265 Function0=WriteBigTable
       
   266 LowCount=12000000
       
   267 HighCount=12999999
       
   268 CountStep=1
       
   269 Multiplier=299792458
       
   270 Text=Shine On You Crazy Diamond
       
   271 EventuallyExpectedError=KErrDiskFull
       
   272 EndBlock1=
       
   273 
       
   274 // ///////////////////////////////////////////////////////////////////////////
       
   275 //
       
   276 // Used by SYSLIB-SQL-CIT-1704
       
   277 //
       
   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.
       
   284 [Attach]
       
   285 Delete0=C:\Robustness2.db
       
   286 ExpectedError0=KErrNotFound
       
   287 Delete1=T:\Robustness3.db
       
   288 ExpectedError1=KErrNotFound
       
   289 Create2=C:\Robustness2.db
       
   290 NoOperation3=
       
   291 Exec4=Create Table Maintable(MyInt int primary key, MyReal real, MyText text);
       
   292 NewBlock5=AttachAddBlock
       
   293 
       
   294 Exec6=Attach "T:\Robustness3.db" as TheAttached;
       
   295 Exec7=Create Table TheAttached.Sometable(Someint int, Somereal real, Sometext text);
       
   296 
       
   297 // Fill the disk to within 100K of full (with a file..)
       
   298 NewBlock8=FillDisk150K
       
   299 NewBlock9=FillDisk100K
       
   300 
       
   301 // Fill up the drive with the attached database, first with big records,
       
   302 // then small.
       
   303 NewBlock10=FillDisk1
       
   304 Close11=
       
   305 
       
   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;
       
   309 NewBlock14=FillDisk2
       
   310 Close15=
       
   311 
       
   312 // Re-open and re-attach...
       
   313 Open16=C:\Robustness2.db
       
   314 Exec17=Attach "T:\Robustness3.db" as TheAttached;
       
   315 
       
   316 // Verify we can add no more.
       
   317 Exec18=Insert into Sometable values(-90009, 2.718281828, "Hovercraft");
       
   318 ExpectedError18=KErrDiskFull
       
   319 
       
   320 // Close, re-open and re-attach, bets are off once we have a disk error.
       
   321 Close19=
       
   322 Open20=C:\Robustness2.db
       
   323 Exec21=Attach "T:\Robustness3.db" as TheAttached;
       
   324 
       
   325 // Verify the attached db is locked.
       
   326 Delete22=T:\Robustness3.db
       
   327 ExpectedError22=KErrInUse
       
   328 
       
   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
       
   334 NoOperation24=
       
   335 NoOperation25=
       
   336 
       
   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);
       
   342 Next27=KSqlAtRow
       
   343 Next28=KSqlAtRow
       
   344 // Keep the reserve for the moment or we can't be sure things will run.
       
   345 
       
   346 // We're in the middle of an RSqlStatement operation so this detach will
       
   347 // fail.
       
   348 Exec29=Detach TheAttached;
       
   349 ExpectedError29=KSqlErrGeneral
       
   350 LastErrorMessage30=database TheAttached is locked
       
   351 // Statement has NOT expired, because DETACH should have failed..
       
   352 Next31=KSqlAtRow
       
   353 St_Close32=
       
   354 Exec33=Detach TheAttached;
       
   355 Exec34=Select * from Sometable;
       
   356 ExpectedError34=KSqlErrGeneral
       
   357 LastErrorMessage35=no such table: Sometable
       
   358 
       
   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=
       
   365 FreeReservedSpace39=
       
   366 Close40=
       
   367 Delete41=C:\Robustness2.db
       
   368 Delete42=T:\fillfile2.txt
       
   369 EndBlock43=
       
   370 
       
   371 // Just add a little to the database..
       
   372 [AttachAddBlock]
       
   373 Prepare0=Insert into Maintable(MyInt, MyReal, MyText) values(:FInt, :FReal, :FText);
       
   374 Function1=WriteBigTable
       
   375 LowCount=0
       
   376 HighCount=49
       
   377 CountStep=1
       
   378 Multiplier=9.869604401
       
   379 Text=Hey, here's some text.
       
   380 EventuallyExpectedError=KErrNone
       
   381 St_Close2=
       
   382 EndBlock3=
       
   383 
       
   384