OLD | NEW |
1 # 2007 April 6 | 1 # 2007 April 6 |
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 # This file implements regression tests for SQLite library. | 11 # This file implements regression tests for SQLite library. |
12 # | 12 # |
13 # This file implements tests to make sure SQLite does not crash or | 13 # This file implements tests to make sure SQLite does not crash or |
14 # segfault if it sees a corrupt database file. | 14 # segfault if it sees a corrupt database file. |
15 # | 15 # |
16 # $Id: corrupt3.test,v 1.2 2007/04/06 21:42:22 drh Exp $ | 16 # $Id: corrupt3.test,v 1.2 2007/04/06 21:42:22 drh Exp $ |
17 | 17 |
18 set testdir [file dirname $argv0] | 18 set testdir [file dirname $argv0] |
19 source $testdir/tester.tcl | 19 source $testdir/tester.tcl |
20 | 20 |
21 # Do not use a codec for tests in this file, as the database file is | 21 # Do not use a codec for tests in this file, as the database file is |
22 # manipulated directly using tcl scripts (using the [hexio_write] command). | 22 # manipulated directly using tcl scripts (using the [hexio_write] command). |
23 # | 23 # |
24 do_not_use_codec | 24 do_not_use_codec |
25 | 25 |
| 26 # These tests deal with corrupt database files |
| 27 # |
| 28 database_may_be_corrupt |
| 29 |
26 # We must have the page_size pragma for these tests to work. | 30 # We must have the page_size pragma for these tests to work. |
27 # | 31 # |
28 ifcapable !pager_pragmas { | 32 ifcapable !pager_pragmas||direct_read { |
29 finish_test | 33 finish_test |
30 return | 34 return |
31 } | 35 } |
32 | 36 |
33 # Create a database with an overflow page. | 37 # Create a database with an overflow page. |
34 # | 38 # |
35 do_test corrupt3-1.1 { | 39 do_test corrupt3-1.1 { |
36 set bigstring [string repeat 0123456789 200] | 40 set bigstring [string repeat 0123456789 200] |
37 execsql { | 41 execsql { |
38 PRAGMA auto_vacuum=OFF; | 42 PRAGMA auto_vacuum=OFF; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } [list 1 {database disk image is malformed}] | 109 } [list 1 {database disk image is malformed}] |
106 do_test corrupt3-1.12 { | 110 do_test corrupt3-1.12 { |
107 catchsql { | 111 catchsql { |
108 PRAGMA integrity_check | 112 PRAGMA integrity_check |
109 } | 113 } |
110 } {0 {{*** in database main *** | 114 } {0 {{*** in database main *** |
111 On tree page 2 cell 0: 1 of 1 pages missing from overflow list starting at 0 | 115 On tree page 2 cell 0: 1 of 1 pages missing from overflow list starting at 0 |
112 Page 3 is never used}}} | 116 Page 3 is never used}}} |
113 | 117 |
114 finish_test | 118 finish_test |
OLD | NEW |