Add a few more test cases to walfault2.test and walvfs.test.

FossilOrigin-Name: 3873941c4fb9aa2d0de1129722c5fcdf2be1ea261677d4841ed99f896c778459
This commit is contained in:
dan 2018-12-24 20:00:27 +00:00
parent 1ab76166e3
commit 92107a38dc
5 changed files with 132 additions and 8 deletions

View File

@ -1,5 +1,5 @@
C Change\sanother\sfts5\sassert()\sthat\smay\sfail\swith\sa\scorrupt\sdatabase\sto\san\nassert_nc().
D 2018-12-24T19:59:37.185
C Add\sa\sfew\smore\stest\scases\sto\swalfault2.test\sand\swalvfs.test.
D 2018-12-24T20:00:27.352
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in d8b254f8bb81bab43c340d70d17dc3babab40fcc8a348c8255881f780a45fee6
@ -1187,7 +1187,7 @@ F test/parser1.test 6ccdf5e459a5dc4673d3273dc311a7e9742ca952dd0551a6a6320d27035c
F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
F test/permutations.test 1f244543fbf05f3ef9a4596d7e7fe5d832b6d973c53a87189515e3c15db562a5
F test/permutations.test 49b90ca9cebc3faed41ef6c7265067a1ee672b5199ed8765225cd95deb06974f
F test/pg_common.tcl 301ac19c1a52fd55166d26db929b3b89165c634d52b5f8ad76ea8cb06960db30
F test/pragma.test c267bf02742c823a191960895b3d52933cebd7beee26757d1ed694f213fcd867
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
@ -1620,6 +1620,7 @@ F test/walcrash2.test a0edab4e5390f03b99a790de89aad15d6ec70b36
F test/walcrash3.test e426aa58122d20f2b9fbe9a507f9eb8cab85b8af
F test/walcrash4.test e7b6e7639a950a0cca8e210e248c8dad4d63bf20
F test/walfault.test 09b8ad7e52d2f54bce50e31aa7ea51412bb9f70ac13c74e669ddcd8b48b0d98d
F test/walfault2.test 39337e9ca6906b3942734ab212e099edd7d331b2819a04dbf3b2bd4d58526251
F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483
F test/walmode.test cd6e7cff618eaaa5910ce57c3657aa50110397f86213886a2400afb9bfec7b7b
F test/walnoshm.test 84ca10c544632a756467336b7c3b864d493ee496
@ -1633,7 +1634,7 @@ F test/walrofault.test c70cb6e308c443867701856cce92ad8288cd99488fa52afab77cca6cf
F test/walshared.test 0befc811dcf0b287efae21612304d15576e35417
F test/walslow.test c05c68d4dc2700a982f89133ce103a1a84cc285f
F test/walthread.test 14b20fcfa6ae152f5d8e12f5dc8a8a724b7ef189f5d8ef1e2ceab79f2af51747
F test/walvfs.test 355811484f6da8f0cc32778ccfcbc2f1cc75bd885a485342b58fe87646407f96
F test/walvfs.test 238920d258d5aa9327a08d61721c3f12273c821c2f537d7e91f21982f86f65e6
F test/where.test 8215d220633f08da331781cf9ede7fb7aed50eb113473c10acd39a643fd258ba
F test/where2.test 478d2170637b9211f593120648858593bf2445a1
F test/where3.test 2341a294e17193a6b1699ea7f192124a5286ca6acfcc3f4b06d16c931fbcda2c
@ -1793,7 +1794,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P d697f6f3ca47350dad30feb529914fc5254fa662ece783408eea963d912918c1
R 3c7313fa057dadacd384e353fe22ea21
P d9653380c455b4bf6c371540d677cbde6d17664c58662b5cc9a12929f46192dd
R 8084d1f63750192ff38dba4baa2ddb3e
U dan
Z 611bd75ee9b98c63ce75ad63dacb80c1
Z 41ec1577a2156dcf228a3208b45a039a

View File

@ -1 +1 @@
d9653380c455b4bf6c371540d677cbde6d17664c58662b5cc9a12929f46192dd
3873941c4fb9aa2d0de1129722c5fcdf2be1ea261677d4841ed99f896c778459

View File

@ -437,6 +437,7 @@ test_suite "coverage-wal" -description {
walmode.test walnoshm.test waloverwrite.test walpersist.test
walprotocol2.test walprotocol.test walro2.test walrofault.test
walro.test walshared.test walslow.test walvfs.test
walfault2.test
nockpt.test
}

90
test/walfault2.test Normal file
View File

@ -0,0 +1,90 @@
# 2010 May 03
#
# 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.
#
#***********************************************************************
# This file implements regression tests for SQLite library. The
# focus of this file is testing the operation of the library in
# "PRAGMA journal_mode=WAL" mode.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/malloc_common.tcl
source $testdir/lock_common.tcl
ifcapable !wal {finish_test ; return }
set testprefix walfault2
#-------------------------------------------------------------------------
# Inject faults while truncating the wal file.
#
do_execsql_test 1.0 {
PRAGMA auto_vacuum = 0;
CREATE TABLE t1(a, b);
PRAGMA journal_mode = wal;
WITH s(i) AS (
SELECT 1 UNION ALL SELECT i+1 FROM s LIMIT 30
)
INSERT INTO t1 SELECT randomblob(400), randomblob(400) FROM s;
} {wal}
faultsim_save_and_close
do_faultsim_test 1 -prep {
faultsim_restore
sqlite3 db file:test.db?psow=0 -uri 1
file_control_powersafe_overwrite db 0
execsql {
PRAGMA wal_checkpoint;
PRAGMA journal_size_limit = 10000;
PRAGMA synchronous = full;
}
} -body {
execsql { INSERT INTO t1 VALUES(1,1) }
} -test {
faultsim_test_result {0 {}}
}
#-------------------------------------------------------------------------
# Inject faults while rewriting checksums.
#
reset_db
do_execsql_test 2.0 {
PRAGMA auto_vacuum = 0;
CREATE TABLE t1(a, b);
PRAGMA journal_mode = wal;
WITH s(i) AS (
SELECT 1 UNION ALL SELECT i+1 FROM s LIMIT 30
)
INSERT INTO t1 SELECT randomblob(400), randomblob(400) FROM s;
} {wal}
faultsim_save_and_close
do_faultsim_test 2 -prep {
faultsim_restore_and_reopen
execsql {
PRAGMA cache_size = 2;
BEGIN;
UPDATE t1 SET a=randomblob(400);
UPDATE t1 SET b=randomblob(400);
UPDATE t1 SET a=randomblob(400);
UPDATE t1 SET b=randomblob(400);
UPDATE t1 SET a=randomblob(400);
UPDATE t1 SET b=randomblob(400);
UPDATE t1 SET a=randomblob(400);
UPDATE t1 SET b=randomblob(400);
}
} -body {
execsql COMMIT
} -test {
faultsim_test_result {0 {}}
}
finish_test

View File

@ -237,6 +237,7 @@ do_test 5.4 {
#-------------------------------------------------------------------------
# Cause an SQLITE_PROTOCOL while attempting to restart the wal file.
#
reset_db
tvfs filter {}
db close
@ -274,6 +275,37 @@ do_catchsql_test 6.2 {
INSERT INTO t1 VALUES(1);
} {1 {locking protocol}}
#-------------------------------------------------------------------------
# Check that a checkpoint fails if it cannot get the CHECKPOINTER lock
#
reset_db
tvfs filter {}
db close
sqlite3 db test.db -vfs tvfs
do_execsql_test 7.0 {
PRAGMA auto_vacuum = 0;
PRAGMA page_size = 1024;
CREATE TABLE t1(x);
PRAGMA journal_mode = wal;
WITH s(i) AS (
SELECT 1 UNION ALL SELECT i+1 FROM s LIMIT 20
)
INSERT INTO t1 SELECT randomblob(750) FROM s;
} {wal}
tvfs script xShmLock
tvfs filter xShmLock
proc xShmLock {method file handle spec} {
if {$spec=="1 1 lock exclusive"} {
return SQLITE_BUSY
}
return SQLITE_OK
}
do_execsql_test 7.1 {
PRAGMA wal_checkpoint
} {1 -1 -1}
db close
tvfs delete
finish_test