mirror of
https://github.com/sqlite/sqlite.git
synced 2026-01-06 08:01:16 +03:00
Get the io.test tests working on windows. (CVS 4381)
FossilOrigin-Name: 1be70015e24f715a4276f253d2e0c0eec44650ee
This commit is contained in:
34
test/io.test
34
test/io.test
@@ -13,7 +13,7 @@
|
||||
# IO traffic generated by SQLite (making sure SQLite is not writing out
|
||||
# more database pages than it has to, stuff like that).
|
||||
#
|
||||
# $Id: io.test,v 1.8 2007/09/01 18:24:55 danielk1977 Exp $
|
||||
# $Id: io.test,v 1.9 2007/09/03 17:02:50 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -404,19 +404,24 @@ sqlite3_simulate_device -char safe_append
|
||||
# With the SAFE_APPEND flag set, simple transactions require 3, rather
|
||||
# than 4, calls to fsync(). The fsync() calls are on:
|
||||
#
|
||||
# 1) The directory in which the journal file is created,
|
||||
# 1) The directory in which the journal file is created, (unix only)
|
||||
# 2) The journal file (to sync the page data),
|
||||
# 3) The database file.
|
||||
#
|
||||
# Normally, when the SAFE_APPEND flag is not set, there is another fsync()
|
||||
# on the journal file between steps (2) and (3) above.
|
||||
#
|
||||
if {$::tcl_platform(platform)=="unix"} {
|
||||
set expected_sync_count 3
|
||||
} else {
|
||||
set expected_sync_count 2
|
||||
}
|
||||
do_test io-4.1 {
|
||||
execsql { DELETE FROM abc }
|
||||
nSync
|
||||
execsql { INSERT INTO abc VALUES('a', 'b') }
|
||||
nSync
|
||||
} {3}
|
||||
} $expected_sync_count
|
||||
|
||||
# With SAFE_APPEND set, the nRec field of the journal file header should
|
||||
# be set to 0xFFFFFFFF before the first journal sync. The nRec field
|
||||
@@ -427,20 +432,21 @@ do_test io-4.2.1 {
|
||||
execsql { INSERT INTO abc VALUES('c', 'd') }
|
||||
file exists test.db-journal
|
||||
} {1}
|
||||
do_test io-4.2.2 {
|
||||
set fd [open test.db-journal]
|
||||
fconfigure $fd -translation binary -encoding binary
|
||||
seek $fd 8
|
||||
set blob [read $fd 4]
|
||||
close $fd
|
||||
binary scan $blob i res
|
||||
format 0x%X $res
|
||||
} {0xFFFFFFFF}
|
||||
if {$::tcl_platform(platform)=="unix"} {
|
||||
do_test io-4.2.2 {
|
||||
set fd [open test.db-journal]
|
||||
fconfigure $fd -translation binary -encoding binary
|
||||
seek $fd 8
|
||||
set blob [read $fd 4]
|
||||
close $fd
|
||||
binary scan $blob i res
|
||||
format 0x%X $res
|
||||
} {0xFFFFFFFF}
|
||||
}
|
||||
do_test io-4.2.3 {
|
||||
execsql { COMMIT }
|
||||
nSync
|
||||
} {3}
|
||||
|
||||
} $expected_sync_count
|
||||
sqlite3_simulate_device -char safe_append
|
||||
|
||||
# With SAFE_APPEND set, there should only ever be one journal-header
|
||||
|
||||
@@ -9,12 +9,19 @@
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# $Id: mallocD.test,v 1.2 2007/09/03 07:31:10 danielk1977 Exp $
|
||||
# $Id: mallocD.test,v 1.3 2007/09/03 17:02:50 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
if {![source $testdir/malloc_common.tcl]} return
|
||||
# Only run these tests if memory debugging is turned on.
|
||||
#
|
||||
ifcapable !memdebug {
|
||||
puts "Skipping mallocD tests: not compiled with -DSQLITE_MEMDEBUG..."
|
||||
finish_test
|
||||
return
|
||||
}
|
||||
source $testdir/malloc_common.tcl
|
||||
|
||||
sqlite3_simulate_device -char atomic
|
||||
|
||||
@@ -52,4 +59,3 @@ do_malloc_test mallocD-4 -sqlprep $PREP -sqlbody {
|
||||
sqlite3_simulate_device -char {}
|
||||
|
||||
finish_test
|
||||
|
||||
|
||||
Reference in New Issue
Block a user