| 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 202f34a0435f928e93784e7724e0700280f48979..368c6b28e59a3f806b07a96ef053f08304a1ec9f 100644
|
| --- a/third_party/sqlite/src/test/dbstatus.test
|
| +++ b/third_party/sqlite/src/test/dbstatus.test
|
| @@ -15,6 +15,11 @@
|
| set testdir [file dirname $argv0]
|
| source $testdir/tester.tcl
|
|
|
| +ifcapable !compound {
|
| + finish_test
|
| + return
|
| +}
|
| +
|
| # Memory statistics must be enabled for this test.
|
| db close
|
| sqlite3_shutdown
|
| @@ -56,6 +61,17 @@ proc lookaside {db} {
|
| }
|
| }
|
|
|
| +ifcapable stat4||stat3 {
|
| + set STAT3 1
|
| +} else {
|
| + 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.
|
| @@ -118,7 +134,7 @@ foreach ::lookaside_buffer_size {0 64 120} {
|
| CREATE TABLE t2(c, d);
|
| CREATE VIEW v1 AS SELECT * FROM t1 UNION SELECT * FROM t2;
|
| }
|
| - 6 {
|
| + 6k {
|
| CREATE TABLE t1(a, b);
|
| CREATE INDEX i1 ON t1(a);
|
| CREATE INDEX i2 ON t1(a,b);
|
| @@ -155,7 +171,7 @@ foreach ::lookaside_buffer_size {0 64 120} {
|
|
|
| # Step 1.
|
| db close
|
| - file delete -force test.db
|
| + forcedelete test.db
|
| sqlite3 db test.db
|
| sqlite3_db_config_lookaside db 0 $::lookaside_buffer_size 500
|
| db cache size 0
|
| @@ -188,6 +204,11 @@ foreach ::lookaside_buffer_size {0 64 120} {
|
| set nSchema4 [lindex [sqlite3_db_status db SQLITE_DBSTATUS_SCHEMA_USED 0] 1]
|
| set nFree [expr {$nAlloc1-$nAlloc2}]
|
|
|
| + # Tests for which the test name ends in an "k" report slightly less
|
| + # memory than is actually freed when all schema items are finalized.
|
| + # This is because memory allocated by KeyInfo objects is no longer
|
| + # counted as "schema memory".
|
| + #
|
| # Tests for which the test name ends in an "x" report slightly less
|
| # memory than is actually freed when all schema items are finalized.
|
| # This is because memory allocated by virtual table implementations
|
| @@ -198,7 +219,17 @@ foreach ::lookaside_buffer_size {0 64 120} {
|
| # much greater than just that reported by DBSTATUS_SCHEMA_USED in this
|
| # case.
|
| #
|
| - if {[string match *x $tn] || $AUTOVACUUM} {
|
| + # Some of the memory used for sqlite_stat4 is unaccounted for by
|
| + # dbstatus.
|
| + #
|
| + # Finally, on osx the estimate of memory used by the schema may be
|
| + # slightly low.
|
| + #
|
| + if {[string match *k $tn]
|
| + || [string match *x $tn] || $AUTOVACUUM
|
| + || ([string match *y $tn] && $STAT3)
|
| + || ($::tcl_platform(os) == "Darwin")
|
| + } {
|
| do_test dbstatus-2.$tn.ax { expr {($nSchema1-$nSchema2)<=$nFree} } 1
|
| } else {
|
| do_test dbstatus-2.$tn.a { expr {$nSchema1-$nSchema2} } $nFree
|
| @@ -221,7 +252,7 @@ foreach ::lookaside_buffer_size {0 64 120} {
|
| # lookaside memory allocated by SQLite, and the memory allocated
|
| # for the prepared statements according to sqlite3_db_status().
|
| #
|
| - # 3. Finalize all prepared statements Measure the total memory
|
| + # 3. Finalize all prepared statements. Measure the total memory
|
| # and the prepared statement memory again.
|
| #
|
| # 4. Repeat step 2.
|
| @@ -287,7 +318,7 @@ foreach ::lookaside_buffer_size {0 64 120} {
|
|
|
| # Step 1.
|
| db close
|
| - file delete -force test.db
|
| + forcedelete test.db
|
| sqlite3 db test.db
|
| sqlite3_db_config_lookaside db 0 $::lookaside_buffer_size 500
|
| db cache size 1000
|
|
|