mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-27 20:41:58 +03:00
In the fuzzershell, always invoke the trace and log callbacks even if output
is suppressed. Keep track of the current test name in a global variable for simplified debugging. FossilOrigin-Name: 3045f454817f657df801358c40c665b0b0d73c1f
This commit is contained in:
@ -79,6 +79,7 @@ struct GlobalVars {
|
||||
int bOomOnce; /* Fail just once if true */
|
||||
int bOomEnable; /* True to enable OOM simulation */
|
||||
int nOomBrkpt; /* Number of calls to oomFault() */
|
||||
char zTestName[100]; /* Name of current test */
|
||||
} g;
|
||||
|
||||
/*
|
||||
@ -166,6 +167,9 @@ static void shellLog(void *pNotUsed, int iErrCode, const char *zMsg){
|
||||
printf("LOG: (%d) %s\n", iErrCode, zMsg);
|
||||
fflush(stdout);
|
||||
}
|
||||
static void shellLogNoop(void *pNotUsed, int iErrCode, const char *zMsg){
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
** This callback is invoked by sqlite3_exec() to return query results.
|
||||
@ -198,6 +202,9 @@ static void traceCallback(void *NotUsed, const char *zMsg){
|
||||
printf("TRACE: %s\n", zMsg);
|
||||
fflush(stdout);
|
||||
}
|
||||
static void traceNoop(void *NotUsed, const char *zMsg){
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/***************************************************************************
|
||||
@ -525,7 +532,7 @@ int main(int argc, char **argv){
|
||||
abendError("unknown argument: %s", argv[i]);
|
||||
}
|
||||
}
|
||||
if( verboseFlag ) sqlite3_config(SQLITE_CONFIG_LOG, shellLog, 0);
|
||||
sqlite3_config(SQLITE_CONFIG_LOG, verboseFlag ? shellLog : shellLogNoop, 0);
|
||||
if( nHeap>0 ){
|
||||
pHeap = malloc( nHeap );
|
||||
if( pHeap==0 ) fatalError("cannot allocate %d-byte heap\n", nHeap);
|
||||
@ -597,6 +604,8 @@ int main(int argc, char **argv){
|
||||
char *z = strstr(&zIn[i], ">****/");
|
||||
if( z ){
|
||||
z += 6;
|
||||
sqlite3_snprintf(sizeof(g.zTestName), g.zTestName, "%.*",
|
||||
(int)(z-&zIn[i]), &zIn[i]);
|
||||
if( verboseFlag ){
|
||||
printf("%.*s\n", (int)(z-&zIn[i]), &zIn[i]);
|
||||
fflush(stdout);
|
||||
@ -678,7 +687,7 @@ int main(int argc, char **argv){
|
||||
sqlite3_backup_finish(pBackup);
|
||||
}
|
||||
#ifndef SQLITE_OMIT_TRACE
|
||||
if( verboseFlag ) sqlite3_trace(db, traceCallback, 0);
|
||||
sqlite3_trace(db, verboseFlag ? traceCallback : traceNoop, 0);
|
||||
#endif
|
||||
sqlite3_create_function(db, "eval", 1, SQLITE_UTF8, 0, sqlEvalFunc, 0, 0);
|
||||
sqlite3_create_function(db, "eval", 2, SQLITE_UTF8, 0, sqlEvalFunc, 0, 0);
|
||||
|
Reference in New Issue
Block a user