sl@0: # 2005 August 28 sl@0: # sl@0: # The author disclaims copyright to this source code. In place of sl@0: # a legal notice, here is a blessing: sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #*********************************************************************** sl@0: # This file implements regression tests for SQLite library. sl@0: # sl@0: # This file implements tests to verify that fsync is disabled when sl@0: # pragma synchronous=off even for multi-database commits. sl@0: # sl@0: # $Id: sync.test,v 1.6 2007/10/09 08:29:33 danielk1977 Exp $ sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: sl@0: # sl@0: # These tests are only applicable on unix when pager pragma are sl@0: # enabled. Also, since every test uses an ATTACHed database, they sl@0: # are only run when ATTACH is enabled. sl@0: # sl@0: if {$::tcl_platform(platform)!="unix"} { sl@0: finish_test sl@0: return sl@0: } sl@0: ifcapable !pager_pragmas||!attach { sl@0: finish_test sl@0: return sl@0: } sl@0: sl@0: do_test sync-1.1 { sl@0: set sqlite_sync_count 0 sl@0: file delete -force test2.db sl@0: file delete -force test2.db-journal sl@0: execsql { sl@0: PRAGMA fullfsync=OFF; sl@0: CREATE TABLE t1(a,b); sl@0: ATTACH DATABASE 'test2.db' AS db2; sl@0: CREATE TABLE db2.t2(x,y); sl@0: } sl@0: ifcapable !dirsync { sl@0: incr sqlite_sync_count 2 sl@0: } sl@0: set sqlite_sync_count sl@0: } 8 sl@0: ifcapable pager_pragmas { sl@0: do_test sync-1.2 { sl@0: set sqlite_sync_count 0 sl@0: execsql { sl@0: PRAGMA main.synchronous=on; sl@0: PRAGMA db2.synchronous=on; sl@0: BEGIN; sl@0: INSERT INTO t1 VALUES(1,2); sl@0: INSERT INTO t2 VALUES(3,4); sl@0: COMMIT; sl@0: } sl@0: ifcapable !dirsync { sl@0: incr sqlite_sync_count 3 sl@0: } sl@0: set sqlite_sync_count sl@0: } 8 sl@0: } sl@0: do_test sync-1.3 { sl@0: set sqlite_sync_count 0 sl@0: execsql { sl@0: PRAGMA main.synchronous=full; sl@0: PRAGMA db2.synchronous=full; sl@0: BEGIN; sl@0: INSERT INTO t1 VALUES(3,4); sl@0: INSERT INTO t2 VALUES(5,6); sl@0: COMMIT; sl@0: } sl@0: ifcapable !dirsync { sl@0: incr sqlite_sync_count 3 sl@0: } sl@0: set sqlite_sync_count sl@0: } 10 sl@0: ifcapable pager_pragmas { sl@0: do_test sync-1.4 { sl@0: set sqlite_sync_count 0 sl@0: execsql { sl@0: PRAGMA main.synchronous=off; sl@0: PRAGMA db2.synchronous=off; sl@0: BEGIN; sl@0: INSERT INTO t1 VALUES(5,6); sl@0: INSERT INTO t2 VALUES(7,8); sl@0: COMMIT; sl@0: } sl@0: set sqlite_sync_count sl@0: } 0 sl@0: } sl@0: sl@0: sl@0: finish_test