OLD | NEW |
(Empty) | |
| 1 # 2013 April 02 |
| 2 # |
| 3 # The author disclaims copyright to this source code. In place of |
| 4 # a legal notice, here is a blessing: |
| 5 # |
| 6 # May you do good and not evil. |
| 7 # May you find forgiveness for yourself and forgive others. |
| 8 # May you share freely, never taking more than you give. |
| 9 # |
| 10 #*********************************************************************** |
| 11 # |
| 12 # This file contains fault injection tests designed to test the btree.c |
| 13 # module. |
| 14 # |
| 15 |
| 16 set testdir [file dirname $argv0] |
| 17 source $testdir/tester.tcl |
| 18 source $testdir/malloc_common.tcl |
| 19 set testprefix btreefault |
| 20 |
| 21 # This test will not work with an in-memory journal, as the database will |
| 22 # become corrupt if an error is injected into a transaction after it starts |
| 23 # writing data out to the db file. |
| 24 if {[permutation]=="inmemory_journal"} { |
| 25 finish_test |
| 26 return |
| 27 } |
| 28 |
| 29 do_test 1-pre1 { |
| 30 execsql { |
| 31 PRAGMA auto_vacuum = incremental; |
| 32 PRAGMA journal_mode = DELETE; |
| 33 CREATE TABLE t1(a PRIMARY KEY, b); |
| 34 INSERT INTO t1 VALUES(randomblob(1000), randomblob(100)); |
| 35 INSERT INTO t1 SELECT randomblob(1000), randomblob(1000) FROM t1; |
| 36 INSERT INTO t1 SELECT randomblob(1000), randomblob(1000) FROM t1; |
| 37 INSERT INTO t1 SELECT randomblob(1000), randomblob(1000) FROM t1; |
| 38 INSERT INTO t1 SELECT randomblob(1000), randomblob(1000) FROM t1; |
| 39 DELETE FROM t1 WHERE rowid%2; |
| 40 } |
| 41 faultsim_save_and_close |
| 42 } {} |
| 43 |
| 44 do_faultsim_test 1 -prep { |
| 45 faultsim_restore_and_reopen |
| 46 set ::STMT [sqlite3_prepare db "SELECT * FROM t1 ORDER BY a" -1 DUMMY] |
| 47 sqlite3_step $::STMT |
| 48 sqlite3_step $::STMT |
| 49 } -body { |
| 50 execsql { PRAGMA incremental_vacuum = 10 } |
| 51 } -test { |
| 52 sqlite3_finalize $::STMT |
| 53 faultsim_test_result {0 {}} |
| 54 faultsim_integrity_check |
| 55 } |
| 56 |
| 57 finish_test |
OLD | NEW |