| OLD | NEW |
| 1 # 2004 August 30 | 1 # 2004 August 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 #*********************************************************************** |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 db close | 182 db close |
| 183 forcecopy test.bu test.db | 183 forcecopy test.bu test.db |
| 184 | 184 |
| 185 # insert corrupt byte(s) | 185 # insert corrupt byte(s) |
| 186 hexio_write test.db 3074 [format %02x 0xa0] | 186 hexio_write test.db 3074 [format %02x 0xa0] |
| 187 | 187 |
| 188 sqlite3 db test.db | 188 sqlite3 db test.db |
| 189 catchsql {BEGIN; UPDATE t2 SET y='abcdef-uvwxyz'; ROLLBACK;} | 189 catchsql {BEGIN; UPDATE t2 SET y='abcdef-uvwxyz'; ROLLBACK;} |
| 190 } {1 {database disk image is malformed}} | 190 } {1 {database disk image is malformed}} |
| 191 | 191 |
| 192 |
| 192 # corruption (seed 179069) | 193 # corruption (seed 179069) |
| 194 # Obsolete. With single-pass DELETE the corruption in the |
| 195 # main database is not detected. |
| 196 if 0 { |
| 193 do_test corruptC-2.8 { | 197 do_test corruptC-2.8 { |
| 194 db close | 198 db close |
| 195 forcecopy test.bu test.db | 199 forcecopy test.bu test.db |
| 196 | 200 |
| 197 # insert corrupt byte(s) | 201 # insert corrupt byte(s) |
| 198 hexio_write test.db 1393 [format %02x 0x7d] | 202 hexio_write test.db 1393 [format %02x 0x7d] |
| 199 hexio_write test.db 84 [format %02x 0x19] | 203 hexio_write test.db 84 [format %02x 0x19] |
| 200 hexio_write test.db 3287 [format %02x 0x3b] | 204 hexio_write test.db 3287 [format %02x 0x3b] |
| 201 hexio_write test.db 2564 [format %02x 0xed] | 205 hexio_write test.db 2564 [format %02x 0xed] |
| 202 hexio_write test.db 2139 [format %02x 0x55] | 206 hexio_write test.db 2139 [format %02x 0x55] |
| 203 | 207 |
| 204 sqlite3 db test.db | 208 sqlite3 db test.db |
| 205 catchsql {BEGIN; DELETE FROM t1 WHERE x>13; ROLLBACK;} | 209 catchsql {BEGIN; DELETE FROM t1 WHERE x>13; ROLLBACK;} |
| 206 } {1 {database disk image is malformed}} | 210 } {1 {database disk image is malformed}} |
| 211 } |
| 207 | 212 |
| 208 # corruption (seed 170434) | 213 # corruption (seed 170434) |
| 209 # | 214 # |
| 210 # UPDATE: Prior to 3.8.2, this used to return SQLITE_CORRUPT. It no longer | 215 # UPDATE: Prior to 3.8.2, this used to return SQLITE_CORRUPT. It no longer |
| 211 # does. That is Ok, the point of these tests is to verify that no buffer | 216 # does. That is Ok, the point of these tests is to verify that no buffer |
| 212 # overruns or overreads can be caused by corrupt databases. | 217 # overruns or overreads can be caused by corrupt databases. |
| 213 do_test corruptC-2.9 { | 218 do_test corruptC-2.9 { |
| 214 db close | 219 db close |
| 215 forcecopy test.bu test.db | 220 forcecopy test.bu test.db |
| 216 | 221 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 290 |
| 286 # At one point this particular corrupt database was causing a buffer | 291 # At one point this particular corrupt database was causing a buffer |
| 287 # overread. Which caused a crash in a run of all.test once. | 292 # overread. Which caused a crash in a run of all.test once. |
| 288 # | 293 # |
| 289 do_test corruptC-2.15 { | 294 do_test corruptC-2.15 { |
| 290 db close | 295 db close |
| 291 forcecopy test.bu test.db | 296 forcecopy test.bu test.db |
| 292 hexio_write test.db 986 b9 | 297 hexio_write test.db 986 b9 |
| 293 sqlite3 db test.db | 298 sqlite3 db test.db |
| 294 catchsql {SELECT count(*) FROM sqlite_master;} | 299 catchsql {SELECT count(*) FROM sqlite_master;} |
| 295 } {1 {malformed database schema (t1i1) - no such table: main.t1}} | 300 } {1 {database disk image is malformed}} |
| 296 | 301 |
| 297 # | 302 # |
| 298 # Now test for a series of quasi-random seeds. | 303 # Now test for a series of quasi-random seeds. |
| 299 # We loop over the entire file size and touch | 304 # We loop over the entire file size and touch |
| 300 # each byte at least once. | 305 # each byte at least once. |
| 301 for {set tn 0} {$tn<$fsize} {incr tn 1} { | 306 for {set tn 0} {$tn<$fsize} {incr tn 1} { |
| 302 | 307 |
| 303 # setup for test | 308 # setup for test |
| 304 db close | 309 db close |
| 305 forcecopy test.bu test.db | 310 forcecopy test.bu test.db |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 set stats(ref) | 411 set stats(ref) |
| 407 } {0} | 412 } {0} |
| 408 } | 413 } |
| 409 } | 414 } |
| 410 # end for i | 415 # end for i |
| 411 | 416 |
| 412 } | 417 } |
| 413 # end for tn | 418 # end for tn |
| 414 | 419 |
| 415 finish_test | 420 finish_test |
| OLD | NEW |