1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Modifications to test code so that the sqlite3MemdebugHastype() assert() statements are enabled for Tcl tests.

FossilOrigin-Name: e3c423cb1407c06a3806ae6304e4713c37cd446f4cc399731884e3d009938e57
This commit is contained in:
dan
2020-07-16 14:52:24 +00:00
parent 01b2344b3c
commit 9a23d26cba
5 changed files with 16 additions and 45 deletions

View File

@@ -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,