1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Add fault-injection tests for the new code on this branch.

FossilOrigin-Name: 349b2d895752c087dae7b7019bc10ac21852309e96dbc5f29cd902d080421f83
This commit is contained in:
dan
2024-10-29 20:27:12 +00:00
parent 2e7fcc4162
commit a2c52fcaca
3 changed files with 73 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
C Allow\sread-only\sconnections\sto\signore\shot\sjournals\screated\sby\s"PRAGMA\sjournal_mode\s=\swal".
D 2024-10-29T19:34:58.292
C Add\sfault-injection\stests\sfor\sthe\snew\scode\son\sthis\sbranch.
D 2024-10-29T20:27:12.839
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md c5b4009dca54d127d2d6033c22fd9cc34f53bedb6ef12c7cbaa468381c74ab28
@@ -1551,6 +1551,7 @@ F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736
F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8
F test/readonly.test 69a7ccec846cad2e000b3539d56360d02f327061dc5e41f7f9a3e01f19719952
F test/readonly2.test df7b572df01a0f773bb7b6e64bd8c98a55cb3099b4ffd054a44319c5f7e87f14
F test/readonlyfault.test a96653369f6c2912ccf9d18a43fe82dcb8b19bdbb3e9871ed76325ebea755fd1
F test/recover.test a163a156ea9f2beea63fa83c4dcd8dea6e57b8a569fc647155e3d2754eaac1b5
F test/regexp1.test 8f2a8bc1569666e29a4cee6c1a666cd224eb6d50e2470d1dc1df995170f3e0f1
F test/regexp2.test 55ed41da802b0e284ac7e2fe944be3948f93ff25abbca0361a609acfed1368b5
@@ -2199,11 +2200,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P decc60034849c232a05c8eb93ff0c6a5d6a48336d960771ed096d89633a9d0e2
R b458c57cdc073a8cbc08997978169801
T *branch * readonly-ignore-wal-jrnl
T *sym-readonly-ignore-wal-jrnl *
T -sym-trunk *
P d003480db7443025cfd2227096fd929454e9243d5f393f296b74f9bdad15d396
R 90a9a0e8b17e5b79825f8d5c457cd6a8
U dan
Z 5e2548d07e7a74989e8031dcc6402807
Z e756bc3964111f499ec65a7f126bb3a0
# Remove this line to create a well-formed Fossil manifest.

View File

@@ -1 +1 @@
d003480db7443025cfd2227096fd929454e9243d5f393f296b74f9bdad15d396
349b2d895752c087dae7b7019bc10ac21852309e96dbc5f29cd902d080421f83

66
test/readonlyfault.test Normal file
View File

@@ -0,0 +1,66 @@
# 2024 October 30
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set ::testprefix readonlyfault
testvfs tvfs -default 1
tvfs script at_vfs_callback
tvfs filter {xDelete}
set ::delete_shall_fail 0
proc at_vfs_callback {method file z args} {
if {$::delete_shall_fail} {
return "SQLITE_IOERR"
}
return "SQLITE_OK"
}
reset_db
do_execsql_test 1.0 {
BEGIN;
CREATE TABLE t1(a, b);
INSERT INTO t1 VALUES(1, 2), (3, 4), (5, 6);
COMMIT;
}
set ::delete_shall_fail 1
do_catchsql_test 1.1 {
PRAGMA journal_mode = wal;
} {1 {disk I/O error}}
do_test 1.2 {
file exists test.db-journal
} 1
db_save_and_close
# Injecting CANTOPEN errors doesn't work here. If such an error occurs
# while trying to open a potentially hot journal to inspect its contents,
# the error is ignored and the journal assumed to be hot. Leading to an
# SQLITE_READONLY error. So only the other types of fault-injection are
# tested here.
#
do_faultsim_test readonlyfault-1 -faults {oom* ioerr* inter* full*} -prep {
catch { db close }
db_restore
sqlite3 db test.db -readonly 1
} -body {
execsql { SELECT count(*), sum(a), sum(b) FROM t1 }
} -test {
faultsim_test_result {0 {3 9 12}}
}
finish_test