From: dan Date: Thu, 16 Jul 2020 14:52:24 +0000 (+0000) Subject: Modifications to test code so that the sqlite3MemdebugHastype() assert() statements... X-Git-Tag: version-3.33.0~53^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9a23d26cba46693ae634c7c0b1fdda9c0a115946;p=thirdparty%2Fsqlite.git Modifications to test code so that the sqlite3MemdebugHastype() assert() statements are enabled for Tcl tests. FossilOrigin-Name: e3c423cb1407c06a3806ae6304e4713c37cd446f4cc399731884e3d009938e57 --- diff --git a/manifest b/manifest index 7f1029dadf..dafe9def4d 100644 --- a/manifest +++ b/manifest @@ -1,6 +1,6 @@ B 7a876209a678a34c198b54ceef9e3c041f128a14dc73357f6a57cadadaa6cf7b -C Add\sOOM\stest\sfor\sUPDATE...FROM\sstatements\sinside\striggers. -D 2020-07-16T10:48:37.676 +C Modifications\sto\stest\scode\sso\sthat\sthe\ssqlite3MemdebugHastype()\sassert()\sstatements\sare\senabled\sfor\sTcl\stests. +D 2020-07-16T14:52:24.119 F Makefile.in 19374a5db06c3199ec1bab71ab74a103d8abf21053c05e9389255dc58083f806 F Makefile.msc 48f5a3fc32672c09ad73795749f6253e406a31526935fbbffd8f021108d54574 F autoconf/Makefile.am a8d1d24affe52ebf8d7ddcf91aa973fa0316618ab95bb68c87cabf8faf527dc8 @@ -22,6 +22,7 @@ F src/btreeInt.h 19267385aa3bc00067d48e0e4ba83ae82dc08b0c15a3b3df20ea653cb462b5b F src/build.c 45d912640987426442eb9eeec695c4dd45dd440b4cd27e8c13a42eed2fa87dcd F src/delete.c 410c771c25afc113c273d9efad6ab6881bda28c75a1838b9d2c52ba20d1dc704 F src/expr.c 90039a043658ce78c3237ba5064c0934b7294120f6adc387f8d0fba306028154 +F src/mem2.c b93b8762ab999a29ae7751532dadf0a1ac78040308a5fb1d17fcc365171d67eb F src/parse.y ecb9abdd79ec86c8dca7cb126bbdcf322c0e282f87a6d0d734ea5f2c57ced516 F src/pragma.c ae499b5ab8f4e833f67e28bf2322500e9aa612aadf12581d1324333f848d8b51 F src/pragma.h 8dc78ab7e9ec6ce3ded8332810a2066f1ef6267e2e03cd7356ee00276125c6cf @@ -30,6 +31,7 @@ F src/select.c a48570f614f777d02dd7f419789944225432a9231b2dbca863411ac19e5fb683 F src/shell.c.in 81fa23ac1a3d6ac9ed13e9ae711a3d8806396ca7cc12c5d6a2e2536f70b0c7ad F src/sqliteInt.h e2684c4ba7ee9c0a0529ae2eb847cc5bf923e4104a9d0944bf3d9d151856b6ab F src/test1.c fe56c4bcaa2685ca9aa25d817a0ee9345e189aff4a5a71a3d8ba946c7776feb8 +F src/test_malloc.c 21121ea85b49ec0bdb69995847cef9036ef9beca3ce63bbb776e4ea2ecc44b97 F src/trigger.c ef67bde309a831515dc3c2173d792574309f2f42d45f8c078743fae9f7f98c75 F src/update.c 9cfa2f840c69c28c5767b68cf38b4e7847e06ac0610978814f913d469d863900 F src/util.c c0bacc165f46169d2b720c37c8719165e383211698fad1de39dd16a8c161815a @@ -51,6 +53,7 @@ F test/gencol1.test b05e6c5edb9b10d48efb634ed07342441bddc89d225043e17095c36e5675 F test/ieee754.test b0945d12be7d255f3dfa18e2511b17ca37e0edd2b803231c52d05b86c04ab26e F test/pg_common.tcl 3b27542224db1e713ae387459b5d117c836a5f6e328846922993b6d2b7640d9f F test/speedtest1.c a8b5afe72d78ff365012aba48d3f0c579e957facb7630f765f58a6ae4656d20d +F test/tester.tcl 174f668fcb4569a775bf24534ac8e59ce47d3a56d37c3465d1857f027e7ec136 F test/triggerupfrom.test d25961fa70a99b6736193da7b49a36d8c1d28d56188f0be6406d4366315cd6e4 F test/upfrom1.tcl df984cb88010af1555812af55e9db44c4df50677395b45d1f30b69b1b6c07b73 F test/upfrom1.test 2ba1ed45b4a2161fc79f234b9ce4300b0d3deba545e3f23b938fb3ebdbf8758d @@ -65,7 +68,7 @@ F tool/mksqlite3c.tcl f4ef476510eca4124c874a72029f1e01bc54a896b1724e8f9eef0d8bfa F tool/mksqlite3h.tcl 1f5e4a1dbbbc43c83cc6e74fe32c6c620502240b66c7c0f33a51378e78fc4edf F tool/showlocks.c 9cc5e66d4ebbf2d194f39db2527ece92077e86ae627ddd233ee48e16e8142564 F tool/speed-check.sh 615cbdf50f1409ef3bbf9f682e396df80f49d97ed93ed3e61c8e91fae6afde58 -P 706c8da2f6d9299f0ad3b3c93332b38071e8e88b4d1660c1841309919b64fd18 -R fcab135d5deb5acb3d15005a264e9466 +P 917a479b0d11fb59abf41d0317ffc541eb4b83928df9382b4782953c0035fa3e +R fb6a1ab4975d53e851234a62b38830da U dan -Z 22e315bcc6851243145bd7812adea6f1 +Z 68e4ffd4fa7d2c07c4b216bcc8c920df diff --git a/manifest.uuid b/manifest.uuid index 3881159ae3..facb1334d7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -917a479b0d11fb59abf41d0317ffc541eb4b83928df9382b4782953c0035fa3e \ No newline at end of file +e3c423cb1407c06a3806ae6304e4713c37cd446f4cc399731884e3d009938e57 \ No newline at end of file diff --git a/src/mem2.c b/src/mem2.c index 51ea297c6a..ac031508c2 100644 --- a/src/mem2.c +++ b/src/mem2.c @@ -379,7 +379,7 @@ void sqlite3MemSetDefault(void){ ** Set the "type" of an allocation. */ void sqlite3MemdebugSetType(void *p, u8 eType){ - if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){ + if( p && sqlite3GlobalConfig.m.xFree==sqlite3MemFree ){ struct MemBlockHdr *pHdr; pHdr = sqlite3MemsysGetHeader(p); assert( pHdr->iForeGuard==FOREGUARD ); @@ -398,7 +398,7 @@ void sqlite3MemdebugSetType(void *p, u8 eType){ */ int sqlite3MemdebugHasType(void *p, u8 eType){ int rc = 1; - if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){ + if( p && sqlite3GlobalConfig.m.xFree==sqlite3MemFree ){ struct MemBlockHdr *pHdr; pHdr = sqlite3MemsysGetHeader(p); assert( pHdr->iForeGuard==FOREGUARD ); /* Allocation is valid */ @@ -420,7 +420,7 @@ int sqlite3MemdebugHasType(void *p, u8 eType){ */ int sqlite3MemdebugNoType(void *p, u8 eType){ int rc = 1; - if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){ + if( p && sqlite3GlobalConfig.m.xFree==sqlite3MemFree ){ struct MemBlockHdr *pHdr; pHdr = sqlite3MemsysGetHeader(p); assert( pHdr->iForeGuard==FOREGUARD ); /* Allocation is valid */ diff --git a/src/test_malloc.c b/src/test_malloc.c index 32a03e7191..8146501c9c 100644 --- a/src/test_malloc.c +++ b/src/test_malloc.c @@ -112,32 +112,6 @@ static void *faultsimRealloc(void *pOld, int n){ return p; } -/* -** The following method calls are passed directly through to the underlying -** malloc system: -** -** xFree -** xSize -** xRoundup -** xInit -** xShutdown -*/ -static void faultsimFree(void *p){ - memfault.m.xFree(p); -} -static int faultsimSize(void *p){ - return memfault.m.xSize(p); -} -static int faultsimRoundup(int n){ - return memfault.m.xRoundup(n); -} -static int faultsimInit(void *p){ - return memfault.m.xInit(memfault.m.pAppData); -} -static void faultsimShutdown(void *p){ - memfault.m.xShutdown(memfault.m.pAppData); -} - /* ** This routine configures the malloc failure simulation. After ** calling this routine, the next nDelay mallocs will succeed, followed @@ -204,16 +178,6 @@ static void faultsimEndBenign(void){ ** the argument is non-zero, the */ static int faultsimInstall(int install){ - static struct sqlite3_mem_methods m = { - faultsimMalloc, /* xMalloc */ - faultsimFree, /* xFree */ - faultsimRealloc, /* xRealloc */ - faultsimSize, /* xSize */ - faultsimRoundup, /* xRoundup */ - faultsimInit, /* xInit */ - faultsimShutdown, /* xShutdown */ - 0 /* pAppData */ - }; int rc; install = (install ? 1 : 0); @@ -227,6 +191,9 @@ static int faultsimInstall(int install){ rc = sqlite3_config(SQLITE_CONFIG_GETMALLOC, &memfault.m); assert(memfault.m.xMalloc); if( rc==SQLITE_OK ){ + sqlite3_mem_methods m = memfault.m; + m.xMalloc = faultsimMalloc; + m.xRealloc = faultsimRealloc; rc = sqlite3_config(SQLITE_CONFIG_MALLOC, &m); } sqlite3_test_control(SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, diff --git a/test/tester.tcl b/test/tester.tcl index cc7f913778..2915e216b2 100644 --- a/test/tester.tcl +++ b/test/tester.tcl @@ -129,6 +129,7 @@ if {[info command sqlite_orig]==""} { set ::dbhandle [lindex $args 0] uplevel #0 $::G(perm:dbconfig) } + [lindex $args 0] cache size 3 set res } else { # This command is not opening a new database connection. Pass the