mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Add some further tests and a bugfix for the atomic-write optimization. (CVS 4276)
FossilOrigin-Name: 5f0fb894f44069c4aa9b8dba62b4d8a262c991de
This commit is contained in:
53
test/io.test
53
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.3 2007/08/23 08:06:45 danielk1977 Exp $
|
||||
# $Id: io.test,v 1.4 2007/08/23 11:07:10 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -265,6 +265,57 @@ do_test io-2.8.3 {
|
||||
}
|
||||
} {1 2 3 4 5 6 7 8}
|
||||
|
||||
# Test that the atomic write optimisation is not enabled if the sector
|
||||
# size is larger than the page-size.
|
||||
#
|
||||
do_test io-2.9.1 {
|
||||
sqlite3_simulate_device -char atomic -sectorsize 2048
|
||||
execsql {
|
||||
BEGIN;
|
||||
INSERT INTO abc VALUES(9, 10);
|
||||
}
|
||||
file exists test.db-journal
|
||||
} {1}
|
||||
do_test io-2.9.2 {
|
||||
execsql { ROLLBACK; }
|
||||
db close
|
||||
file delete -force test.db test.db-journal
|
||||
sqlite3 db test.db
|
||||
execsql {
|
||||
PRAGMA page_size = 2048;
|
||||
CREATE TABLE abc(a, b);
|
||||
}
|
||||
execsql {
|
||||
BEGIN;
|
||||
INSERT INTO abc VALUES(9, 10);
|
||||
}
|
||||
file exists test.db-journal
|
||||
} {0}
|
||||
do_test io-2.9.3 {
|
||||
execsql { COMMIT }
|
||||
} {}
|
||||
|
||||
# Test a couple of the more specific IOCAP_ATOMIC flags
|
||||
# (i.e IOCAP_ATOMIC2K etc.).
|
||||
#
|
||||
do_test io-2.10.1 {
|
||||
sqlite3_simulate_device -char atomic1k
|
||||
execsql {
|
||||
BEGIN;
|
||||
INSERT INTO abc VALUES(11, 12);
|
||||
}
|
||||
file exists test.db-journal
|
||||
} {1}
|
||||
do_test io-2.10.2 {
|
||||
execsql { ROLLBACK }
|
||||
sqlite3_simulate_device -char atomic2k
|
||||
execsql {
|
||||
BEGIN;
|
||||
INSERT INTO abc VALUES(11, 12);
|
||||
}
|
||||
file exists test.db-journal
|
||||
} {0}
|
||||
|
||||
sqlite3_simulate_device -char {} -sectorsize 0
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user