OLD | NEW |
1 # 2013-08-01 | 1 # 2013-08-01 |
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 corruptG | 15 set testprefix corruptG |
16 | 16 |
17 # Do not use a codec for tests in this file, as the database file is | 17 # This module uses hard-coded offsets which do not work if the reserved_bytes |
18 # manipulated directly using tcl scripts (using the [hexio_write] command). | 18 # value is nonzero. |
19 # | 19 if {[nonzero_reserved_bytes]} {finish_test; return;} |
20 do_not_use_codec | |
21 | 20 |
22 # These tests deal with corrupt database files | 21 # These tests deal with corrupt database files |
23 # | 22 # |
24 database_may_be_corrupt | 23 database_may_be_corrupt |
25 | 24 |
26 # Create a simple database with a single entry. Then corrupt the | 25 # Create a simple database with a single entry. Then corrupt the |
27 # header-size varint on the index payload so that it maps into a | 26 # header-size varint on the index payload so that it maps into a |
28 # negative number. Try to use the database. | 27 # negative number. Try to use the database. |
29 # | 28 # |
30 | 29 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 hexio_write test.db [expr {$idxroot*512-15}] 0513ff7f01 | 66 hexio_write test.db [expr {$idxroot*512-15}] 0513ff7f01 |
68 sqlite3 db test.db | 67 sqlite3 db test.db |
69 | 68 |
70 do_test 2.1 { | 69 do_test 2.1 { |
71 catchsql { | 70 catchsql { |
72 SELECT rowid FROM t1 WHERE a='abc' and b='xyz123456789XYZ'; | 71 SELECT rowid FROM t1 WHERE a='abc' and b='xyz123456789XYZ'; |
73 } | 72 } |
74 } {1 {database disk image is malformed}} | 73 } {1 {database disk image is malformed}} |
75 | 74 |
76 finish_test | 75 finish_test |
OLD | NEW |