aboutsummaryrefslogtreecommitdiff
path: root/test/pagerfault2.test
diff options
context:
space:
mode:
authordan <dan@noemail.net>2010-07-02 11:27:43 +0000
committerdan <dan@noemail.net>2010-07-02 11:27:43 +0000
commitc396d4af5873b4e49399c7170b913b6632ae124b (patch)
tree2bf4a735562599e241dec8187af68e3367ba69f0 /test/pagerfault2.test
parentb2961b00f37e46289fb0cb4d742141513a4ee5ec (diff)
downloadsqlite-c396d4af5873b4e49399c7170b913b6632ae124b.tar.gz
sqlite-c396d4af5873b4e49399c7170b913b6632ae124b.zip
Additional test cases to cover branches in pager.c.
FossilOrigin-Name: eddfb2b4062f8a8b907f0c7bc08a05c16692e900
Diffstat (limited to 'test/pagerfault2.test')
-rw-r--r--test/pagerfault2.test47
1 files changed, 37 insertions, 10 deletions
diff --git a/test/pagerfault2.test b/test/pagerfault2.test
index 634e539e6..edc24bda7 100644
--- a/test/pagerfault2.test
+++ b/test/pagerfault2.test
@@ -22,6 +22,8 @@ source $testdir/tester.tcl
source $testdir/lock_common.tcl
source $testdir/malloc_common.tcl
+sqlite3_memdebug_vfs_oom_test 0
+
set a_string_counter 1
proc a_string {n} {
global a_string_counter
@@ -30,37 +32,62 @@ proc a_string {n} {
}
db func a_string a_string
-
-# The following tests, pagerfault2-1.*, attempt to provoke OOM errors when
-# manipulating the internal "bitvec" structures. Since bitvec structures
-# only allocate memory very rarely, this requires fairly large databases.
-#
do_test pagerfault2-1-pre1 {
faultsim_delete_and_reopen
db func a_string a_string
execsql {
PRAGMA journal_mode = DELETE;
+ PRAGMA page_size = 1024;
CREATE TABLE t1(a, b);
INSERT INTO t1 VALUES(a_string(401), a_string(402));
}
- for {set ii 0} {$ii < 14} {incr ii} {
+ for {set ii 0} {$ii < 13} {incr ii} {
execsql { INSERT INTO t1 SELECT a_string(401), a_string(402) FROM t1 }
}
faultsim_save_and_close
-} {}
-do_faultsim_test pagerfault2-1.1 -faults oom* -prep {
+ file size test.db
+} [expr 1024 * 8268]
+
+do_faultsim_test pagerfault2-1 -faults oom-transient -prep {
faultsim_restore_and_reopen
+ sqlite3_db_config_lookaside db 0 256 4096
execsql {
BEGIN;
+ SELECT * FROM t1;
INSERT INTO t1 VALUES(5, 6);
SAVEPOINT abc;
- UPDATE t1 SET a = a||'x';
+ UPDATE t1 SET a = a||'x' WHERE rowid<3700;
}
} -body {
+ execsql { UPDATE t1 SET a = a||'x' WHERE rowid>=3700 AND rowid<=4200 }
execsql { ROLLBACK TO abc }
} -test {
faultsim_test_result {0 {}}
- faultsim_integrity_check
}
+do_test pagerfault2-2-pre1 {
+ faultsim_restore_and_reopen
+ execsql { DELETE FROM t1 }
+ faultsim_save_and_close
+} {}
+
+do_faultsim_test pagerfault2-2 -faults oom-transient -prep {
+ faultsim_restore_and_reopen
+ sqlite3_db_config_lookaside db 0 256 4096
+ db func a_string a_string
+
+ execsql {
+ PRAGMA cache_size = 20;
+ BEGIN;
+ INSERT INTO t1 VALUES(a_string(401), a_string(402));
+ SAVEPOINT abc;
+ }
+} -body {
+ execsql { INSERT INTO t1 VALUES (a_string(2000000), a_string(2500000)) }
+} -test {
+ faultsim_test_result {0 {}}
+}
+
+sqlite3_memdebug_vfs_oom_test 1
finish_test
+