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 #***********************************************************************
13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl
15 source $testdir/malloc_common.tcl
16 set ::testprefix ioerr6
18 ifcapable !atomicwrite {
19 puts "skipping tests - not compiled with SQLITE_ENABLE_ATOMIC_WRITE..."
24 if {[permutation]=="inmemory_journal"} {
25 # These tests will not work with in-memory journals (as persistent VFS
26 # errors commencing after a transaction has started to write to the db
27 # cannot be recovered from).
32 faultsim_save_and_close
35 testvfs shmfault -default true
36 shmfault devchar atomic
39 CREATE TABLE t1(a, b);
40 CREATE INDEX i1 ON t1(a, b);
41 INSERT INTO t1 VALUES(1, 2);
42 INSERT INTO t1 VALUES(2, 4);
43 INSERT INTO t1 VALUES(3, 6);
44 INSERT INTO t1 VALUES(4, 8);
47 # Cause the first call to xWrite() to fail with SQLITE_FULL.
49 catchsql { INSERT INTO t1 VALUES(5, 10) }
50 } {1 {database or disk is full}}
53 execsql { PRAGMA integrity_check }
59 do_faultsim_test 2 -faults full* -prep {
60 shmfault devchar atomic
65 CREATE TABLE t1(x PRIMARY KEY);
66 INSERT INTO t1 VALUES('abc');
69 set res [db one { PRAGMA integrity_check }]
71 error "integrity check: $res"
75 do_faultsim_test 3 -faults full* -prep {
76 shmfault devchar atomic
85 db eval { CREATE TABLE t3(x) }
86 if {[db one { PRAGMA integrity_check }] != "ok"} {
87 error "integrity check failed"