Add virtual table test cases to dbstatus.test.

FossilOrigin-Name: 72b84d066a4eac90a77142c3ea66ef3d21a1104e
This commit is contained in:
dan 2010-07-26 14:47:14 +00:00
parent f37c68e036
commit ccd4ad3e6c
4 changed files with 56 additions and 23 deletions

View File

@ -1,8 +1,5 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
C Further\sfixes\sto\sthe\sP4_MEM\ssize\smeasurement\slogic.
D 2010-07-26T14:20:07
C Add\svirtual\stable\stest\scases\sto\sdbstatus.test.
D 2010-07-26T14:47:14
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -139,7 +136,7 @@ F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
F src/loadext.c 6d422ea91cf3d2d00408c5a8f2391cd458da85f8
F src/main.c a487fe90aecaccb142e4a6b738c7e26e99145bcd
F src/malloc.c 1cf0f2f45926c40b638e85e9b67fe5fabd072829
F src/malloc.c 9d7dc6a52aa13ba3639eb40c573dd7adb3a16813
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c 89d4ea8d5cdd55635cbaa48ad53132af6294cbb2
F src/mem2.c 12c91260fd2320eda9355dea5445b137f848c05b
@ -333,7 +330,7 @@ F test/createtab.test 199cf68f44e5d9e87a0b8afc7130fdeb4def3272
F test/cse.test 277350a26264495e86b1785f34d2d0c8600e021c
F test/ctime.test 7bd009071e242aac4f18521581536b652b789a47
F test/date.test 6354b883f922c38046a8efbad187cc95df6da023
F test/dbstatus.test 77ff0d38db69b4136a6db168c9e1b23f41276201
F test/dbstatus.test 1a536e002020392ec946a916f727836394566e3d
F test/default.test 6faf23ccb300114924353007795aa9a8ec0aa9dc
F test/delete.test f7629d9eb245dfca170169cc5c7a735dec34aeb4
F test/delete2.test 3a03f2cca1f9a67ec469915cb8babd6485db43fa
@ -841,14 +838,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
P 8166f33885b86029bb8a0fbaf70606a0d2d5ec2e
R 206ab46db8056d477c83ba4fb6c527f4
U drh
Z 33466832801b7ba31895995976b46d64
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFMTZmaoxKgR168RlERAn+pAJ4rC1olXw/iDp2XbDUFSLTSJSuc+wCfRE9f
5SDUlQ0qZ1NrdW8jGONN1jQ=
=xJpP
-----END PGP SIGNATURE-----
P 934cda2987c331b57a195ed45e9a91794896672a
R c1701c0ea6fc39bdd7ca655ca980d689
U dan
Z 9ecff26939461d0a9295122b2a8fa08b

View File

@ -1 +1 @@
934cda2987c331b57a195ed45e9a91794896672a
72b84d066a4eac90a77142c3ea66ef3d21a1104e

View File

@ -581,6 +581,7 @@ void *sqlite3DbMallocZero(sqlite3 *db, int n){
void *sqlite3DbMallocRaw(sqlite3 *db, int n){
void *p;
assert( db==0 || sqlite3_mutex_held(db->mutex) );
assert( db==0 || db->pnBytesFreed==0 );
#ifndef SQLITE_OMIT_LOOKASIDE
if( db ){
LookasideSlot *pBuf;

View File

@ -133,6 +133,10 @@ foreach ::lookaside_buffer_size {0 64 120} {
END;
SELECT * FROM v1;
}
8x {
CREATE TABLE t1(a, b, UNIQUE(a, b));
CREATE VIRTUAL TABLE t2 USING echo(t1);
}
} {
set tn "$::lookaside_buffer_size-$tn"
@ -142,6 +146,9 @@ foreach ::lookaside_buffer_size {0 64 120} {
sqlite3 db test.db
sqlite3_db_config_lookaside db 0 $::lookaside_buffer_size 500
db cache size 0
catch { register_echo_module db }
ifcapable !vtab { if {[string match *x $tn]} continue }
# Step 2.
execsql $schema
@ -166,9 +173,20 @@ foreach ::lookaside_buffer_size {0 64 120} {
set nAlloc4 [lindex [sqlite3_status SQLITE_STATUS_MEMORY_USED 0] 1]
incr nAlloc4 [lookaside db]
set nSchema4 [lindex [sqlite3_db_status db SQLITE_DBSTATUS_SCHEMA_USED 0] 1]
set nFree [expr {$nAlloc1-$nAlloc2}]
do_test dbstatus-2.$tn.a { expr {$nSchema1-$nSchema2} } $nFree
# Tests for which the test name ends in an "x" report slightly less
# memory than is actually freed when all statements are finalized.
# This is because a small amount of memory allocated by a virtual table
# implementation using sqlite3_mprintf() is technically considered
# external and so is not counted as "statement memory".
#
if {[string match *x $tn]} {
do_test dbstatus-2.$tn.ax { expr {($nSchema1-$nSchema2)<=$nFree} } 1
} else {
do_test dbstatus-2.$tn.a { expr {$nSchema1-$nSchema2} } $nFree
}
do_test dbstatus-2.$tn.b { list $nAlloc1 $nSchema1 } "$nAlloc3 $nSchema3"
do_test dbstatus-2.$tn.c { list $nAlloc2 $nSchema2 } "$nAlloc4 $nSchema4"
}
@ -239,6 +257,14 @@ foreach ::lookaside_buffer_size {0 64 120} {
} {
SELECT count(*) FROM t1 WHERE upper(a)='ABC';
}
5x {
CREATE TABLE t1(a, b UNIQUE);
CREATE VIRTUAL TABLE t2 USING echo(t1);
} {
SELECT count(*) FROM t2;
SELECT * FROM t2 WHERE b>5;
SELECT * FROM t2 WHERE b='abcdefg';
}
} {
set tn "$::lookaside_buffer_size-$tn"
@ -248,6 +274,9 @@ foreach ::lookaside_buffer_size {0 64 120} {
sqlite3 db test.db
sqlite3_db_config_lookaside db 0 $::lookaside_buffer_size 500
db cache size 1000
catch { register_echo_module db }
ifcapable !vtab { if {[string match *x $tn]} continue }
execsql $schema
db cache flush
@ -279,8 +308,21 @@ foreach ::lookaside_buffer_size {0 64 120} {
set nStmt4 [lindex [sqlite3_db_status db SQLITE_DBSTATUS_STMT_USED 0] 1]
set nFree [expr {$nAlloc1-$nAlloc2}]
do_test dbstatus-3.$tn.a { list $nStmt2 } {0}
do_test dbstatus-3.$tn.b { list $nStmt1 } [list $nFree]
do_test dbstatus-3.$tn.a { expr $nStmt2 } {0}
# Tests for which the test name ends in an "x" report slightly less
# memory than is actually freed when all statements are finalized.
# This is because a small amount of memory allocated by a virtual table
# implementation using sqlite3_mprintf() is technically considered
# external and so is not counted as "statement memory".
#
if {[string match *x $tn]} {
do_test dbstatus-3.$tn.bx { expr $nStmt1<=$nFree } {1}
} else {
do_test dbstatus-3.$tn.b { expr $nStmt1==$nFree } {1}
}
do_test dbstatus-3.$tn.c { list $nAlloc1 $nStmt1 } [list $nAlloc3 $nStmt3]
do_test dbstatus-3.$tn.d { list $nAlloc2 $nStmt2 } [list $nAlloc4 $nStmt4]
}