# 2016 October 31 # # 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 SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE # option. # set testdir [file dirname $argv0] source $testdir/tester.tcl source $testdir/lock_common.tcl source $testdir/malloc_common.tcl source $testdir/wal_common.tcl ifcapable !wal {finish_test ; return } if {[permutation]=="journaltest" || [permutation]=="inmemory_journal"} { finish_test return } set testprefix nockpt do_execsql_test 1.0 { PRAGMA auto_vacuum=OFF; PRAGMA page_size = 1024; PRAGMA journal_mode = wal; CREATE TABLE c1(x, y, z); INSERT INTO c1 VALUES(1, 2, 3); } {wal} do_test 1.1 { file exists test.db-wal } 1 do_test 1.2 { file size test.db-wal } [wal_file_size 3 1024] do_test 1.3 { db close } {} do_test 1.4 { file exists test.db-wal } 0 sqlite3 db test.db do_execsql_test 1.5 { INSERT INTO c1 VALUES(4, 5, 6); INSERT INTO c1 VALUES(7, 8, 9); } do_test 1.6 { file exists test.db-wal } 1 do_test 1.7 { sqlite3_db_config db NO_CKPT_ON_CLOSE 1 } {1} do_test 1.8 { file size test.db-wal } [wal_file_size 2 1024] do_test 1.9 { db close } {} do_test 1.10 { file exists test.db-wal } 1 do_test 1.11 { file size test.db-wal } [wal_file_size 2 1024] sqlite3 db test.db do_execsql_test 1.12 { SELECT * FROM c1 } {1 2 3 4 5 6 7 8 9} do_execsql_test 1.13 { PRAGMA main.journal_mode } {wal} do_test 1.14 { sqlite3_db_config db NO_CKPT_ON_CLOSE 1 } {1} do_execsql_test 1.14 { PRAGMA main.journal_mode = delete } {delete} do_test 1.15 { file exists test.db-wal } {0} finish_test