3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
12 # This file contains fault injection tests designed to test the btree.c
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18 source $testdir/malloc_common.tcl
19 set testprefix btreefault
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"} {
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;
41 faultsim_save_and_close
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]
50 execsql { PRAGMA incremental_vacuum = 10 }
52 sqlite3_finalize $::STMT
53 faultsim_test_result {0 {}}
54 faultsim_integrity_check