diff options
author | dan <dan@noemail.net> | 2020-07-16 14:52:24 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2020-07-16 14:52:24 +0000 |
commit | 9a23d26cba46693ae634c7c0b1fdda9c0a115946 (patch) | |
tree | fe8689c47c9b3e44133da8e1029a78d85f6049dc /src/test_malloc.c | |
parent | 01b2344b3c13c2c7458aa9247a51c902e9a2a6a0 (diff) | |
download | sqlite-9a23d26cba46693ae634c7c0b1fdda9c0a115946.tar.gz sqlite-9a23d26cba46693ae634c7c0b1fdda9c0a115946.zip |
Modifications to test code so that the sqlite3MemdebugHastype() assert() statements are enabled for Tcl tests.
FossilOrigin-Name: e3c423cb1407c06a3806ae6304e4713c37cd446f4cc399731884e3d009938e57
Diffstat (limited to 'src/test_malloc.c')
-rw-r--r-- | src/test_malloc.c | 39 |
1 files changed, 3 insertions, 36 deletions
diff --git a/src/test_malloc.c b/src/test_malloc.c index 32a03e719..8146501c9 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, |