| # 2017 September 19 |
| # |
| # 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=WAL2" mode. |
| # |
| |
| set testdir [file dirname $argv0] |
| source $testdir/tester.tcl |
| source $testdir/lock_common.tcl |
| source $testdir/malloc_common.tcl |
| source $testdir/wal_common.tcl |
| |
| set testprefix wal2rollback |
| ifcapable !wal {finish_test ; return } |
| |
| do_execsql_test 1.0 { |
| CREATE TABLE t1(a, b, c); |
| CREATE TABLE t2(a, b, c); |
| CREATE INDEX i1 ON t1(a); |
| CREATE INDEX i2 ON t1(b); |
| PRAGMA journal_mode = wal2; |
| PRAGMA cache_size = 5; |
| PRAGMA journal_size_limit = 10000; |
| WITH s(i) AS ( |
| SELECT 1 UNION ALL SELECT i+1 FROM s LIMIT 1000 |
| ) |
| INSERT INTO t1 SELECT i, i, randomblob(200) FROM s; |
| } {wal2 10000} |
| |
| do_test 1.1 { |
| expr [file size test.db-wal] > 10000 |
| } 1 |
| |
| do_test 1.2 { |
| execsql { |
| BEGIN; |
| UPDATE t1 SET b=b+1; |
| INSERT INTO t2 VALUES(1,2,3); |
| } |
| expr [file size test.db-wal2] > 10000 |
| } {1} |
| |
| breakpoint |
| do_execsql_test 1.3 { |
| ROLLBACK; |
| SELECT * FROM t2; |
| SELECT count(*) FROM t1 WHERE a=b; |
| PRAGMA integrity_check; |
| } {1000 ok} |
| |
| |
| |
| finish_test |