From e36d23a85ebff914d74bb541558c2b6082b78edb Mon Sep 17 00:00:00 2001 From: dan miller Date: Sat, 20 Oct 2007 02:49:29 +0000 Subject: sqlite source (unix build) added to libraries --- libraries/sqlite/unix/sqlite-3.5.1/test/sync.test | 97 +++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 libraries/sqlite/unix/sqlite-3.5.1/test/sync.test (limited to 'libraries/sqlite/unix/sqlite-3.5.1/test/sync.test') diff --git a/libraries/sqlite/unix/sqlite-3.5.1/test/sync.test b/libraries/sqlite/unix/sqlite-3.5.1/test/sync.test new file mode 100644 index 0000000..88a1b7d --- /dev/null +++ b/libraries/sqlite/unix/sqlite-3.5.1/test/sync.test @@ -0,0 +1,97 @@ +# 2005 August 28 +# +# 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. +# +# This file implements tests to verify that fsync is disabled when +# pragma synchronous=off even for multi-database commits. +# +# $Id: sync.test,v 1.5 2006/02/11 01:25:51 drh Exp $ + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +# +# These tests are only applicable on unix when pager pragma are +# enabled. +# +if {$::tcl_platform(platform)!="unix"} { + finish_test + return +} +ifcapable !pager_pragmas { + finish_test + return +} + +do_test sync-1.1 { + set sqlite_sync_count 0 + file delete -force test2.db + file delete -force test2.db-journal + execsql { + PRAGMA fullfsync=OFF; + CREATE TABLE t1(a,b); + ATTACH DATABASE 'test2.db' AS db2; + CREATE TABLE db2.t2(x,y); + } + ifcapable !dirsync { + incr sqlite_sync_count 2 + } + set sqlite_sync_count +} 8 +ifcapable pager_pragmas { + do_test sync-1.2 { + set sqlite_sync_count 0 + execsql { + PRAGMA main.synchronous=on; + PRAGMA db2.synchronous=on; + BEGIN; + INSERT INTO t1 VALUES(1,2); + INSERT INTO t2 VALUES(3,4); + COMMIT; + } + ifcapable !dirsync { + incr sqlite_sync_count 3 + } + set sqlite_sync_count + } 8 +} +do_test sync-1.3 { + set sqlite_sync_count 0 + execsql { + PRAGMA main.synchronous=full; + PRAGMA db2.synchronous=full; + BEGIN; + INSERT INTO t1 VALUES(3,4); + INSERT INTO t2 VALUES(5,6); + COMMIT; + } + ifcapable !dirsync { + incr sqlite_sync_count 3 + } + set sqlite_sync_count +} 10 +ifcapable pager_pragmas { + do_test sync-1.4 { + set sqlite_sync_count 0 + execsql { + PRAGMA main.synchronous=off; + PRAGMA db2.synchronous=off; + BEGIN; + INSERT INTO t1 VALUES(5,6); + INSERT INTO t2 VALUES(7,8); + COMMIT; + } + set sqlite_sync_count + } 0 +} + + +finish_test -- cgit v1.1