-C First\scode\sfor\sa\snew\sutility\sprogram\sto\srerun\schecks\son\sa\slarge\snumber\sof\nfuzzer-generated\stest\scases.
-D 2015-05-25T18:48:19.012
+C Add\sthe\s--dbid\sand\s--sqlid\sparameters\sto\sfuzzcheck.\s\sOther\sfuzzcheck\sfixes.
+D 2015-05-25T19:35:42.936
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 0a6ae26396ec696221021780dffbb894ff3cead7
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F test/fuzz3.test efd384b896c647b61a2c1848ba70d42aad60a7b3
F test/fuzz_common.tcl a87dfbb88c2a6b08a38e9a070dabd129e617b45b
F test/fuzz_malloc.test 328f70aaca63adf29b4c6f06505ed0cf57ca7c26
-F test/fuzzcheck.c ae31f7af026968cdb04d0452fb1e8031d4ca3aa9
+F test/fuzzcheck.c d544781b2a4651fc180642cc9a355c953dac851a
F test/fuzzdata1.txt 9fceb50868e0b798160e83742bd7e44e457176a0
F test/fuzzdata2.txt ba9b4467d7ec46cc85d32c0d031540cd727ae6ad
F test/fuzzer1.test d4c52aaf3ef923da293a2653cfab33d02f718a36
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 97806a78142b15f89878e25ee70dc5b0524d6793
-R 01232d1301acd5ee81dd9c394ecdbcf8
-T *branch * fuzzcheck
-T *sym-fuzzcheck *
-T -sym-trunk *
+P c5b4e363528aa1d2d5f41451f16de0aa91152b38
+R df1cffb558a450a54d1765e42395b4a9
U drh
-Z e7fd4cad8a5ae98c34f9373dc841d5b8
+Z 2a52604473d276af6452030585c0eebc
*/
static VFile *findVFile(const char *zName){
int i;
+ if( zName==0 ) return 0;
for(i=0; i<MX_FILE; i++){
if( g.aFile[i].zFilename==0 ) continue;
if( strcmp(g.aFile[i].zFilename, zName)==0 ) return &g.aFile[i];
for(i=0; i<MX_FILE && g.aFile[i].sz>=0; i++){}
if( i>=MX_FILE ) return 0;
pNew = &g.aFile[i];
- pNew->zFilename = safe_realloc(0, strlen(zName)+1);
- memcpy(pNew->zFilename, zName, strlen(zName)+1);
+ if( zName ){
+ pNew->zFilename = safe_realloc(0, strlen(zName)+1);
+ memcpy(pNew->zFilename, zName, strlen(zName)+1);
+ }else{
+ pNew->zFilename = 0;
+ }
pNew->nRef = 0;
pNew->sz = sz;
pNew->a = safe_realloc(0, sz);
fclose(in);
}
-/*
-** Print sketchy documentation for this utility program
-*/
-static void showHelp(void){
- printf("Usage: %s [options] SOURCE-DB ?ARGS...?\n", g.zArgv0);
- printf(
-"Read databases and SQL scripts from SOURCE-DB and execute each script against\n"
-"each database, checking for crashes and memory leaks.\n"
-"Options:\n"
-" --help Show this help text\n"
-" -q Reduced output\n"
-" --quiet Reduced output\n"
-" --load-sql ARGS... Load SQL scripts fro files into SOURCE-DB\n"
-" --load-db ARGS... Load template databases from files into SOURCE_DB\n"
-" -v Increased output\n"
-" --verbose Increased output\n"
- );
-}
-
/*
** Load a list of Blob objects from the database
*/
static void blobListLoadFromDb(
sqlite3 *db, /* Read from this database */
const char *zSql, /* Query used to extract the blobs */
+ int onlyId, /* Only load where id is this value */
int *pN, /* OUT: Write number of blobs loaded here */
Blob **ppList /* OUT: Write the head of the blob list here */
){
sqlite3_stmt *pStmt;
int n = 0;
int rc;
+ char *z2;
- rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
+ if( onlyId>0 ){
+ z2 = sqlite3_mprintf("%s WHERE rowid=%d", zSql, onlyId);
+ }else{
+ z2 = sqlite3_mprintf("%s", zSql);
+ }
+ rc = sqlite3_prepare_v2(db, z2, -1, &pStmt, 0);
+ sqlite3_free(z2);
if( rc ) fatalError("%s", sqlite3_errmsg(db));
head.pNext = 0;
p = &head;
VHandle *pHandle = (VHandle*)pFile;
VFile *pVFile = pHandle->pVFile;
if( iOfst+iAmt > pVFile->sz ){
- if( iOfst+iAmt >= MX_FILE_SZ ) return SQLITE_FULL;
+ if( iOfst+iAmt >= MX_FILE_SZ ){
+ return SQLITE_FULL;
+ }
pVFile->a = safe_realloc(pVFile->a, iOfst+iAmt);
memset(pVFile->a + pVFile->sz, 0, iOfst - pVFile->sz);
pVFile->sz = iOfst + iAmt;
){
VFile *pVFile = createVFile(zFilename, 0, (unsigned char*)"");
VHandle *pHandle = (VHandle*)pFile;
- if( pVFile==0 ) return SQLITE_FULL;
+ if( pVFile==0 ){
+ return SQLITE_FULL;
+ }
pHandle->pVFile = pVFile;
pVFile->nRef++;
pFile->pMethods = &VHandleMethods;
}
}
+/*
+** Print sketchy documentation for this utility program
+*/
+static void showHelp(void){
+ printf("Usage: %s [options] SOURCE-DB ?ARGS...?\n", g.zArgv0);
+ printf(
+"Read databases and SQL scripts from SOURCE-DB and execute each script against\n"
+"each database, checking for crashes and memory leaks.\n"
+"Options:\n"
+" --dbid N Use only the database where dbid=N\n"
+" --help Show this help text\n"
+" -q Reduced output\n"
+" --quiet Reduced output\n"
+" --load-sql ARGS... Load SQL scripts fro files into SOURCE-DB\n"
+" --load-db ARGS... Load template databases from files into SOURCE_DB\n"
+" --sqlid N Use only SQL where sqlid=N\n"
+" -v Increased output\n"
+" --verbose Increased output\n"
+ );
+}
+
int main(int argc, char **argv){
sqlite3_int64 iBegin; /* Start time of this program */
const char *zSourceDb = 0; /* Source database filename */
Blob *pSql; /* For looping over SQL scripts */
Blob *pDb; /* For looping over template databases */
int i; /* Loop index for the argv[] loop */
+ int onlySqlid = -1; /* --sqlid */
+ int onlyDbid = -1; /* --dbid */
iBegin = timeOfDay();
g.zArgv0 = argv[0];
if( z[0]=='-' ){
z++;
if( z[0]=='-' ) z++;
+ if( strcmp(z,"dbid")==0 ){
+ if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
+ onlyDbid = atoi(argv[++i]);
+ }else
if( strcmp(z,"help")==0 ){
showHelp();
return 0;
quietFlag = 1;
verboseFlag = 0;
}else
+ if( strcmp(z,"sqlid")==0 ){
+ if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
+ onlySqlid = atoi(argv[++i]);
+ }else
if( strcmp(z,"verbose")==0 || strcmp(z,"v")==0 ){
quietFlag = 0;
verboseFlag = 1;
/* Load all SQL script content and all initial database images from the
** source db
*/
- blobListLoadFromDb(db, "SELECT sqlid, sqltext FROM xsql", &g.nSql, &g.pFirstSql);
+ blobListLoadFromDb(db, "SELECT sqlid, sqltext FROM xsql", onlySqlid,
+ &g.nSql, &g.pFirstSql);
if( g.nSql==0 ) fatalError("need at least one SQL script");
- blobListLoadFromDb(db, "SELECT dbid, dbcontent FROM db", &g.nDb, &g.pFirstDb);
+ blobListLoadFromDb(db, "SELECT dbid, dbcontent FROM db", onlyDbid,
+ &g.nDb, &g.pFirstDb);
if( g.nDb==0 ){
g.pFirstDb = safe_realloc(0, sizeof(Blob));
memset(g.pFirstDb, 0, sizeof(Blob));