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