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.
16 # $Id: sync.test,v 1.6 2007/10/09 08:29:33 danielk1977 Exp $
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
22 # These tests are only applicable when pager pragma are
23 # enabled. Also, since every test uses an ATTACHed database, they
24 # are only run when ATTACH is enabled.
26 ifcapable !pager_pragmas||!attach {
31 set sqlite_sync_count 0
32 proc cond_incr_sync_count {adj} {
33 global sqlite_sync_count
34 if {$::tcl_platform(platform) == "windows"} {
35 incr sqlite_sync_count $adj
38 incr sqlite_sync_count $adj
44 set sqlite_sync_count 0
46 forcedelete test2.db-journal
50 ATTACH DATABASE 'test2.db' AS db2;
51 CREATE TABLE db2.t2(x,y);
53 cond_incr_sync_count 2
56 ifcapable pager_pragmas {
58 set sqlite_sync_count 0
60 PRAGMA main.synchronous=on;
61 PRAGMA db2.synchronous=on;
63 INSERT INTO t1 VALUES(1,2);
64 INSERT INTO t2 VALUES(3,4);
67 cond_incr_sync_count 3
72 set sqlite_sync_count 0
74 PRAGMA main.synchronous=full;
75 PRAGMA db2.synchronous=full;
77 INSERT INTO t1 VALUES(3,4);
78 INSERT INTO t2 VALUES(5,6);
81 cond_incr_sync_count 3
84 ifcapable pager_pragmas {
86 set sqlite_sync_count 0
88 PRAGMA main.synchronous=off;
89 PRAGMA db2.synchronous=off;
91 INSERT INTO t1 VALUES(5,6);
92 INSERT INTO t2 VALUES(7,8);