Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add the tests that go with the previous commit. (CVS 4258) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
a87f32e13e91250ab4d9366d2e9a3a70 |
User & Date: | danielk1977 2007-08-21 13:30:07.000 |
Context
2007-08-21
| ||
13:51 | Remove the obsolete static mutexes. Use only the lastest static mutex code. (CVS 4259) (check-in: 6225cd461c user: drh tags: trunk) | |
13:30 | Add the tests that go with the previous commit. (CVS 4258) (check-in: a87f32e13e user: danielk1977 tags: trunk) | |
13:11 | Avoid journalling an extra page when a btree insert operation uses the 'quick-balance' trick. (CVS 4257) (check-in: 0da4820914 user: danielk1977 tags: trunk) | |
Changes
Added test/io.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | # 2007 August 21 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # # The focus of this file is testing some specific characteristics of the # IO traffic generated by SQLite (making sure SQLite is not writing out # more database pages than it has to, stuff like that). # # $Id: io.test,v 1.1 2007/08/21 13:30:07 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl set ::nWrite 0 proc nWrite {db} { set bt [btree_from_db $db] array set stats [btree_pager_stats $bt] set res [expr $stats(write) - $::nWrite] set ::nWrite $stats(write) set res } do_test io-1.1 { execsql { PRAGMA page_size = 1024; CREATE TABLE abc(a,b); } nWrite db } {2} # Insert into the table 4 records of aproximately 240 bytes each. # This should completely fill the root-page of the table. Each # INSERT causes 2 db pages to be written - the root-page of "abc" # and page 1 (db change-counter page). do_test io-1.2 { set ret [list] execsql { INSERT INTO abc VALUES(1,randstr(230,230)); } lappend ret [nWrite db] execsql { INSERT INTO abc VALUES(2,randstr(230,230)); } lappend ret [nWrite db] execsql { INSERT INTO abc VALUES(3,randstr(230,230)); } lappend ret [nWrite db] execsql { INSERT INTO abc VALUES(4,randstr(230,230)); } lappend ret [nWrite db] } {2 2 2 2} # Insert another 240 byte record. This causes two leaf pages # to be added to the root page of abc. 4 pages in total # are written to the db file - the two leaf pages, the root # of abc and the change-counter page. do_test io-1.3 { execsql { INSERT INTO abc VALUES(5,randstr(230,230)); } nWrite db } {4} # Insert another 3 240 byte records. After this, the tree consists of # the root-node, which is close to empty, and two leaf pages, both of # which are full. do_test io-1.4 { set ret [list] execsql { INSERT INTO abc VALUES(6,randstr(230,230)); } lappend ret [nWrite db] execsql { INSERT INTO abc VALUES(7,randstr(230,230)); } lappend ret [nWrite db] execsql { INSERT INTO abc VALUES(8,randstr(230,230)); } lappend ret [nWrite db] } {2 2 2} #db eval {select * from sqlite_master} {btree_tree_dump [btree_from_db db] 2} # This insert should use the quick-balance trick to add a third leaf # to the b-tree used to store table abc. It should only be necessary to # write to 3 pages to do this: the change-counter, the root-page and # the new leaf page. do_test io-1.5 { execsql { INSERT INTO abc VALUES(9,randstr(230,230)); } nWrite db } {3} #db eval {select * from sqlite_master} {btree_tree_dump [btree_from_db db] 2} finish_test |