/ Check-in [1caaaaa7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add the --info option to the fuzzcheck test utility.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1caaaaa70f21fe71fbe0af227eea8d1367870e2575eedf248cc2a0b515783390
User & Date: drh 2018-08-06 01:39:31
Context
2018-08-06
02:08
Enhance the edit() function so that it converts text from \r\n back into \n only if the original unedited copy contained no \r\n values. check-in: 20c995d3 user: drh tags: trunk
01:39
Add the --info option to the fuzzcheck test utility. check-in: 1caaaaa7 user: drh tags: trunk
01:21
Fix an overzealous assert() statement discovered by OSSFuzz. check-in: d9c9fe9f user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/fuzzcheck.c.

   802    802   "each database, checking for crashes and memory leaks.\n"
   803    803   "Options:\n"
   804    804   "  --cell-size-check    Set the PRAGMA cell_size_check=ON\n"
   805    805   "  --dbid N             Use only the database where dbid=N\n"
   806    806   "  --export-db DIR      Write databases to files(s) in DIR. Works with --dbid\n"
   807    807   "  --export-sql DIR     Write SQL to file(s) in DIR. Also works with --sqlid\n"
   808    808   "  --help               Show this help text\n"
   809         -"  -q|--quiet           Reduced output\n"
          809  +"  --info               Show information about SOURCE-DB w/o running tests\n"
   810    810   "  --limit-mem N        Limit memory used by test SQLite instance to N bytes\n"
   811    811   "  --limit-vdbe         Panic if any test runs for more than 100,000 cycles\n"
   812    812   "  --load-sql ARGS...   Load SQL scripts fron files into SOURCE-DB\n"
   813    813   "  --load-db ARGS...    Load template databases from files into SOURCE_DB\n"
   814    814   "  -m TEXT              Add a description to the database\n"
   815    815   "  --native-vfs         Use the native VFS for initially empty database files\n"
   816    816   "  --native-malloc      Turn off MEMSYS3/5 and Lookaside\n"
   817    817   "  --oss-fuzz           Enable OSS-FUZZ testing\n"
   818    818   "  --prng-seed N        Seed value for the PRGN inside of SQLite\n"
          819  +"  -q|--quiet           Reduced output\n"
   819    820   "  --rebuild            Rebuild and vacuum the database file\n"
   820    821   "  --result-trace       Show the results of each SQL command\n"
   821    822   "  --sqlid N            Use only SQL where sqlid=N\n"
   822    823   "  --timeout N          Abort if any single test needs more than N seconds\n"
   823    824   "  -v|--verbose         Increased output.  Repeat for more output.\n"
   824    825     );
   825    826   }
................................................................................
   837    838     Blob *pDb;                   /* For looping over template databases */
   838    839     int i;                       /* Loop index for the argv[] loop */
   839    840     int onlySqlid = -1;          /* --sqlid */
   840    841     int onlyDbid = -1;           /* --dbid */
   841    842     int nativeFlag = 0;          /* --native-vfs */
   842    843     int rebuildFlag = 0;         /* --rebuild */
   843    844     int vdbeLimitFlag = 0;       /* --limit-vdbe */
          845  +  int infoFlag = 0;            /* --info */
   844    846     int timeoutTest = 0;         /* undocumented --timeout-test flag */
   845    847     int runFlags = 0;            /* Flags sent to runSql() */
   846    848     char *zMsg = 0;              /* Add this message */
   847    849     int nSrcDb = 0;              /* Number of source databases */
   848    850     char **azSrcDb = 0;          /* Array of source database names */
   849    851     int iSrcDb;                  /* Loop over all source databases */
   850    852     int nTest = 0;               /* Total number of tests performed */
................................................................................
   892    894         if( strcmp(z,"export-sql")==0 ){
   893    895           if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
   894    896           zExpSql = argv[++i];
   895    897         }else
   896    898         if( strcmp(z,"help")==0 ){
   897    899           showHelp();
   898    900           return 0;
          901  +      }else
          902  +      if( strcmp(z,"info")==0 ){
          903  +        infoFlag = 1;
   899    904         }else
   900    905         if( strcmp(z,"limit-mem")==0 ){
   901    906   #if !defined(SQLITE_ENABLE_MEMSYS3) && !defined(SQLITE_ENABLE_MEMSYS5)
   902    907           fatalError("the %s option requires -DSQLITE_ENABLE_MEMSYS5 or _MEMSYS3",
   903    908                      argv[i]);
   904    909   #else
   905    910           if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
................................................................................
   992    997     for(iSrcDb=0; iSrcDb<nSrcDb; iSrcDb++){
   993    998       rc = sqlite3_open_v2(azSrcDb[iSrcDb], &db,
   994    999                            openFlags4Data, pDfltVfs->zName);
   995   1000       if( rc ){
   996   1001         fatalError("cannot open source database %s - %s",
   997   1002         azSrcDb[iSrcDb], sqlite3_errmsg(db));
   998   1003       }
         1004  +
         1005  +    /* Print the description, if there is one */
         1006  +    if( infoFlag ){
         1007  +      int n;
         1008  +      zDbName = azSrcDb[iSrcDb];
         1009  +      i = (int)strlen(zDbName) - 1;
         1010  +      while( i>0 && zDbName[i-1]!='/' && zDbName[i-1]!='\\' ){ i--; }
         1011  +      zDbName += i;
         1012  +      sqlite3_prepare_v2(db, "SELECT msg FROM readme", -1, &pStmt, 0);
         1013  +      if( pStmt && sqlite3_step(pStmt)==SQLITE_ROW ){
         1014  +        printf("%s: %s", zDbName, sqlite3_column_text(pStmt,0));
         1015  +      }else{
         1016  +        printf("%s: (empty \"readme\")", zDbName);
         1017  +      }
         1018  +      sqlite3_finalize(pStmt);
         1019  +      sqlite3_prepare_v2(db, "SELECT count(*) FROM db", -1, &pStmt, 0);
         1020  +      if( pStmt
         1021  +       && sqlite3_step(pStmt)==SQLITE_ROW
         1022  +       && (n = sqlite3_column_int(pStmt,0))>0
         1023  +      ){
         1024  +        printf(" - %d DBs", n);
         1025  +      }
         1026  +      sqlite3_finalize(pStmt);
         1027  +      sqlite3_prepare_v2(db, "SELECT count(*) FROM xsql", -1, &pStmt, 0);
         1028  +      if( pStmt
         1029  +       && sqlite3_step(pStmt)==SQLITE_ROW
         1030  +       && (n = sqlite3_column_int(pStmt,0))>0
         1031  +      ){
         1032  +        printf(" - %d scripts", n);
         1033  +      }
         1034  +      sqlite3_finalize(pStmt);
         1035  +      printf("\n");
         1036  +      sqlite3_close(db);
         1037  +      continue;
         1038  +    }
         1039  +
   999   1040       rc = sqlite3_exec(db,
  1000   1041          "CREATE TABLE IF NOT EXISTS db(\n"
  1001   1042          "  dbid INTEGER PRIMARY KEY, -- database id\n"
  1002   1043          "  dbcontent BLOB            -- database disk file image\n"
  1003   1044          ");\n"
  1004   1045          "CREATE TABLE IF NOT EXISTS xsql(\n"
  1005   1046          "  sqlid INTEGER PRIMARY KEY,   -- SQL script id\n"

Changes to test/fuzzdata2.db.

cannot compute difference between binary files