1# 2005 August 28 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# This file implements regression tests for SQLite library. 12# 13# This file implements tests to verify that fsync is disabled when 14# pragma synchronous=off even for multi-database commits. 15# 16# $Id: sync.test,v 1.1 2005/08/27 16:36:49 drh Exp $ 17 18set testdir [file dirname $argv0] 19source $testdir/tester.tcl 20 21# 22# These tests are only applicable on unix when pager pragma are 23# enabled. 24# 25if {$::tcl_platform(platform)!="unix"} { 26 finish_test 27} 28ifcapable !pager_pragmas { 29 finish_test 30} 31 32do_test sync-1.1 { 33 set sqlite_sync_count 0 34 file delete -force test2.db 35 file delete -force test2.db-journal 36 execsql { 37 CREATE TABLE t1(a,b); 38 ATTACH DATABASE 'test2.db' AS db2; 39 CREATE TABLE db2.t2(x,y); 40 } 41 set sqlite_sync_count 42} 8 43do_test sync-1.2 { 44 set sqlite_sync_count 0 45 execsql { 46 PRAGMA main.synchronous=on; 47 PRAGMA db2.synchronous=on; 48 BEGIN; 49 INSERT INTO t1 VALUES(1,2); 50 INSERT INTO t2 VALUES(3,4); 51 COMMIT; 52 } 53 set sqlite_sync_count 54} 8 55do_test sync-1.3 { 56 set sqlite_sync_count 0 57 execsql { 58 PRAGMA main.synchronous=full; 59 PRAGMA db2.synchronous=full; 60 BEGIN; 61 INSERT INTO t1 VALUES(3,4); 62 INSERT INTO t2 VALUES(5,6); 63 COMMIT; 64 } 65 set sqlite_sync_count 66} 10 67do_test sync-1.4 { 68 set sqlite_sync_count 0 69 execsql { 70 PRAGMA main.synchronous=off; 71 PRAGMA db2.synchronous=off; 72 BEGIN; 73 INSERT INTO t1 VALUES(5,6); 74 INSERT INTO t2 VALUES(7,8); 75 COMMIT; 76 } 77 set sqlite_sync_count 78} 0 79 80 81finish_test 82