Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add a test case to test corruption discovered as part of the ptrmapPut() routine. (CVS 5351) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
cbb9536fc4fb2419e0eb6f3a32c67eeb |
User & Date: | danielk1977 2008-07-07 15:39:11.000 |
Context
2008-07-07
| ||
17:04 | Another test case to test a specific kind of database corruption. (CVS 5352) (check-in: 38e04d6763 user: danielk1977 tags: trunk) | |
15:39 | Add a test case to test corruption discovered as part of the ptrmapPut() routine. (CVS 5351) (check-in: cbb9536fc4 user: danielk1977 tags: trunk) | |
14:56 | Test a couple of specific malloc() failures that were not tested before. (CVS 5350) (check-in: b96bcaa197 user: danielk1977 tags: trunk) | |
Changes
Changes to test/corrupt2.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to make sure SQLite does not crash or # segfault if it sees a corrupt database file. # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to make sure SQLite does not crash or # segfault if it sees a corrupt database file. # # $Id: corrupt2.test,v 1.6 2008/07/07 15:39:11 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # The following tests - corrupt2-1.* - create some databases corrupted in # specific ways and ensure that SQLite detects them as corrupt. # |
︙ | ︙ | |||
123 124 125 126 127 128 129 130 131 132 133 134 135 | PRAGMA writable_schema = 0; } db2 db2 close sqlite3 db2 corrupt.db catchsql { SELECT * FROM sqlite_master; } db2 } {1 {malformed database schema (a3) - index a3 already exists}} db2 close finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | PRAGMA writable_schema = 0; } db2 db2 close sqlite3 db2 corrupt.db catchsql { SELECT * FROM sqlite_master; } db2 } {1 {malformed database schema (a3) - index a3 already exists}} db2 close do_test corrupt2-3.1 { file delete -force corrupt.db file delete -force corrupt.db-journal sqlite3 db2 corrupt.db execsql { PRAGMA auto_vacuum = 1; PRAGMA page_size = 1024; CREATE TABLE t1(a, b, c); CREATE TABLE t2(a, b, c); INSERT INTO t2 VALUES(randomblob(100), randomblob(100), randomblob(100)); INSERT INTO t2 SELECT * FROM t2; INSERT INTO t2 SELECT * FROM t2; INSERT INTO t2 SELECT * FROM t2; INSERT INTO t2 SELECT * FROM t2; } db2 db2 close # On the root page of table t2 (page 4), set one of the child page-numbers # to 0. This corruption will be detected when SQLite attempts to update # the pointer-map after moving the content of page 4 to page 3 as part # of the DROP TABLE operation below. # set fd [open corrupt.db r+] fconfigure $fd -encoding binary -translation binary seek $fd [expr 1024*3 + 12] set zCelloffset [read $fd 2] binary scan $zCelloffset S iCelloffset seek $fd [expr 1024*3 + $iCelloffset] puts -nonewline $fd "\00\00\00\00" close $fd sqlite3 db2 corrupt.db catchsql { DROP TABLE t1; } db2 } {1 {malformed database schema (a3) - index a3 already exists}} db2 close finish_test |