3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library.
13 # This file implements tests to verify that fsync is disabled when
14 # pragma synchronous=off even for multi-database commits.
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
21 # These tests are only applicable when pager pragma are
22 # enabled. Also, since every test uses an ATTACHed database, they
23 # are only run when ATTACH is enabled.
25 ifcapable !pager_pragmas||!attach {
29 if {[atomic_batch_write test.db]} {
34 set sqlite_sync_count 0
35 proc cond_incr_sync_count {adj} {
36 global sqlite_sync_count
37 if {$::tcl_platform(platform) == "windows"} {
38 incr sqlite_sync_count $adj
41 incr sqlite_sync_count $adj
47 set sqlite_sync_count 0
49 forcedelete test2.db-journal
53 ATTACH DATABASE 'test2.db' AS db2;
54 CREATE TABLE db2.t2(x,y);
56 cond_incr_sync_count 2
59 ifcapable pager_pragmas {
61 set sqlite_sync_count 0
63 PRAGMA main.synchronous=on;
64 PRAGMA db2.synchronous=on;
66 INSERT INTO t1 VALUES(1,2);
67 INSERT INTO t2 VALUES(3,4);
70 cond_incr_sync_count 4
75 set sqlite_sync_count 0
77 PRAGMA main.synchronous=full;
78 PRAGMA db2.synchronous=full;
80 INSERT INTO t1 VALUES(3,4);
81 INSERT INTO t2 VALUES(5,6);
84 cond_incr_sync_count 4
87 ifcapable pager_pragmas {
88 if {[permutation]!="journaltest"} {
90 set sqlite_sync_count 0
92 PRAGMA main.synchronous=off;
93 PRAGMA db2.synchronous=off;
95 INSERT INTO t1 VALUES(5,6);
96 INSERT INTO t2 VALUES(7,8);