Index: test/crash8.test ================================================================== --- test/crash8.test +++ test/crash8.test @@ -140,10 +140,11 @@ # # a) Not a power of 2, or # b) Less than 512, or # c) Greater than SQLITE_MAX_PAGE_SIZE # +if {[atomic_batch_write test.db]==0} { do_test crash8-3.1 { list [file exists test.db-joural] [file exists test.db] } {0 1} do_test crash8-3.2 { execsql { @@ -226,10 +227,11 @@ execsql { SELECT count(*) FROM t1; PRAGMA integrity_check } } {6 ok} +} # If a connection running in persistent-journal mode is part of a # multi-file transaction, it must ensure that the master-journal name # appended to the journal file contents during the commit is located @@ -264,12 +266,16 @@ INSERT INTO aux.ab SELECT * FROM main.ab; UPDATE aux.ab SET b = randstr(1000,1000) WHERE a>=1; UPDATE ab SET b = randstr(1000,1000) WHERE a>=1; } - list [file exists test.db-journal] [file exists test2.db-journal] - } {1 1} + } {persist persist} + if {[atomic_batch_write test.db]==0} { + do_test crash8.4.1.1 { + list [file exists test.db-journal] [file exists test2.db-journal] + } {1 1} + } do_test crash8-4.2 { execsql { BEGIN; UPDATE aux.ab SET b = 'def' WHERE a = 0; Index: test/delete_db.test ================================================================== --- test/delete_db.test +++ test/delete_db.test @@ -14,10 +14,15 @@ # set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix delete_db + +if {[atomic_batch_write test.db]} { + finish_test + return +} proc delete_all {} { foreach f [glob -nocomplain test2*] { file delete $f } foreach f [glob -nocomplain test3*] { file delete $f } } Index: test/exclusive.test ================================================================== --- test/exclusive.test +++ test/exclusive.test @@ -250,11 +250,13 @@ # # These tests are not run on windows because the windows backend # opens the journal file for exclusive access, preventing its contents # from being inspected externally. # -if {$tcl_platform(platform) != "windows"} { +if {$tcl_platform(platform) != "windows" + && [atomic_batch_write test.db]==0 +} { # Return a list of two booleans (either 0 or 1). The first is true # if the named file exists. The second is true only if the file # exists and the first 28 bytes contain at least one non-zero byte. # @@ -389,10 +391,11 @@ #---------------------------------------------------------------------- # Tests exclusive-5.X - test that statement journals are truncated # instead of deleted when in exclusive access mode. # +if {[atomic_batch_write test.db]==0} { # Close and reopen the database so that the temp database is no # longer active. # db close @@ -505,7 +508,9 @@ do_execsql_test exclusive-6.5 { PRAGMA locking_mode = EXCLUSIVE; SELECT * FROM sqlite_master; } {exclusive} + +} ;# atomic_batch_write==0 finish_test Index: test/fallocate.test ================================================================== --- test/fallocate.test +++ test/fallocate.test @@ -59,10 +59,11 @@ # do_test fallocate-1.7 { execsql { BEGIN; INSERT INTO t1 VALUES(1, 2); } if {[permutation] != "inmemory_journal" && [permutation] != "atomic-batch-write" + && [atomic_batch_write test.db]==0 } { hexio_get_int [hexio_read test.db-journal 16 4] } else { set {} 1024 } Index: test/journal1.test ================================================================== --- test/journal1.test +++ test/journal1.test @@ -20,11 +20,16 @@ source $testdir/tester.tcl # These tests will not work on windows because windows uses # manditory file locking which breaks the copy_file command. # -if {$tcl_platform(platform)=="windows"} { +# Or with atomic_batch_write systems, as journal files are +# not created. +# +if {$tcl_platform(platform)=="windows" + || [atomic_batch_write test.db] +} { finish_test return } # Create a smaple database Index: test/journal3.test ================================================================== --- test/journal3.test +++ test/journal3.test @@ -18,11 +18,13 @@ #------------------------------------------------------------------------- # If a connection is required to create a journal file, it creates it with # the same file-system permissions as the database file itself. Test this. # -if {$::tcl_platform(platform) == "unix"} { +if {$::tcl_platform(platform) == "unix" + && [atomic_batch_write test.db]==0 +} { # Changed on 2012-02-13: umask is deliberately ignored for -wal, -journal, # and -shm files. #set umask [exec /bin/sh -c umask] faultsim_delete_and_reopen Index: test/jrnlmode.test ================================================================== --- test/jrnlmode.test +++ test/jrnlmode.test @@ -300,10 +300,11 @@ #------------------------------------------------------------------------ # The following test caes, jrnlmode-5.*, test the journal_size_limit # pragma. ifcapable pragma { +if {[atomic_batch_write test.db]==0} { db close forcedelete test.db test2.db test3.db sqlite3 db test.db do_test jrnlmode-5.1 { @@ -452,12 +453,14 @@ do_test jrnlmode-5.22 { execsql COMMIT list [file exists test.db-journal] [file size test.db-journal] } {1 0} } +} ifcapable pragma { +if {[atomic_batch_write test.db]==0} { # These tests are not run as part of the "journaltest" permutation, # as the test_journal.c layer is incompatible with in-memory journaling. if {[permutation] ne "journaltest"} { do_test jrnlmode-6.1 { @@ -504,10 +507,11 @@ BEGIN IMMEDIATE; INSERT INTO t4 VALUES(1,2); COMMIT; } file exists test.db-journal } {0} } +} } ifcapable pragma { catch { db close } do_test jrnlmode-7.1 { Index: test/jrnlmode2.test ================================================================== --- test/jrnlmode2.test +++ test/jrnlmode2.test @@ -15,10 +15,15 @@ ifcapable {!pager_pragmas} { finish_test return } + +if {[atomic_batch_write test.db]} { + finish_test + return +} #------------------------------------------------------------------------- # The tests in this file check that the following two bugs (both now fixed) # do not reappear. # Index: test/lock4.test ================================================================== --- test/lock4.test +++ test/lock4.test @@ -14,10 +14,18 @@ # $Id: lock4.test,v 1.10 2009/05/06 00:52:41 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl + +if {[atomic_batch_write test.db]} { + # This test uses two processes, one of which blocks until the other + # creates a *-journal file. Which doesn't work if atomic writes are + # available. + finish_test + return +} do_not_use_codec # Initialize the test.db database so that it is non-empty # Index: test/pager1.test ================================================================== --- test/pager1.test +++ test/pager1.test @@ -14,10 +14,15 @@ source $testdir/tester.tcl source $testdir/lock_common.tcl source $testdir/malloc_common.tcl source $testdir/wal_common.tcl set testprefix pager1 + +if {[atomic_batch_write test.db]} { + finish_test + return +} # Do not use a codec for tests in this file, as the database file is # manipulated directly using tcl scripts (using the [hexio_write] command). # do_not_use_codec Index: test/pager3.test ================================================================== --- test/pager3.test +++ test/pager3.test @@ -14,10 +14,14 @@ source $testdir/tester.tcl source $testdir/lock_common.tcl source $testdir/malloc_common.tcl source $testdir/wal_common.tcl +if {[atomic_batch_write test.db]} { + finish_test + return +} foreach {tn sql res j} { 1 "PRAGMA journal_mode = DELETE" delete 0 2 "CREATE TABLE t1(a, b)" {} 0 3 "PRAGMA locking_mode=EXCLUSIVE" {exclusive} 0 Index: test/rollback.test ================================================================== --- test/rollback.test +++ test/rollback.test @@ -81,10 +81,11 @@ if {$tcl_platform(platform) == "unix" && [permutation] ne "onefile" && [permutation] ne "inmemory_journal" && [permutation] ne "atomic-batch-write" + && [atomic_batch_write test.db]==0 } { do_test rollback-2.1 { execsql { BEGIN; INSERT INTO t3 VALUES('hello world'); Index: test/sharedA.test ================================================================== --- test/sharedA.test +++ test/sharedA.test @@ -16,10 +16,15 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl if {[run_thread_tests]==0} { finish_test ; return } db close set ::testprefix sharedA + +if {[atomic_batch_write test.db]} { + finish_test + return +} set ::enable_shared_cache [sqlite3_enable_shared_cache 1] #------------------------------------------------------------------------- # Index: test/stmt.test ================================================================== --- test/stmt.test +++ test/stmt.test @@ -13,10 +13,15 @@ # statement journal for various SQL statements. # set testdir [file dirname $argv0] source $testdir/tester.tcl + +if {[atomic_batch_write test.db]} { + finish_test + return +} do_test stmt-1.1 { execsql { CREATE TABLE t1(a integer primary key, b INTEGER NOT NULL) } } {} Index: test/symlink.test ================================================================== --- test/symlink.test +++ test/symlink.test @@ -100,11 +100,11 @@ execsql { BEGIN; INSERT INTO t1 VALUES(1); } db2 file exists test.db-journal - } 1 + } [expr [atomic_batch_write test.db]==0] do_test 2.$tn.3 { list [file exists test2.db-journal] [file exists test3.db-journal] } {0 0} do_test 2.$tn.4 { execsql { Index: test/sync.test ================================================================== --- test/sync.test +++ test/sync.test @@ -23,10 +23,14 @@ # are only run when ATTACH is enabled. # ifcapable !pager_pragmas||!attach { finish_test return +} +if {[atomic_batch_write test.db]} { + finish_test + return } set sqlite_sync_count 0 proc cond_incr_sync_count {adj} { global sqlite_sync_count Index: test/sync2.test ================================================================== --- test/sync2.test +++ test/sync2.test @@ -27,10 +27,11 @@ return } if {$::tcl_platform(platform)!="unix" || [permutation] == "journaltest" || [permutation] == "inmemory_journal" + || [atomic_batch_write test.db] } { finish_test return } Index: test/tempdb.test ================================================================== --- test/tempdb.test +++ test/tempdb.test @@ -14,10 +14,15 @@ # # $Id: tempdb.test,v 1.4 2009/06/05 17:09:12 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl + +if {[atomic_batch_write test.db]} { + finish_test + return +} # Use a temporary database. # db close sqlite3 db {} Index: test/tkt3457.test ================================================================== --- test/tkt3457.test +++ test/tkt3457.test @@ -16,10 +16,14 @@ source $testdir/tester.tcl if {$tcl_platform(platform) != "unix"} { finish_test return +} +if {[atomic_batch_write test.db]} { + finish_test + return } #----------------------------------------------------------------------- # To roll back a hot-journal file, the application needs read and write # permission on the journal file in question. The following tests test Index: test/vacuum5.test ================================================================== --- test/vacuum5.test +++ test/vacuum5.test @@ -141,13 +141,15 @@ do_execsql_test 3.1 { VACUUM } db close tvfs delete - do_test 3.2 { - lrange $::openfiles 0 4 - } {test.db test.db-journal test.db-journal {} test.db-journal} + if {[atomic_batch_write test.db]==0} { + do_test 3.2 { + lrange $::openfiles 0 4 + } {test.db test.db-journal test.db-journal {} test.db-journal} + } } finish_test Index: test/wal2.test ================================================================== --- test/wal2.test +++ test/wal2.test @@ -582,19 +582,27 @@ do_test wal2-6.3.4 { execsql { BEGIN; INSERT INTO t1 VALUES('Groucho'); } - list [file exists test.db-wal] [file exists test.db-journal] -} {0 1} +} {} +if {[atomic_batch_write test.db]==0} { + do_test wal2-6.3.4.1 { + list [file exists test.db-wal] [file exists test.db-journal] + } {0 1} +} do_test wal2-6.3.5 { execsql { PRAGMA lock_status } } {main exclusive temp closed} do_test wal2-6.3.6 { execsql { COMMIT } - list [file exists test.db-wal] [file exists test.db-journal] -} {0 1} +} {} +if {[atomic_batch_write test.db]==0} { + do_test wal2-6.3.6.1 { + list [file exists test.db-wal] [file exists test.db-journal] + } {0 1} +} do_test wal2-6.3.7 { execsql { PRAGMA lock_status } } {main exclusive temp closed} db close Index: test/walmode.test ================================================================== --- test/walmode.test +++ test/walmode.test @@ -43,19 +43,21 @@ } {wal} do_test walmode-1.2 { file size test.db } {1024} -set expected_sync_count 3 -if {$::tcl_platform(platform)!="windows"} { - ifcapable dirsync { - incr expected_sync_count - } -} -do_test walmode-1.3 { - set sqlite_sync_count -} $expected_sync_count +if {[atomic_batch_write test.db]==0} { + set expected_sync_count 3 + if {$::tcl_platform(platform)!="windows"} { + ifcapable dirsync { + incr expected_sync_count + } + } + do_test walmode-1.3 { + set sqlite_sync_count + } $expected_sync_count +} do_test walmode-1.4 { file exists test.db-wal } {0} do_test walmode-1.5 { @@ -104,24 +106,28 @@ # do_test walmode-4.1 { execsql { INSERT INTO t1 VALUES(1, 2) } execsql { PRAGMA journal_mode = persist } } {persist} -do_test walmode-4.2 { - list [file exists test.db-journal] [file exists test.db-wal] -} {1 0} +if {[atomic_batch_write test.db]==0} { + do_test walmode-4.2 { + list [file exists test.db-journal] [file exists test.db-wal] + } {1 0} +} do_test walmode-4.3 { execsql { SELECT * FROM t1 } } {1 2} do_test walmode-4.4 { db close sqlite3 db test.db execsql { SELECT * FROM t1 } } {1 2} -do_test walmode-4.5 { - list [file exists test.db-journal] [file exists test.db-wal] -} {1 0} +if {[atomic_batch_write test.db]==0} { + do_test walmode-4.5 { + list [file exists test.db-journal] [file exists test.db-wal] + } {1 0} +} # Test that nothing goes wrong if a connection is prevented from changing # from WAL to rollback mode because a second connection has the database # open. Or from rollback to WAL. # Index: test/zerodamage.test ================================================================== --- test/zerodamage.test +++ test/zerodamage.test @@ -72,11 +72,11 @@ set ::max_journal_size 0 db eval { UPDATE t1 SET y=randomblob(50) WHERE x=123; } concat [file_control_powersafe_overwrite db -1] [set ::max_journal_size] -} {0 1 2576} +} [list 0 1 [expr ([atomic_batch_write test.db]==0)*2576]] # Repeat the previous step with zero-damage turned off. This time the # maximum rollback journal size should be much larger. # do_test zerodamage-2.1 { @@ -85,11 +85,11 @@ sqlite3 db file:test.db?psow=FALSE -uri 1 db eval { UPDATE t1 SET y=randomblob(50) WHERE x=124; } concat [file_control_powersafe_overwrite db -1] [set ::max_journal_size] -} {0 0 24704} +} [list 0 0 [expr ([atomic_batch_write test.db]==0)*24704]] if {[wal_is_capable]} { # Run a WAL-mode transaction with POWERSAFE_OVERWRITE on to verify that the # WAL file does not get too big. #