| OLD | NEW |
| 1 # 2015-03-30 | 1 # 2015-03-30 |
| 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 # Corruption consisting of a database page that thinks it is a child | 12 # Corruption consisting of a database page that thinks it is a child |
| 13 # of itself. | 13 # of itself. |
| 14 # | 14 # |
| 15 | 15 |
| 16 set testdir [file dirname $argv0] | 16 set testdir [file dirname $argv0] |
| 17 source $testdir/tester.tcl | 17 source $testdir/tester.tcl |
| 18 set testprefix corruptJ | 18 set testprefix corruptJ |
| 19 | 19 |
| 20 if {[permutation]=="mmap"} { | 20 if {[permutation]=="mmap"} { |
| 21 finish_test | 21 finish_test |
| 22 return | 22 return |
| 23 } | 23 } |
| 24 | 24 |
| 25 # Do not use a codec for tests in this file, as the database file is | 25 # This module uses hard-coded offsets which do not work if the reserved_bytes |
| 26 # manipulated directly using tcl scripts (using the [hexio_write] command). | 26 # value is nonzero. |
| 27 # | 27 if {[nonzero_reserved_bytes]} {finish_test; return;} |
| 28 do_not_use_codec | 28 |
| 29 database_may_be_corrupt | 29 database_may_be_corrupt |
| 30 | 30 |
| 31 # Initialize the database. | 31 # Initialize the database. |
| 32 # | 32 # |
| 33 do_execsql_test 1.1 { | 33 do_execsql_test 1.1 { |
| 34 PRAGMA page_size=1024; | 34 PRAGMA page_size=1024; |
| 35 PRAGMA auto_vacuum=0; | 35 PRAGMA auto_vacuum=0; |
| 36 CREATE TABLE t1(a,b); | 36 CREATE TABLE t1(a,b); |
| 37 WITH RECURSIVE c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<10) | 37 WITH RECURSIVE c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<10) |
| 38 INSERT INTO t1(a,b) SELECT i, zeroblob(700) FROM c; | 38 INSERT INTO t1(a,b) SELECT i, zeroblob(700) FROM c; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 db close | 71 db close |
| 72 hexio_read test.db [expr {9*1024+391}] 8 | 72 hexio_read test.db [expr {9*1024+391}] 8 |
| 73 } {00000008814D0401} | 73 } {00000008814D0401} |
| 74 do_test 2.2b { | 74 do_test 2.2b { |
| 75 hexio_write test.db [expr {9*1024+391}] 00000002 | 75 hexio_write test.db [expr {9*1024+391}] 00000002 |
| 76 sqlite3 db test.db | 76 sqlite3 db test.db |
| 77 catchsql { PRAGMA secure_delete=ON; DROP TABLE t1; } | 77 catchsql { PRAGMA secure_delete=ON; DROP TABLE t1; } |
| 78 } {1 {database disk image is malformed}} | 78 } {1 {database disk image is malformed}} |
| 79 | 79 |
| 80 finish_test | 80 finish_test |
| OLD | NEW |