Test that two database connections that use different VFS implementations may not share a cache. (CVS 6426)

FossilOrigin-Name: 3a92c95644ead7c4728ffec1ec70676663518188
This commit is contained in:
danielk1977 2009-04-01 18:25:54 +00:00
parent 20c6cc2b1b
commit 856cc0fde9
3 changed files with 67 additions and 26 deletions

@ -1,5 +1,5 @@
C Remove\sthe\sunused\sSQLITE_Vtab\sflag.\s(CVS\s6425)
D 2009-04-01T18:03:01
C Test\sthat\stwo\sdatabase\sconnections\sthat\suse\sdifferent\sVFS\simplementations\smay\snot\sshare\sa\scache.\s(CVS\s6426)
D 2009-04-01T18:25:54
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -532,7 +532,7 @@ F test/shared.test 3b448dc0f7a9356e641894ed81c27599f39d809d
F test/shared2.test 8973e41e008acbbd8d1b191b91a23cd472f058e8
F test/shared3.test 9c880afc081d797da514ef64bccf36f3fce2f09c
F test/shared4.test d0fadacb50bb6981b2fb9dc6d1da30fa1edddf83
F test/shared6.test 9c155088d28bcaa5d87c52b6406ef5d0e7086e8e
F test/shared6.test d3e0db3cbfb0d64933d8a9016f7eaa40f15a60ac
F test/shared_err.test 91e26ec4f3fbe07951967955585137e2f18993de
F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3
F test/sidedelete.test f0ad71abe6233e3b153100f3b8d679b19a488329
@ -714,7 +714,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 0c5a7d1117cfb322d1c89da89e8887b0bb091602
R f26d04d59d851cd92941bca4f5f8b7ce
P fdd78962fcb988edfb4147394045fc5d3944c620
R a659db632b7a8a1ae5444e52a2d0dea6
U danielk1977
Z fe1f6bbbe7362bf487c77efb4897a843
Z c2cd1ad66ce2a9347f9799395978b43a

@ -1 +1 @@
fdd78962fcb988edfb4147394045fc5d3944c620
3a92c95644ead7c4728ffec1ec70676663518188

