/ Check-in [12e95e3f]
Login

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

Overview
Comment:Add the --native-vfs option on fuzzcheck.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fuzzcheck
Files: files | file ages | folders
SHA1: 12e95e3f178b89d649bc7e30db731df439ae1653
User & Date: drh 2015-05-25 21:59:05
Context
2015-05-25
22:17
Improved tracing capabilities in fuzzcheck. check-in: 864bfdbf user: drh tags: fuzzcheck
21:59
Add the --native-vfs option on fuzzcheck. check-in: 12e95e3f user: drh tags: fuzzcheck
19:37
Merge the btree fixes out of trunk. check-in: f3cd8cec user: drh tags: fuzzcheck
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/fuzzcheck.c.

553
554
555
556
557
558
559

560
561
562
563
564
565
566
...
573
574
575
576
577
578
579

580
581
582
583
584
585
586
...
598
599
600
601
602
603
604



605
606
607
608
609
610
611
...
696
697
698
699
700
701
702


703
704
705
706
707
708
709
710
711
712
713

714
715
716
717





718
719
720
721
722
723
724
725
726
"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 *db = 0;             /* The open database connection */
  int rc;                      /* Result code from SQLite interface calls */
  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];
  for(i=1; i<argc; i++){
    const char *z = argv[i];
    if( z[0]=='-' ){
      z++;
................................................................................
        iFirstInsArg = i+1;
        break;
      }else
      if( strcmp(z,"load-db")==0 ){
        zInsSql = "INSERT INTO db(dbcontent) VALUES(readfile(?1))";
        iFirstInsArg = i+1;
        break;



      }else
      if( strcmp(z,"quiet")==0 || strcmp(z,"q")==0 ){
        quietFlag = 1;
        verboseFlag = 0;
      }else
      if( strcmp(z,"sqlid")==0 ){
        if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
................................................................................
    int i;
    i = strlen(zSourceDb) - 1;
    while( i>0 && zSourceDb[i-1]!='/' && zSourceDb[i-1]!='\\' ){ i--; }
    printf("%s:", &zSourceDb[i]);
  }
  for(pSql=g.pFirstSql; pSql; pSql=pSql->pNext){
    for(pDb=g.pFirstDb; pDb; pDb=pDb->pNext){


      sqlite3_snprintf(sizeof(g.zTestName), g.zTestName, "sqlid=%d,dbid=%d",
                       pSql->id, pDb->id);
      if( verboseFlag ){
        printf("%s\n", g.zTestName);
        fflush(stdout);
      }else if( !quietFlag ){
        static int prevAmt = -1;
        int idx = (pSql->id-1)*g.nDb + pDb->id - 1;
        int amt = idx*10/(g.nDb*g.nSql);
        if( amt!=prevAmt ){
          printf(" %d%%", amt*10);

          prevAmt = amt;
        }
      }
      createVFile("main.db", pDb->sz, pDb->a);





      rc = sqlite3_open_v2("main.db", &db, SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE,
                           "inmem");
#ifndef SQLITE_OMIT_TRACE
      sqlite3_trace(db, verboseFlag ? traceCallback : traceNoop, 0);
#endif
      if( rc ) fatalError("cannot open inmem database");
      runSql(db, (char*)pSql->a);
      sqlite3_close(db);
      if( sqlite3_memory_used()>0 ) fatalError("memory leak");







>







 







>







 







>
>
>







 







>
>











>




>
>
>
>
>
|
<







553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
...
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
...
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
...
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731

732
733
734
735
736
737
738
"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"
"  --native-vfs          Use the native VFS for initially empty database files\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 *db = 0;             /* The open database connection */
  int rc;                      /* Result code from SQLite interface calls */
  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 */
  int nativeFlag = 0;          /* --native-vfs */

  iBegin = timeOfDay();
  g.zArgv0 = argv[0];
  for(i=1; i<argc; i++){
    const char *z = argv[i];
    if( z[0]=='-' ){
      z++;
................................................................................
        iFirstInsArg = i+1;
        break;
      }else
      if( strcmp(z,"load-db")==0 ){
        zInsSql = "INSERT INTO db(dbcontent) VALUES(readfile(?1))";
        iFirstInsArg = i+1;
        break;
      }else
      if( strcmp(z,"native-vfs")==0 ){
        nativeFlag = 1;
      }else
      if( strcmp(z,"quiet")==0 || strcmp(z,"q")==0 ){
        quietFlag = 1;
        verboseFlag = 0;
      }else
      if( strcmp(z,"sqlid")==0 ){
        if( i>=argc-1 ) fatalError("missing arguments on %s", argv[i]);
................................................................................
    int i;
    i = strlen(zSourceDb) - 1;
    while( i>0 && zSourceDb[i-1]!='/' && zSourceDb[i-1]!='\\' ){ i--; }
    printf("%s:", &zSourceDb[i]);
  }
  for(pSql=g.pFirstSql; pSql; pSql=pSql->pNext){
    for(pDb=g.pFirstDb; pDb; pDb=pDb->pNext){
      int openFlags;
      const char *zVfs = "inmem";
      sqlite3_snprintf(sizeof(g.zTestName), g.zTestName, "sqlid=%d,dbid=%d",
                       pSql->id, pDb->id);
      if( verboseFlag ){
        printf("%s\n", g.zTestName);
        fflush(stdout);
      }else if( !quietFlag ){
        static int prevAmt = -1;
        int idx = (pSql->id-1)*g.nDb + pDb->id - 1;
        int amt = idx*10/(g.nDb*g.nSql);
        if( amt!=prevAmt ){
          printf(" %d%%", amt*10);
          fflush(stdout);
          prevAmt = amt;
        }
      }
      createVFile("main.db", pDb->sz, pDb->a);
      openFlags = SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE;
      if( nativeFlag && pDb->sz==0 ){
        openFlags |= SQLITE_OPEN_MEMORY;
        zVfs = 0;
      }
      rc = sqlite3_open_v2("main.db", &db, openFlags, zVfs);

#ifndef SQLITE_OMIT_TRACE
      sqlite3_trace(db, verboseFlag ? traceCallback : traceNoop, 0);
#endif
      if( rc ) fatalError("cannot open inmem database");
      runSql(db, (char*)pSql->a);
      sqlite3_close(db);
      if( sqlite3_memory_used()>0 ) fatalError("memory leak");