diff options
Diffstat (limited to 'test/fuzzcheck.c')
-rw-r--r-- | test/fuzzcheck.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/test/fuzzcheck.c b/test/fuzzcheck.c index 2efe68440..fd72273f3 100644 --- a/test/fuzzcheck.c +++ b/test/fuzzcheck.c @@ -805,6 +805,7 @@ static void showHelp(void){ " --load-db ARGS... Load template databases from files into SOURCE_DB\n" " -m TEXT Add a description to the database\n" " --native-vfs Use the native VFS for initially empty database files\n" +" --native-malloc Turn off MEMSYS3/5 and Lookaside\n" " --oss-fuzz Enable OSS-FUZZ testing\n" " --prng-seed N Seed value for the PRGN inside of SQLite\n" " --rebuild Rebuild and vacuum the database file\n" @@ -851,6 +852,7 @@ int main(int argc, char **argv){ void *pHeap = 0; /* Heap for use by SQLite */ int ossFuzz = 0; /* enable OSS-FUZZ testing */ int ossFuzzThisDb = 0; /* ossFuzz value for this particular database */ + int nativeMalloc = 0; /* Turn off MEMSYS3/5 and lookaside if true */ sqlite3_vfs *pDfltVfs; /* The default VFS */ iBegin = timeOfDay(); @@ -911,6 +913,9 @@ int main(int argc, char **argv){ if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]); zMsg = argv[++i]; }else + if( strcmp(z,"native-malloc")==0 ){ + nativeMalloc = 1; + }else if( strcmp(z,"native-vfs")==0 ){ nativeFlag = 1; }else @@ -1013,7 +1018,7 @@ int main(int argc, char **argv){ ossFuzzThisDb = sqlite3_column_int(pStmt,1); if( verboseFlag ) printf("Config: oss-fuzz=%d\n", ossFuzzThisDb); } - if( strcmp(zName, "limit-mem")==0 ){ + if( strcmp(zName, "limit-mem")==0 && !nativeMalloc ){ #if !defined(SQLITE_ENABLE_MEMSYS3) && !defined(SQLITE_ENABLE_MEMSYS5) fatalError("the limit-mem option requires -DSQLITE_ENABLE_MEMSYS5" " or _MEMSYS3"); @@ -1143,14 +1148,19 @@ int main(int argc, char **argv){ } /* Limit available memory, if requested */ - if( nMemThisDb>0 ){ - sqlite3_shutdown(); + sqlite3_shutdown(); + if( nMemThisDb>0 && !nativeMalloc ){ pHeap = realloc(pHeap, nMemThisDb); if( pHeap==0 ){ fatalError("failed to allocate %d bytes of heap memory", nMem); } sqlite3_config(SQLITE_CONFIG_HEAP, pHeap, nMemThisDb, 128); } + + /* Disable lookaside with the --native-malloc option */ + if( nativeMalloc ){ + sqlite3_config(SQLITE_CONFIG_LOOKASIDE, 0, 0); + } /* Reset the in-memory virtual filesystem */ formatVfs(); @@ -1207,9 +1217,13 @@ int main(int argc, char **argv){ runSql(db, (char*)pSql->a, runFlags); }while( timeoutTest ); setAlarm(0); + sqlite3_exec(db, "PRAGMA temp_store_directory=''", 0, 0, 0); sqlite3_close(db); } - if( sqlite3_memory_used()>0 ) fatalError("memory leak"); + if( sqlite3_memory_used()>0 ){ + fatalError("memory leak: %lld bytes outstanding", + sqlite3_memory_used()); + } reformatVfs(); nTest++; g.zTestName[0] = 0; |