Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add test file incrvacuum3.test. No code changes. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | incr-vacuum-opt |
Files: | files | file ages | folders |
SHA1: |
bf57534188e044fb341315bfc05b7927 |
User & Date: | dan 2013-02-25 12:06:55.032 |
Context
2013-02-25
| ||
13:31 | Merge the incr-vacuum-opt branch with the trunk. (check-in: 26e235b7a4 user: dan tags: trunk) | |
12:06 | Add test file incrvacuum3.test. No code changes. (Closed-Leaf check-in: bf57534188 user: dan tags: incr-vacuum-opt) | |
07:12 | Catch a dropped error code in backup.c. (check-in: ac8ca3ecee user: dan tags: incr-vacuum-opt) | |
Changes
Added test/incrvacuum3.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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | # 2013 Feb 25 # # 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. # #*********************************************************************** # This file implements regression tests for the SQLite library, focusing # on the incremental vacuum feature. # # The tests in this file were added at the same time as optimizations # were made to: # # * Truncate the database after a rollback mode commit, and # # * Avoid moving pages to locations from which they may need to be moved # a second time if an incremental-vacuum proccess is allowed to vacuum # the entire database. # set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix incrvacuum3 # If this build of the library does not support auto-vacuum, omit this # whole file. ifcapable {!autovacuum || !pragma} { finish_test return } proc check_on_disk {} { # Copy the files for database "test.db" to "test2.db". forcedelete test2.db test2.db-journal test2.db-wal forcecopy test.db test2.db if {[file exists test.db-journal]} { forcecopy test.db-journal test2.db-journal } if {[file exists test.db-wal]} { forcecopy test.db-wal test2.db-wal } # Open "test2.db" and check it is Ok. sqlite3 dbcheck test2.db set ret [dbcheck eval { PRAGMA integrity_check }] dbcheck close set ret } # Run these tests once in rollback journal mode, and once in wal mode. # foreach {T jrnl_mode} { 1 delete 2 wal } { catch { db close } forcedelete test.db test.db-journal test.db-wal sqlite3 db test.db db eval { PRAGMA cache_size = 5; PRAGMA page_size = 1024; PRAGMA auto_vacuum = 2; } db eval "PRAGMA journal_mode = $jrnl_mode" foreach {tn sql} { 1 { CREATE TABLE t1(x UNIQUE); INSERT INTO t1 VALUES(randomblob(400)); INSERT INTO t1 VALUES(randomblob(400)); INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 4 INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 8 INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 16 INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 32 INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 64 INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 128 INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 256 } 2 { DELETE FROM t1 WHERE rowid%8; } 3 { BEGIN; PRAGMA incremental_vacuum = 100; INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 64 INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 128 INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 256 ROLLBACK; } 4 { BEGIN; SAVEPOINT one; PRAGMA incremental_vacuum = 100; SAVEPOINT two; INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 64 INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 128 INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 256 } 5 { ROLLBACK to two } 6 { ROLLBACK to one } 7 { INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 64 PRAGMA incremental_vacuum = 1000; INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 128 INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 256 ROLLBACK; } 8 { BEGIN; INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 64 PRAGMA incremental_vacuum = 1000; INSERT INTO t1 SELECT randomblob(400) FROM t1; -- 128 COMMIT; } } { do_execsql_test $T.1.$tn.1 $sql do_execsql_test $T.1.$tn.2 {PRAGMA integrity_check} ok do_test $T.1.$tn.3 { check_on_disk } ok } do_execsql_test $T.1.x.1 { PRAGMA freelist_count } 0 do_execsql_test $T.1.x.2 { SELECT count(*) FROM t1 } 128 } finish_test |