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 # The tests in this file test the pager modules response to various
13 # fault conditions (OOM, IO error, disk full etc.). They are similar
14 # to those in file pagerfault1.test.
16 # More specifically, the tests in this file are those deemed too slow to
17 # run as part of pagerfault1.test.
20 set testdir [file dirname $argv0]
21 source $testdir/tester.tcl
22 source $testdir/lock_common.tcl
23 source $testdir/malloc_common.tcl
25 if {[permutation] == "inmemory_journal"} {
30 sqlite3_memdebug_vfs_oom_test 0
32 set a_string_counter 1
34 global a_string_counter
36 string range [string repeat "${a_string_counter}." $n] 1 $n
38 db func a_string a_string
40 do_test pagerfault2-1-pre1 {
41 faultsim_delete_and_reopen
42 db func a_string a_string
44 PRAGMA auto_vacuum = 0;
45 PRAGMA journal_mode = DELETE;
46 PRAGMA page_size = 1024;
47 CREATE TABLE t1(a, b);
48 INSERT INTO t1 VALUES(a_string(401), a_string(402));
50 for {set ii 0} {$ii < 13} {incr ii} {
51 execsql { INSERT INTO t1 SELECT a_string(401), a_string(402) FROM t1 }
53 faultsim_save_and_close
57 do_faultsim_test pagerfault2-1 -faults oom-transient -prep {
58 faultsim_restore_and_reopen
59 sqlite3_db_config_lookaside db 0 256 4096
63 INSERT INTO t1 VALUES(5, 6);
65 UPDATE t1 SET a = a||'x' WHERE rowid<3700;
68 execsql { UPDATE t1 SET a = a||'x' WHERE rowid>=3700 AND rowid<=4200 }
69 execsql { ROLLBACK TO abc }
71 faultsim_test_result {0 {}}
74 do_test pagerfault2-2-pre1 {
75 faultsim_restore_and_reopen
76 execsql { DELETE FROM t1 }
77 faultsim_save_and_close
80 do_faultsim_test pagerfault2-2 -faults oom-transient -prep {
81 faultsim_restore_and_reopen
82 sqlite3_db_config_lookaside db 0 256 4096
83 db func a_string a_string
86 PRAGMA cache_size = 20;
88 INSERT INTO t1 VALUES(a_string(401), a_string(402));
92 execsql { INSERT INTO t1 VALUES (a_string(2000000), a_string(2500000)) }
94 faultsim_test_result {0 {}}
97 sqlite3_memdebug_vfs_oom_test 1