xref: /sqlite-3.40.0/test/wal64k.test (revision b6c4d59e)
1bc76063cSdan# 2010 April 13
2bc76063cSdan#
3bc76063cSdan# The author disclaims copyright to this source code.  In place of
4bc76063cSdan# a legal notice, here is a blessing:
5bc76063cSdan#
6bc76063cSdan#    May you do good and not evil.
7bc76063cSdan#    May you find forgiveness for yourself and forgive others.
8bc76063cSdan#    May you share freely, never taking more than you give.
9bc76063cSdan#
10bc76063cSdan#***********************************************************************
11bc76063cSdan# This file implements regression tests for SQLite library.  The
12bc76063cSdan# focus of this file is testing the operation of the library in
13bc76063cSdan# "PRAGMA journal_mode=WAL" mode.
14bc76063cSdan#
15bc76063cSdan
16bc76063cSdanset testdir [file dirname $argv0]
17bc76063cSdansource $testdir/tester.tcl
18bc76063cSdanset testprefix wal64k
19bc76063cSdan
20bc76063cSdanifcapable !wal {finish_test ; return }
21bc76063cSdan
2270c93204Sdrhif {$tcl_platform(platform) != "unix"} {
2370c93204Sdrh  finish_test
2470c93204Sdrh  return
2570c93204Sdrh}
2670c93204Sdrh
27bc76063cSdandb close
28bc76063cSdantest_syscall pagesize 65536
29bc76063cSdansqlite3 db test.db
30bc76063cSdan
31bc76063cSdando_execsql_test 1.0 {
32bc76063cSdan  PRAGMA journal_mode = WAL;
33bc76063cSdan  CREATE TABLE t1(x);
34bc76063cSdan  CREATE INDEX i1 ON t1(x);
35bc76063cSdan} {wal}
36bc76063cSdando_test 1.1 { file size test.db-shm } {65536}
37bc76063cSdan
38bc76063cSdando_test 1.2 {
39bc76063cSdan  execsql BEGIN
40bc76063cSdan  while {[file size test.db-shm]==65536} {
41bc76063cSdan    execsql { INSERT INTO t1 VALUES( randstr(900,1100) ) }
42bc76063cSdan  }
43bc76063cSdan  execsql COMMIT
44bc76063cSdan  file size test.db-shm
45bc76063cSdan} {131072}
46bc76063cSdan
47bc76063cSdanintegrity_check 1.3
48bc76063cSdan
49bc76063cSdandb close
50*b6c4d59eSdrhforcedelete test.db
51*b6c4d59eSdrhsqlite3 db test.db -vfs unix-excl
52*b6c4d59eSdrhdo_execsql_test 2.1 {
53*b6c4d59eSdrh  PRAGMA page_size=512;
54*b6c4d59eSdrh  PRAGMA journal_mode=WAL;
55*b6c4d59eSdrh  CREATE TABLE t1(a,b);
56*b6c4d59eSdrh  WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<8200)
57*b6c4d59eSdrh  INSERT INTO t1(a,b) SELECT x, zeroblob(300) FROM c;
58*b6c4d59eSdrh  PRAGMA integrity_check;
59*b6c4d59eSdrh} {wal ok}
60*b6c4d59eSdrh
61*b6c4d59eSdrhdb close
62bc76063cSdantest_syscall pagesize -1
63bc76063cSdanfinish_test
64