Index: third_party/sqlite/src/test/dbstatus.test |
diff --git a/third_party/sqlite/src/test/dbstatus.test b/third_party/sqlite/src/test/dbstatus.test |
index 368c6b28e59a3f806b07a96ef053f08304a1ec9f..711d66ebb3f8eb693730ba46a993fb6634cde594 100644 |
--- a/third_party/sqlite/src/test/dbstatus.test |
+++ b/third_party/sqlite/src/test/dbstatus.test |
@@ -14,6 +14,7 @@ |
set testdir [file dirname $argv0] |
source $testdir/tester.tcl |
+set testprefix dbstatus |
ifcapable !compound { |
finish_test |
@@ -24,6 +25,7 @@ ifcapable !compound { |
db close |
sqlite3_shutdown |
sqlite3_config_memstatus 1 |
+sqlite3_config_uri 1 |
sqlite3_initialize |
sqlite3 db test.db |
@@ -67,16 +69,12 @@ ifcapable stat4||stat3 { |
set STAT3 0 |
} |
-ifcapable malloc_usable_size { |
- finish_test |
- return |
-} |
- |
#--------------------------------------------------------------------------- |
# Run the dbstatus-2 and dbstatus-3 tests with several of different |
# lookaside buffer sizes. |
# |
foreach ::lookaside_buffer_size {0 64 120} { |
+ ifcapable malloc_usable_size break |
# Do not run any of these tests if there is SQL configured to run |
# as part of the [sqlite3] command. This prevents the script from |
@@ -377,4 +375,44 @@ foreach ::lookaside_buffer_size {0 64 120} { |
} |
} |
+#------------------------------------------------------------------------- |
+# The following tests focus on DBSTATUS_CACHE_USED_SHARED |
+# |
+ifcapable shared_cache { |
+ if {[permutation]=="memsys3" |
+ || [permutation]=="memsys5" |
+ || $::tcl_platform(os)=="Linux"} { |
+ proc do_cacheused_test {tn db res} { |
+ set cu [sqlite3_db_status $db SQLITE_DBSTATUS_CACHE_USED 0] |
+ set pcu [sqlite3_db_status $db SQLITE_DBSTATUS_CACHE_USED_SHARED 0] |
+ set cu [lindex $cu 1] |
+ set pcu [lindex $pcu 1] |
+ uplevel [list do_test $tn [list list $cu $pcu] "#/$res/"] |
+ } |
+ reset_db |
+ sqlite3 db file:test.db?cache=shared |
+ |
+ do_execsql_test 4.0 { |
+ PRAGMA auto_vacuum=NONE; |
+ CREATE TABLE t1(a, b, c); |
+ INSERT INTO t1 VALUES(1, 2, 3); |
+ } |
+ do_cacheused_test 4.0.1 db { 4568 4568 } |
+ do_execsql_test 4.1 { |
+ CREATE TEMP TABLE tt(a, b, c); |
+ INSERT INTO tt VALUES(1, 2, 3); |
+ } |
+ do_cacheused_test 4.1.1 db { 9000 9000 } |
+ |
+ sqlite3 db2 file:test.db?cache=shared |
+ do_cacheused_test 4.2.1 db2 { 4568 2284 } |
+ do_cacheused_test 4.2.2 db { 9000 6716 } |
+ db close |
+ do_cacheused_test 4.2.3 db2 { 4568 4568 } |
+ sqlite3 db file:test.db?cache=shared |
+ do_cacheused_test 4.2.4 db2 { 4568 2284 } |
+ db2 close |
+ } |
+} |
+ |
finish_test |