sl@0: sl@0: // /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // Used by Robustness.script, SYSLIB-SQL-CIT-1705. sl@0: // sl@0: // This config file defines operations to test robustness of the SQLite sl@0: // system, under low disk conditions. sl@0: // sl@0: [Top] sl@0: Delete0=E:\Robustness0.db sl@0: ExpectedError0=KErrNotFound sl@0: Create1=E:\Robustness0.db sl@0: Exec2=Create Table Sometable(Someint int primary key, Somereal real, Sometext text); sl@0: // Add a small amount of data and check it. sl@0: NewBlock3=AddBlock10-1 sl@0: NewBlock4=CheckBlock10-1 sl@0: // Fill the disk to within 100K of full. First fill to within 160k so we have sl@0: // an easy way of quickly getting 60K of disk back - by deleting 'fillfile'. sl@0: NewBlock5=FillDisk160K sl@0: NewBlock6=FillDisk100K sl@0: sl@0: NoOperation7= sl@0: // Fill the disk until an out of disk error occurs. Then close the sl@0: // database because once it's reported a disk full error all bets are off.. sl@0: NewBlock8=FillDisk1 sl@0: Close9= sl@0: sl@0: // This will return things to 60K of disk free (because we filled to 160K, sl@0: // then to 100K with this file). sl@0: Delete10=E:\fillfile.txt sl@0: sl@0: // Re-open the database. This is the point of the test - the database should sl@0: // still be usable. sl@0: Open11=E:\Robustness0.db sl@0: sl@0: // Delete the data that we used to fill the disk. This is easy, our 'AddBlock' sl@0: // data has 'Someint' values that are negative, the filldisk data is positive. sl@0: Exec12=Delete From Sometable where Someint >= 0; sl@0: sl@0: // Check the original block is still ok... sl@0: NewBlock13=CheckBlock10-1 sl@0: sl@0: NewBlock14=AddBlock10-2 sl@0: NewBlock15=CheckBlock10-2 sl@0: sl@0: Close16= sl@0: Delete17=E:\Robustness0.db sl@0: Delete18=E:\fillfile2.txt sl@0: EndBlock19= sl@0: sl@0: // Add two records to the table. sl@0: [AddBlock2-1] sl@0: Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText); sl@0: Function1=WriteBigTable sl@0: LowCount=-30 sl@0: HighCount=-29 sl@0: CountStep=1 sl@0: Multiplier=-1.859785 sl@0: Text=Z:\TEF_SQL\TestData\reference1.txt sl@0: EventuallyExpectedError=KErrNone sl@0: St_Close2= sl@0: EndBlock3= sl@0: sl@0: // Add ten records to the table. sl@0: [AddBlock10-1] sl@0: Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText); sl@0: Function1=WriteBigTable sl@0: LowCount=-20 sl@0: HighCount=-11 sl@0: CountStep=1 sl@0: Multiplier=-1.859785 sl@0: Text=Z:\TEF_SQL\TestData\reference1.txt sl@0: EventuallyExpectedError=KErrNone sl@0: St_Close2= sl@0: EndBlock3= sl@0: sl@0: // Add ten different records to the table. sl@0: [AddBlock10-2] sl@0: Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText); sl@0: Function1=WriteBigTable sl@0: LowCount=-10 sl@0: HighCount=-1 sl@0: CountStep=1 sl@0: Multiplier=-1.859785 sl@0: Text=Z:\TEF_SQL\TestData\reference1.txt sl@0: EventuallyExpectedError=KErrNone sl@0: St_Close2= sl@0: EndBlock3= sl@0: sl@0: // Check the records added by AddBlock10-1 sl@0: [CheckBlock10-1] sl@0: Prepare0=Select * from Sometable; sl@0: Next1=KSqlAtRow sl@0: Function2=ReadBigTable sl@0: LowCount=-20 sl@0: HighCount=-11 sl@0: CountStep=1 sl@0: Multiplier=-1.859785 sl@0: Text=Z:\TEF_SQL\TestData\reference1.txt sl@0: EventuallyExpectedError=KErrNone sl@0: St_Close3= sl@0: EndBlock4= sl@0: // Check both blocks. sl@0: [CheckBlock10-2] sl@0: Prepare0=Select * from Sometable; sl@0: Next1=KSqlAtRow sl@0: Function2=ReadBigTable sl@0: LowCount=-20 sl@0: HighCount=-1 sl@0: CountStep=1 sl@0: Multiplier=-1.859785 sl@0: Text=Z:\TEF_SQL\TestData\reference1.txt sl@0: EventuallyExpectedError=KErrNone sl@0: St_Close3= sl@0: EndBlock4= sl@0: sl@0: sl@0: // /////////////////////////////////////////////////////////////////////////// sl@0: sl@0: // Fill the disk to within 4M of full. sl@0: [FillDisk4M] sl@0: Function0=NearFillDisk sl@0: FillFile=E:\fillfile4M.txt sl@0: DiskFree=4194304 sl@0: EndBlock1= sl@0: sl@0: // Fill the disk to within 160K of full. sl@0: [FillDisk160K] sl@0: Function0=NearFillDisk sl@0: FillFile=E:\fillfile2.txt sl@0: DiskFree=168960 sl@0: EndBlock1= sl@0: sl@0: // Fill the disk to within 100K of full. sl@0: [FillDisk100K] sl@0: Function0=NearFillDisk sl@0: FillFile=E:\fillfile.txt sl@0: DiskFree=102400 sl@0: EndBlock1= sl@0: sl@0: // Use 8k text chunks to fill the disk up not so quickly. sl@0: [FillDisk1] sl@0: Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText); sl@0: Function1=WriteBigTable sl@0: LowCount=0 sl@0: HighCount=999999 sl@0: CountStep=1 sl@0: Multiplier=299792458 sl@0: Text=Z:\TEF_SQL\TestData\reference1.txt sl@0: EventuallyExpectedError=KErrDiskFull sl@0: St_Close2= sl@0: EndBlock3= sl@0: sl@0: // Fill the disk with small records, slow. We should close the database once the sl@0: // i/o error has been seen - unless we have space reserved. sl@0: [FillDisk2] sl@0: Prepare0=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText); sl@0: Function1=WriteBigTable sl@0: LowCount=1000000 sl@0: HighCount=1999999 sl@0: CountStep=1 sl@0: Multiplier=299792458 sl@0: Text=S sl@0: EventuallyExpectedError=KErrDiskFull sl@0: St_Close2= sl@0: EndBlock3= sl@0: sl@0: // /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // Used by SYSLIB-SQL-CIT-1741 sl@0: // sl@0: // This block has two concurrent, synchronized threads. It checks that sl@0: // a database can be modified when the disk is utterly full if disk space sl@0: // has been reserved, looks for appropriate errors and so forth. sl@0: // sl@0: // This block is initially triggered by 'FillTest' which is working sl@0: // on a separate db on the same disk at the same time. sl@0: [DeleteTest] sl@0: WaitA0=1 sl@0: Delete1=E:\Robustness5.db sl@0: ExpectedError1=KErrNotFound sl@0: DefineConfig2=page_size=1024; sl@0: sl@0: Create3=E:\Robustness5.db sl@0: // Reserve 100K of space. sl@0: ReserveDriveSpace4=102400 sl@0: Exec5=Create Table Sometable(Someint int primary key, Somereal real, Sometext text); sl@0: sl@0: // Fill the disk to within 100K of full. sl@0: NewBlock6=FillDisk100K sl@0: sl@0: // Fill the remaining 100K with db writes. Do NOT close - we have reserved space. sl@0: NewBlock7=FillDisk1 sl@0: sl@0: // Get the reserved space. sl@0: GetReserveAccess8= sl@0: sl@0: // And add two more records. No error should occur, we have reserved space now. sl@0: // Two of these records is <15K. sl@0: NewBlock9=AddBlock2-1 sl@0: NoOperation10= sl@0: sl@0: // Wake up 'FillTest'. There is very little disk space left (<8k?) at this sl@0: // point but it will be using very small records so it'll manage some. sl@0: SignalB11=1 sl@0: // Goes to FillTest Step 7. sl@0: WaitA12=1 sl@0: sl@0: // FillTest has filled the disk remaining with small records. sl@0: // Our reserved disk space is actually shared so the following delete will sl@0: // fail - the reserve has gone. Two records, about 15k. sl@0: Exec13=delete from Sometable where Someint>=0 and Someint<2; sl@0: ExpectedError13=KErrDiskFull sl@0: ReleaseReserveAccess14= sl@0: LastErrorMessage15= sl@0: SignalB16=1 sl@0: WaitA17=1 sl@0: // Goes to FillTest Step 13. sl@0: sl@0: // Right, we're done. Clean up. Try releasing the reserve again, just to sl@0: // see if it will break anything.. Naturally we must do this before the sl@0: // RSqlDatabase::Close, we must have a valid object to do anything. sl@0: ReleaseReserveAccess18= sl@0: FreeReservedSpace19= sl@0: Close20= sl@0: Delete21=E:\Robustness5.db sl@0: Delete22=E:\fillfile.txt sl@0: EndBlock23= sl@0: sl@0: // Runs concurrently with DeleteTest. sl@0: [FillTest] sl@0: Delete0=E:\Robustness4.db sl@0: ExpectedError0=KErrNotFound sl@0: Create1=E:\Robustness4.db sl@0: Exec2=Create Table Sometable(Someint int primary key, Somereal real, Sometext text); sl@0: // Add some data to the database. sl@0: NewBlock3=AddBlock10-1 sl@0: NewBlock4=CheckBlock10-1 sl@0: // Now trigger the 'DeleteTest' block - this fills the whole disk with a sl@0: // separate database and signals us back when it's done. sl@0: SignalA5=1 sl@0: // Goes to DeleteTest step 1. sl@0: WaitB6=1 sl@0: // Attempt to add more data to our database. Some will work, especially as sl@0: // our records are small. The 'FillTest-1' block is expecting an error. sl@0: Prepare7=Insert into Sometable(Someint, Somereal, Sometext) values(:FInt, :FReal, :FText); sl@0: NewBlock8=FillTest-1 sl@0: St_Close9= sl@0: sl@0: // Wake up 'DeleteTest' again. It's going to delete a record or two. sl@0: // Goes to DeleteTest Step 13. sl@0: SignalA10=1 sl@0: WaitB11=1 sl@0: NoOperation12= sl@0: sl@0: // We can't do any db operations now - this thread never had reserved disk space sl@0: // so all we can do is close down. sl@0: sl@0: Close13= sl@0: Delete14=E:\Robustness4.db sl@0: NoOperation15= sl@0: // Goes to DeleteTest step 18. sl@0: SignalA16=1 sl@0: EndBlock17= sl@0: sl@0: // Called by FillTest. Fills the (small) amount of remaining disk. sl@0: [FillTest-1] sl@0: Function0=WriteBigTable sl@0: LowCount=12000000 sl@0: HighCount=12999999 sl@0: CountStep=1 sl@0: Multiplier=299792458 sl@0: Text=Shine On You Crazy Diamond sl@0: EventuallyExpectedError=KErrDiskFull sl@0: EndBlock1= sl@0: sl@0: // /////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // Used by SYSLIB-SQL-CIT-1704 sl@0: // sl@0: // Here we create a database and add some data to it. Then we ATTACH another sl@0: // database (creating it in the process) on a completely different partition. sl@0: // We fill that partition with 'FillDisk' and then try to add one more record, sl@0: // which should fail. Then we attempt to delete the attached database, sl@0: // expecting 'KErrInUse', then we DETACH it and once more try to write to it, sl@0: // which of course fails. Then we delete it. sl@0: [Attach] sl@0: Delete0=C:\Robustness2.db sl@0: ExpectedError0=KErrNotFound sl@0: Delete1=E:\Robustness3.db sl@0: ExpectedError1=KErrNotFound sl@0: Create2=C:\Robustness2.db sl@0: NoOperation3= sl@0: Exec4=Create Table Maintable(MyInt int primary key, MyReal real, MyText text); sl@0: NewBlock5=AttachAddBlock sl@0: sl@0: Exec6=Attach "E:\Robustness3.db" as TheAttached; sl@0: Exec7=Create Table TheAttached.Sometable(Someint int, Somereal real, Sometext text); sl@0: sl@0: // Fill the disk to within 100K of full (with a file..) sl@0: NewBlock8=FillDisk160K sl@0: NewBlock9=FillDisk100K sl@0: sl@0: // Fill up the drive with the attached database, first with big records, sl@0: // then small. sl@0: NewBlock10=FillDisk1 sl@0: Close11= sl@0: sl@0: // Re-open and re-attach.. Fill right to the limit with small records. sl@0: Open12=C:\Robustness2.db sl@0: Exec13=Attach "E:\Robustness3.db" as TheAttached; sl@0: NewBlock14=FillDisk2 sl@0: Close15= sl@0: sl@0: // Re-open and re-attach... sl@0: Open16=C:\Robustness2.db sl@0: Exec17=Attach "E:\Robustness3.db" as TheAttached; sl@0: sl@0: // Verify we can add no more. sl@0: Exec18=Insert into Sometable values(-90009, 2.718281828, "Hovercraft"); sl@0: ExpectedError18=KErrDiskFull sl@0: sl@0: // Close, re-open and re-attach, bets are off once we have a disk error. sl@0: Close19= sl@0: Open20=C:\Robustness2.db sl@0: Exec21=Attach "E:\Robustness3.db" as TheAttached; sl@0: sl@0: // Verify the attached db is locked. sl@0: Delete22=E:\Robustness3.db sl@0: ExpectedError22=KErrInUse sl@0: sl@0: // Beyond this point we can't expect anything to work (necessarily) because sl@0: // there isn't any disk space left. So grab free off 60K to make sure sl@0: // (the fill to within 100K of full file which was created after filling sl@0: // to within 160K of full). sl@0: Delete23=E:\fillfile.txt sl@0: NoOperation24= sl@0: NoOperation25= sl@0: sl@0: // The number of lines common to both tables is highly dependent on exactly sl@0: // how much space was left when the disk was filled. We really can't know sl@0: // how many lines there will be so lets just check there are some.. Even sl@0: // this might fail if the amount of space was very small.. sl@0: Prepare26=Select * from Maintable, Sometable where(MyInt = Someint); sl@0: Next27=KSqlAtRow sl@0: Next28=KSqlAtRow sl@0: // Keep the reserve for the moment or we can't be sure things will run. sl@0: sl@0: // We're in the middle of an RSqlStatement operation so this detach will sl@0: // fail. sl@0: Exec29=Detach TheAttached; sl@0: ExpectedError29=KSqlErrGeneral sl@0: LastErrorMessage30=database TheAttached is locked sl@0: // Statement has NOT expired, because DETACH should have failed.. sl@0: Next31=KSqlAtRow sl@0: St_Close32= sl@0: Exec33=Detach TheAttached; sl@0: Exec34=Select * from Sometable; sl@0: ExpectedError34=KSqlErrGeneral sl@0: LastErrorMessage35=no such table: Sometable sl@0: sl@0: // Now try to delete it again. This attempt should be successful. sl@0: Delete36=E:\Robustness3.db sl@0: // This test has been done before.. sl@0: Delete37=C:\Robustness2.db sl@0: ExpectedError37=KErrInUse sl@0: ReleaseReserveAccess38= sl@0: FreeReservedSpace39= sl@0: Close40= sl@0: Delete41=C:\Robustness2.db sl@0: Delete42=E:\fillfile2.txt sl@0: EndBlock43= sl@0: sl@0: // Just add a little to the database.. sl@0: [AttachAddBlock] sl@0: Prepare0=Insert into Maintable(MyInt, MyReal, MyText) values(:FInt, :FReal, :FText); sl@0: Function1=WriteBigTable sl@0: LowCount=0 sl@0: HighCount=49 sl@0: CountStep=1 sl@0: Multiplier=9.869604401 sl@0: Text=Hey, here's some text. sl@0: EventuallyExpectedError=KErrNone sl@0: St_Close2= sl@0: EndBlock3= sl@0: sl@0: