1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00
Files
sqlite/test/wal2fault.test
dan 0f297b6e50 Improve testing of the wal.c changes on this branch.
FossilOrigin-Name: 63483e22c775183e01924b5cb3d0f3655b63c3cdd06faf26cacd4d0913c0055c
2018-12-26 20:42:32 +00:00

53 lines
1.4 KiB
Plaintext

# 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 wal2fault
do_execsql_test 1.0 {
CREATE TABLE t1(x,y);
PRAGMA journal_mode = wal2;
WITH s(i) AS ( SELECT 100 UNION ALL SELECT i-1 FROM s WHERE (i-1)>0 )
INSERT INTO t1 SELECT i, randomblob(i) FROM s;
WITH s(i) AS ( SELECT 100 UNION ALL SELECT i-1 FROM s WHERE (i-1)>0 )
INSERT INTO t1 SELECT i, randomblob(i) FROM s;
} {wal2}
do_test 1.1 {
expr [file size test.db-wal]>10000
} {1}
faultsim_save_and_close
do_faultsim_test 1 -prep {
faultsim_restore_and_reopen
execsql {
PRAGMA journal_size_limit = 10000;
SELECT count(*) FROM sqlite_master;
}
} -body {
execsql {
INSERT INTO t1 VALUES(1, 2);
}
} -test {
faultsim_test_result {0 {}}
}
finish_test