blob: bd3953f1ee634675d9983095ec8ec29003e91909 [file] [log] [blame]
dan298af022016-10-31 16:16:49 +00001# 2016 October 31
2#
3# The author disclaims copyright to this source code. In place of
4# a legal notice, here is a blessing:
5#
6# May you do good and not evil.
7# May you find forgiveness for yourself and forgive others.
8# May you share freely, never taking more than you give.
9#
10#***********************************************************************
11# This file implements regression tests for SQLite library. The
12# focus of this file is testing the SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
13# option.
14#
15
16set testdir [file dirname $argv0]
17source $testdir/tester.tcl
18source $testdir/lock_common.tcl
19source $testdir/malloc_common.tcl
20source $testdir/wal_common.tcl
21ifcapable !wal {finish_test ; return }
drh402124d2016-12-27 15:59:15 +000022if {[permutation]=="journaltest" || [permutation]=="inmemory_journal"} {
23 finish_test
24 return
25}
dan298af022016-10-31 16:16:49 +000026
27set testprefix nockpt
28
29do_execsql_test 1.0 {
drhc5954192016-12-27 02:43:47 +000030 PRAGMA auto_vacuum=OFF;
dan298af022016-10-31 16:16:49 +000031 PRAGMA page_size = 1024;
32 PRAGMA journal_mode = wal;
33 CREATE TABLE c1(x, y, z);
34 INSERT INTO c1 VALUES(1, 2, 3);
35} {wal}
36
37do_test 1.1 { file exists test.db-wal } 1
38do_test 1.2 { file size test.db-wal } [wal_file_size 3 1024]
39do_test 1.3 { db close } {}
40do_test 1.4 { file exists test.db-wal } 0
41
42sqlite3 db test.db
43do_execsql_test 1.5 {
44 INSERT INTO c1 VALUES(4, 5, 6);
45 INSERT INTO c1 VALUES(7, 8, 9);
46}
47do_test 1.6 { file exists test.db-wal } 1
48do_test 1.7 { sqlite3_db_config db NO_CKPT_ON_CLOSE 1 } {1}
49do_test 1.8 { file size test.db-wal } [wal_file_size 2 1024]
50do_test 1.9 { db close } {}
51do_test 1.10 { file exists test.db-wal } 1
52do_test 1.11 { file size test.db-wal } [wal_file_size 2 1024]
53
54sqlite3 db test.db
55do_execsql_test 1.12 {
56 SELECT * FROM c1
57} {1 2 3 4 5 6 7 8 9}
58
dan4a5bad52016-11-11 17:08:51 +000059do_execsql_test 1.13 { PRAGMA main.journal_mode } {wal}
60do_test 1.14 { sqlite3_db_config db NO_CKPT_ON_CLOSE 1 } {1}
61do_execsql_test 1.14 { PRAGMA main.journal_mode = delete } {delete}
62do_test 1.15 { file exists test.db-wal } {0}
63
64
dan298af022016-10-31 16:16:49 +000065
66finish_test