1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Add an extra IO-error test to windowfault.test.

FossilOrigin-Name: 5b8c44cd39c529e8adbc51f67088409e963515b988868856120a59e6c7160210
This commit is contained in:
dan
2019-03-30 17:07:23 +00:00
parent 038ebf6875
commit 0708054570
3 changed files with 69 additions and 8 deletions

View File

@ -162,4 +162,65 @@ do_faultsim_test 8 -faults oom-t* -prep {
faultsim_test_result {0 {1 2 5 6 9 10}}
}
#-------------------------------------------------------------------------
# The following test causes a cursor in REQURESEEK state to be passed
# to sqlite3BtreeDelete(). An error is simulated within the seek operation
# to restore the cursors position.
#
reset_db
set big [string repeat x 900]
do_execsql_test 9.0 {
PRAGMA page_size = 512;
PRAGMA cache_size = 2;
CREATE TABLE t(x INTEGER PRIMARY KEY, y TEXT);
WITH s(i) AS (
VALUES(1) UNION ALL SELECT i+1 FROM s WHERE i<1900
)
INSERT INTO t(y) SELECT $big FROM s;
}
db close
testvfs tvfs -default 1
tvfs script vfs_callback
tvfs filter xRead
sqlite3 db test.db
proc vfs_callback {method file args} {
if {$file=="" && [info exists ::tmp_read_fail]} {
incr ::tmp_read_fail -1
if {$::tmp_read_fail<=0} {
return "SQLITE_IOERR"
}
}
return "SQLITE_OK"
}
set FAULTSIM(tmpread) [list \
-injectstart tmpread_injectstart \
-injectstop tmpread_injectstop \
-injecterrlist {{1 {disk I/O error}}} \
]
proc tmpread_injectstart {iFail} {
set ::tmp_read_fail $iFail
}
proc tmpread_injectstop {} {
set ret [expr $::tmp_read_fail<=0]
unset -nocomplain ::tmp_read_fail
return $ret
}
do_faultsim_test 9 -end 25 -faults tmpread -body {
execsql {
SELECT sum(y) OVER win FROM t
WINDOW win AS (
ORDER BY x ROWS BETWEEN UNBOUNDED PRECEDING AND 1800 FOLLOWING
)
}
} -test {
faultsim_test_result {0 {}}
}
catch {db close}
tvfs delete
finish_test