OLD | NEW |
1 # 2014-01-20 | 1 # 2014-01-20 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
11 # | 11 # |
12 | 12 |
13 set testdir [file dirname $argv0] | 13 set testdir [file dirname $argv0] |
14 source $testdir/tester.tcl | 14 source $testdir/tester.tcl |
15 set testprefix corruptI | 15 set testprefix corruptI |
16 | 16 |
17 if {[permutation]=="mmap"} { | 17 if {[permutation]=="mmap"} { |
18 finish_test | 18 finish_test |
19 return | 19 return |
20 } | 20 } |
21 | 21 |
22 # Do not use a codec for tests in this file, as the database file is | 22 # This module uses hard-coded offsets which do not work if the reserved_bytes |
23 # manipulated directly using tcl scripts (using the [hexio_write] command). | 23 # value is nonzero. |
24 # | 24 if {[nonzero_reserved_bytes]} {finish_test; return;} |
25 do_not_use_codec | 25 |
26 database_may_be_corrupt | 26 database_may_be_corrupt |
27 | 27 |
28 # Initialize the database. | 28 # Initialize the database. |
29 # | 29 # |
30 do_execsql_test 1.1 { | 30 do_execsql_test 1.1 { |
31 PRAGMA page_size=1024; | 31 PRAGMA page_size=1024; |
32 PRAGMA auto_vacuum=0; | 32 PRAGMA auto_vacuum=0; |
33 CREATE TABLE t1(a); | 33 CREATE TABLE t1(a); |
34 CREATE INDEX i1 ON t1(a); | 34 CREATE INDEX i1 ON t1(a); |
35 INSERT INTO t1 VALUES('abcdefghijklmnop'); | 35 INSERT INTO t1 VALUES('abcdefghijklmnop'); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 PRAGMA page_size = 512; | 199 PRAGMA page_size = 512; |
200 PRAGMA auto_vacuum=0; | 200 PRAGMA auto_vacuum=0; |
201 CREATE TABLE t1(x); | 201 CREATE TABLE t1(x); |
202 INSERT INTO t1 VALUES(zeroblob(300)); | 202 INSERT INTO t1 VALUES(zeroblob(300)); |
203 INSERT INTO t1 VALUES(zeroblob(600)); | 203 INSERT INTO t1 VALUES(zeroblob(600)); |
204 } {} | 204 } {} |
205 do_test 6.1 { | 205 do_test 6.1 { |
206 db close | 206 db close |
207 hexio_write test.db 616 8FFFFFFF7F02 | 207 hexio_write test.db 616 8FFFFFFF7F02 |
208 sqlite3 db test.db | 208 sqlite3 db test.db |
209 breakpoint | |
210 execsql { DELETE FROM t1 WHERE rowid=2 } | 209 execsql { DELETE FROM t1 WHERE rowid=2 } |
211 } {} | 210 } {} |
212 | 211 |
213 #------------------------------------------------------------------------- | 212 #------------------------------------------------------------------------- |
214 # See what happens if the sqlite_master entry associated with a PRIMARY | 213 # See what happens if the sqlite_master entry associated with a PRIMARY |
215 # KEY or UNIQUE index is removed. | 214 # KEY or UNIQUE index is removed. |
216 # | 215 # |
217 reset_db | 216 reset_db |
218 do_execsql_test 7.0 { | 217 do_execsql_test 7.0 { |
219 PRAGMA auto_vacuum=0; | 218 PRAGMA auto_vacuum=0; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 } {1 {database disk image is malformed}} | 253 } {1 {database disk image is malformed}} |
255 | 254 |
256 do_test 8.2 { | 255 do_test 8.2 { |
257 db close | 256 db close |
258 sqlite3 db test.db | 257 sqlite3 db test.db |
259 execsql { PRAGMA integrity_check } | 258 execsql { PRAGMA integrity_check } |
260 } {/.*in database main.*/} | 259 } {/.*in database main.*/} |
261 | 260 |
262 | 261 |
263 finish_test | 262 finish_test |
OLD | NEW |