# 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