@ -9,25 +9,25 @@
#
#***********************************************************************
#
# $Id: shared6.test,v 1.1 2009/04/01 09:41:54 danielk1977 Exp $
# $Id: shared6.test,v 1.2 2009/04/01 18:25:54 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
ifcapable !shared_cache { finish_test ; return }
do_test shared7-1.1.1 {
do_test shared6-1.1.1 {
execsql {
CREATE TABLE t1(a, b);
CREATE TABLE t2(c, d);
CREATE TABLE t3(e, f);
}
} {}
do_test shared7-1.1.2 {
do_test shared6-1.1.2 {
set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
sqlite3_enable_shared_cache
} {1}
do_test shared7-1.1.3 {
do_test shared6-1.1.3 {
sqlite3 db1 test.db
sqlite3 db2 test.db
} {}
@ -38,15 +38,15 @@ do_test shared7-1.1.3 {
# 1.2.2: If [db1] has an exclusive lock, [db1] can read.
# 1.2.3: If [db1] has a non-exclusive write-lock, [db2] can read.
#
do_test shared7-1.2.1 {
do_test shared6-1.2.1 {
execsql { SELECT * FROM t1 } db2 ;# Cache a compiled statement
execsql { BEGIN EXCLUSIVE } db1
catchsql { SELECT * FROM t1 } db2 ;# Execute the cached compiled statement
} {1 {database table is locked}}
do_test shared7-1.2.2 {
do_test shared6-1.2.2 {
execsql { SELECT * FROM t1 } db1
} {}
do_test shared7-1.2.3 {
do_test shared6-1.2.3 {
execsql {
COMMIT;
BEGIN;
@ -54,7 +54,7 @@ do_test shared7-1.2.3 {
} db1
execsql { SELECT * FROM t1 } db2
} {}
do_test shared7-1.2.X {
do_test shared6-1.2.X {
execsql { COMMIT } db1
} {}
@ -67,23 +67,23 @@ do_test shared7-1.2.X {
# 1.3.5: If [db1] has a read-lock on t1, [db2] can read from t1.
# 1.3.6: If [db1] has a read-lock on t1, [db2] cannot write to t1.
#
do_test shared7-1.3.1 {
do_test shared6-1.3.1 {
execsql {
BEGIN;
INSERT INTO t1 VALUES(1, 2);
} db1
execsql { SELECT * FROM t1 } db1
} {1 2}
do_test shared7-1.3.2 {
do_test shared6-1.3.2 {
execsql { SELECT * FROM t2 } db2
} {3 4}
do_test shared7-1.3.3 {
do_test shared6-1.3.3 {
catchsql { SELECT * FROM t1 } db2
} {1 {database table is locked: t1}}
do_test shared7-1.3.4 {
do_test shared6-1.3.4 {
catchsql { INSERT INTO t2 VALUES(1, 2) } db2
} {1 {database table is locked}}
do_test shared7-1.3.5 {
do_test shared6-1.3.5 {
execsql {
COMMIT;
BEGIN;
@ -91,10 +91,10 @@ do_test shared7-1.3.5 {
} db1
execsql { SELECT * FROM t1 } db2
} {1 2}
do_test shared7-1.3.5 {
do_test shared6-1.3.5 {
catchsql { INSERT INTO t1 VALUES(5, 6) } db2
} {1 {database table is locked: t1}}
do_test shared7-1.3.X {
do_test shared6-1.3.X {
execsql { COMMIT } db1
} {}
@ -107,7 +107,7 @@ do_test shared7-1.3.X {
# [db2] cannot read from the schema.
# 1.4.3: If [db1] has a read-lock on t1, [db2] cannot write to t1.
#
do_test shared7-1.4.1 {
do_test shared6-1.4.1 {
execsql { PRAGMA read_uncommitted = 1 } db2
execsql {
BEGIN;
@ -115,11 +115,11 @@ do_test shared7-1.4.1 {
} db1
execsql { SELECT * FROM t1 } db2
} {1 2 5 6}
do_test shared7-1.4.2 {
do_test shared6-1.4.2 {
execsql { CREATE TABLE t4(a, b) } db1
catchsql { SELECT * FROM t1 } db2
} {1 {database table is locked}}
do_test shared7-1.4.3 {
do_test shared6-1.4.3 {
execsql {
COMMIT;
BEGIN;
@ -128,11 +128,52 @@ do_test shared7-1.4.3 {
catchsql { INSERT INTO t1 VALUES(7, 8) } db2
} {1 {database table is locked: t1}}
do_test shared7-1.X {
do_test shared6-1.X {
db1 close
db2 close
} {}
# The following tests - shared6-2.* - test that two database connections
# that connect to the same file using different VFS implementations do
# not share a cache.
if {$::tcl_platform(platform) eq "unix"} {
do_test shared6-2.1 {
sqlite3 db1 test.db -vfs unix
sqlite3 db2 test.db -vfs unix
sqlite3 db3 test.db -vfs unix-none
sqlite3 db4 test.db -vfs unix-none
} {}
do_test shared6-2.2 {
execsql { BEGIN; INSERT INTO t1 VALUES(9, 10); } db1
catchsql { SELECT * FROM t1 } db2
} {1 {database table is locked: t1}}
do_test shared6-2.3 {
execsql { SELECT * FROM t1 } db3
} {1 2 5 6}
do_test shared6-2.3 {
execsql { COMMIT } db1
execsql { BEGIN; INSERT INTO t1 VALUES(11, 12); } db3
catchsql { SELECT * FROM t1 } db4
} {1 {database table is locked: t1}}
do_test shared6-2.4 {
execsql { SELECT * FROM t1 } db1
} {1 2 5 6 9 10}
do_test shared6-2.5 {
execsql { COMMIT } db3
} {}
do_test shared6-2.X {
db1 close
db2 close
db3 close
db4 close
} {}
}
sqlite3_enable_shared_cache $::enable_shared_cache
finish_test