| OLD | NEW |
| 1 # 2008 May 6 | 1 # 2008 May 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. It specifically focuses | 14 # segfault if it sees a corrupt database file. It specifically focuses |
| 15 # on corrupt SerialTypeLen values. | 15 # on corrupt SerialTypeLen values. |
| 16 # | 16 # |
| 17 # $Id: corrupt6.test,v 1.2 2008/05/19 15:37:10 shane Exp $ | 17 # $Id: corrupt6.test,v 1.2 2008/05/19 15:37:10 shane Exp $ |
| 18 | 18 |
| 19 set testdir [file dirname $argv0] | 19 set testdir [file dirname $argv0] |
| 20 source $testdir/tester.tcl | 20 source $testdir/tester.tcl |
| 21 | 21 |
| 22 # Do not use a codec for tests in this file, as the database file is | 22 # Do not use a codec for tests in this file, as the database file is |
| 23 # manipulated directly using tcl scripts (using the [hexio_write] command). | 23 # manipulated directly using tcl scripts (using the [hexio_write] command). |
| 24 # | 24 # |
| 25 do_not_use_codec | 25 do_not_use_codec |
| 26 | 26 |
| 27 # These tests deal with corrupt database files |
| 28 # |
| 29 database_may_be_corrupt |
| 30 |
| 27 # We must have the page_size pragma for these tests to work. | 31 # We must have the page_size pragma for these tests to work. |
| 28 # | 32 # |
| 29 ifcapable !pager_pragmas { | 33 ifcapable !pager_pragmas { |
| 30 finish_test | 34 finish_test |
| 31 return | 35 return |
| 32 } | 36 } |
| 33 | 37 |
| 34 # Create a simple, small database. | 38 # Create a simple, small database. |
| 35 # | 39 # |
| 36 do_test corrupt6-1.1 { | 40 do_test corrupt6-1.1 { |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 do_test corrupt6-1.10.9 { | 251 do_test corrupt6-1.10.9 { |
| 248 db close | 252 db close |
| 249 hexio_write test.db 1923 FFFFFFFFFFFFFFFFFF7F | 253 hexio_write test.db 1923 FFFFFFFFFFFFFFFFFF7F |
| 250 sqlite3 db test.db | 254 sqlite3 db test.db |
| 251 catchsql { | 255 catchsql { |
| 252 SELECT substr(x,1,8) FROM t1 | 256 SELECT substr(x,1,8) FROM t1 |
| 253 } | 257 } |
| 254 } [list 1 {database disk image is malformed}] | 258 } [list 1 {database disk image is malformed}] |
| 255 | 259 |
| 256 finish_test | 260 finish_test |
| OLD | NEW |