blob: 3f8b0b8930c872237e8a55ac2c1eb21f1f7310d0 [file] [log] [blame]
drh253cea52011-07-26 16:23:25 +00001# 2011 July 26
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#
12# This file contains tests for using WAL with persistent WAL file mode.
13#
14
15set testdir [file dirname $argv0]
16source $testdir/tester.tcl
17source $testdir/lock_common.tcl
18set ::testprefix walpersist
19
20do_test walpersist-1.0 {
21 db eval {
22 PRAGMA journal_mode=WAL;
23 CREATE TABLE t1(a);
24 INSERT INTO t1 VALUES(randomblob(5000));
25 }
26 file exists test.db-wal
27} {1}
28do_test walpersist-1.1 {
29 file exists test.db-shm
30} {1}
31do_test walpersist-1.2 {
32 db close
33 list [file exists test.db] [file exists test.db-wal] [file exists test.db-shm]
34} {1 0 0}
35do_test walpersist-1.3 {
36 sqlite3 db test.db
37 db eval {SELECT length(a) FROM t1}
38} {5000}
39do_test walpersist-1.4 {
40 list [file exists test.db] [file exists test.db-wal] [file exists test.db-shm]
41} {1 1 1}
42do_test walpersist-1.5 {
43 file_control_persist_wal db -1
44} {0 0}
45do_test walpersist-1.6 {
46 file_control_persist_wal db 1
47} {0 1}
48do_test walpersist-1.7 {
49 file_control_persist_wal db -1
50} {0 1}
51do_test walpersist-1.8 {
52 file_control_persist_wal db 0
53} {0 0}
54do_test walpersist-1.9 {
55 file_control_persist_wal db -1
56} {0 0}
57do_test walpersist-1.10 {
58 file_control_persist_wal db 1
59} {0 1}
60do_test walpersist-1.11 {
61 db close
62 list [file exists test.db] [file exists test.db-wal] [file exists test.db-shm]
63} {1 1 1}
64
65
66
67
68finish_test