/ Check-in [c4b68eff]
Login

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

Overview
Comment:Include json1.c in fuzzcheck and fuzzershell.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | json-fuzz
Files: files | file ages | folders
SHA1: c4b68eff7f8f5402a9abf378157767b1c96a6101
User & Date: drh 2015-09-19 14:32:51
Context
2015-09-19
14:57
Adjust fuzzershell so that it adds the json1 extension separately for each no connection. check-in: ca2d1e90 user: drh tags: json-fuzz
14:32
Include json1.c in fuzzcheck and fuzzershell. check-in: c4b68eff user: drh tags: json-fuzz
12:04
Fix a documentation typo in sqlite3_bind_parameter_index(). No code changes. check-in: 650605a8 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Makefile.in.

   536    536   # Databases containing fuzzer test cases
   537    537   #
   538    538   FUZZDATA = \
   539    539     $(TOP)/test/fuzzdata1.db \
   540    540     $(TOP)/test/fuzzdata2.db \
   541    541     $(TOP)/test/fuzzdata3.db
   542    542   
          543  +# Extra arguments for including json1 in the build of tools
          544  +#
          545  +JSON1_DEP = $(TOP)/ext/misc/json1.c sqlite3ext.h
          546  +JSON1_OPT = -DSQLITE_ENABLE_JSON1
          547  +JSON1_SRC = $(TOP)/ext/misc/json1.c
          548  +
   543    549   # Standard options to testfixture
   544    550   #
   545    551   TESTOPTS = --verbose=file --output=test-out.txt
   546    552   
   547    553   # This is the default Makefile target.  The objects listed here
   548    554   # are what get build when you type just "make" with no arguments.
   549    555   #
................................................................................
   562    568   libtclsqlite3.la:	tclsqlite.lo libsqlite3.la
   563    569   	$(LTLINK) -no-undefined -o $@ tclsqlite.lo \
   564    570   		libsqlite3.la @TCL_STUB_LIB_SPEC@ $(TLIBS) \
   565    571   		-rpath "$(TCLLIBDIR)" \
   566    572   		-version-info "8:6:8" \
   567    573   		-avoid-version
   568    574   
   569         -sqlite3$(TEXE):	$(TOP)/src/shell.c libsqlite3.la sqlite3.h $(TOP)/ext/misc/json1.c
   570         -	$(LTLINK) $(READLINE_FLAGS) -DSQLITE_ENABLE_JSON1 -o $@ \
   571         -		$(TOP)/src/shell.c $(TOP)/ext/misc/json1.c libsqlite3.la \
          575  +sqlite3$(TEXE):	$(TOP)/src/shell.c libsqlite3.la sqlite3.h $(JSON1_DEP)
          576  +	$(LTLINK) $(READLINE_FLAGS) $(JSON1_OPT) -o $@ \
          577  +		$(TOP)/src/shell.c $(JSON1_SRC) libsqlite3.la \
   572    578   		$(LIBREADLINE) $(TLIBS) -rpath "$(libdir)"
   573    579   
   574    580   sqldiff$(TEXE):	$(TOP)/tool/sqldiff.c sqlite3.c sqlite3.h
   575    581   	$(LTLINK) -o $@ $(TOP)/tool/sqldiff.c sqlite3.c $(TLIBS)
   576    582   
   577         -fuzzershell$(TEXE):	$(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h
   578         -	$(LTLINK) -o $@ $(TOP)/tool/fuzzershell.c sqlite3.c $(TLIBS)
          583  +fuzzershell$(TEXE):	$(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h $(JSON1_DEP)
          584  +	$(LTLINK) -o $@ $(JSON1_OPT) \
          585  +	  $(TOP)/tool/fuzzershell.c $(JSON1_SRC) sqlite3.c $(TLIBS)
   579    586   
   580         -fuzzcheck$(TEXE):	$(TOP)/test/fuzzcheck.c sqlite3.c sqlite3.h
   581         -	$(LTLINK) -o $@ $(TOP)/test/fuzzcheck.c sqlite3.c $(TLIBS)
          587  +fuzzcheck$(TEXE):	$(TOP)/test/fuzzcheck.c sqlite3.c sqlite3.h $(JSON1_DEP)
          588  +	$(LTLINK) -o $@ $(JSON1_OPT) $(TOP)/test/fuzzcheck.c $(JSON1_SRC) sqlite3.c $(TLIBS)
   582    589   
   583    590   mptester$(TEXE):	sqlite3.c $(TOP)/mptest/mptest.c
   584    591   	$(LTLINK) -o $@ -I. $(TOP)/mptest/mptest.c sqlite3.c \
   585    592   		$(TLIBS) -rpath "$(libdir)"
   586    593   
   587    594   MPTEST1=./mptester$(TEXE) mptest.db $(TOP)/mptest/crash01.test --repeat 20
   588    595   MPTEST2=./mptester$(TEXE) mptest.db $(TOP)/mptest/multiwrite01.test --repeat 20

Changes to Makefile.msc.

  1205   1205   # Databases containing fuzzer test cases
  1206   1206   #
  1207   1207   FUZZDATA = \
  1208   1208     $(TOP)\test\fuzzdata1.db \
  1209   1209     $(TOP)\test\fuzzdata2.db \
  1210   1210     $(TOP)\test\fuzzdata3.db
  1211   1211   
         1212  +# Extra arguments for including json1 in the build of tools
         1213  +#
         1214  +JSON1_DEP = $(TOP)\ext\misc\json1.c sqlite3ext.h
         1215  +JSON1_OPT = -DSQLITE_ENABLE_JSON1
         1216  +JSON1_SRC = $(TOP)\ext\misc\json1.c
         1217  +
  1212   1218   # Standard options to testfixture
  1213   1219   #
  1214   1220   TESTOPTS = --verbose=file --output=test-out.txt
  1215   1221   
  1216   1222   # This is the default Makefile target.  The objects listed here
  1217   1223   # are what get build when you type just "make" with no arguments.
  1218   1224   #
................................................................................
  1220   1226   
  1221   1227   libsqlite3.lib:	$(LIBOBJ)
  1222   1228   	$(LTLIB) $(LTLIBOPTS) /OUT:$@ $(LIBOBJ) $(TLIBS)
  1223   1229   
  1224   1230   libtclsqlite3.lib:	tclsqlite.lo libsqlite3.lib
  1225   1231   	$(LTLIB) $(LTLIBOPTS) $(LTLIBPATHS) /OUT:$@ tclsqlite.lo libsqlite3.lib $(LIBTCL:tcl=tclstub) $(TLIBS)
  1226   1232   
  1227         -sqlite3.exe:	$(TOP)\src\shell.c $(TOP)\ext\misc\json1.c $(SHELL_CORE_DEP) $(LIBRESOBJS) sqlite3.h
  1228         -	$(LTLINK) $(SHELL_COMPILE_OPTS) $(READLINE_FLAGS) $(TOP)\src\shell.c $(TOP)\ext\misc\json1.c \
         1233  +sqlite3.exe:	$(TOP)\src\shell.c $(JSON1_DEP) $(SHELL_CORE_DEP) $(LIBRESOBJS) sqlite3.h
         1234  +	$(LTLINK) $(SHELL_COMPILE_OPTS) $(JSON1_OPT) $(READLINE_FLAGS) $(TOP)\src\shell.c $(JSON1_SRC) \
  1229   1235   		/link /pdb:sqlite3sh.pdb $(LTLINKOPTS) $(SHELL_LINK_OPTS) $(LTLIBPATHS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
  1230   1236   
  1231   1237   sqldiff.exe:	$(TOP)\tool\sqldiff.c sqlite3.c sqlite3.h
  1232   1238   	$(LTLINK) $(NO_WARN) $(TOP)\tool\sqldiff.c sqlite3.c
  1233   1239   
  1234         -fuzzershell.exe:	$(TOP)\tool\fuzzershell.c sqlite3.c sqlite3.h
  1235         -	$(LTLINK) $(NO_WARN) $(TOP)\tool\fuzzershell.c sqlite3.c
         1240  +fuzzershell.exe:	$(TOP)\tool\fuzzershell.c sqlite3.c sqlite3.h $(JSON1_DEP)
         1241  +	$(LTLINK) $(NO_WARN) $(JSON1_OPT) \
         1242  +	  $(TOP)\tool\fuzzershell.c $(JSON1_SRC) sqlite3.c
  1236   1243   
  1237         -fuzzcheck.exe:	$(TOP)\test\fuzzcheck.c sqlite3.c sqlite3.h
  1238         -	$(LTLINK) $(NO_WARN) $(TOP)\test\fuzzcheck.c sqlite3.c
         1244  +fuzzcheck.exe:	$(TOP)\test\fuzzcheck.c sqlite3.c sqlite3.h $(JSON1_DEP)
         1245  +	$(LTLINK) $(NO_WARN) $(JSON1_OPT) $(TOP)\test\fuzzcheck.c $(JSON1_SRC) sqlite3.c
  1239   1246   
  1240   1247   mptester.exe:	$(TOP)\mptest\mptest.c $(SHELL_CORE_DEP) $(LIBRESOBJS) sqlite3.h
  1241   1248   	$(LTLINK) $(NO_WARN) $(SHELL_COMPILE_OPTS) $(TOP)\mptest\mptest.c \
  1242   1249   		/link $(LTLINKOPTS) $(LTLIBPATHS) $(SHELL_LINK_OPTS) $(LIBRESOBJS) $(LIBREADLINE) $(LTLIBS) $(TLIBS)
  1243   1250   
  1244   1251   MPTEST1 = mptester mptest.db $(TOP)\mptest\crash01.test --repeat 20
  1245   1252   MPTEST2 = mptester mptest.db $(TOP)\mptest\multiwrite01.test --repeat 20

Changes to main.mk.

   446    446   # Databases containing fuzzer test cases
   447    447   #
   448    448   FUZZDATA = \
   449    449     $(TOP)/test/fuzzdata1.db \
   450    450     $(TOP)/test/fuzzdata2.db \
   451    451     $(TOP)/test/fuzzdata3.db
   452    452   
          453  +# Extra arguments for including json1 in the build of tools
          454  +#
          455  +JSON1_DEP = $(TOP)/ext/misc/json1.c sqlite3ext.h
          456  +JSON1_OPT = -DSQLITE_ENABLE_JSON1
          457  +JSON1_SRC = $(TOP)/ext/misc/json1.c
          458  +
   453    459   # Standard options to testfixture
   454    460   #
   455    461   TESTOPTS = --verbose=file --output=test-out.txt
   456    462   
   457    463   # This is the default Makefile target.  The objects listed here
   458    464   # are what get build when you type just "make" with no arguments.
   459    465   #
   460    466   all:	sqlite3.h libsqlite3.a sqlite3$(EXE)
   461    467   
   462    468   libsqlite3.a:	$(LIBOBJ)
   463    469   	$(AR) libsqlite3.a $(LIBOBJ)
   464    470   	$(RANLIB) libsqlite3.a
   465    471   
   466         -sqlite3$(EXE):	$(TOP)/src/shell.c libsqlite3.a sqlite3.h $(TOP)/ext/misc/json1.c
   467         -	$(TCCX) $(READLINE_FLAGS) -DSQLITE_ENABLE_JSON1 -o sqlite3$(EXE)  \
   468         -		$(TOP)/src/shell.c $(TOP)/ext/misc/json1.c                \
          472  +sqlite3$(EXE):	$(TOP)/src/shell.c libsqlite3.a sqlite3.h $(JSON1_DEP)
          473  +	$(TCCX) $(READLINE_FLAGS) $(JSON1_OPT) -o sqlite3$(EXE)  \
          474  +		$(TOP)/src/shell.c $(JSON1_SRC) \
   469    475   		libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREADLIB)
   470    476   
   471    477   sqldiff$(EXE):	$(TOP)/tool/sqldiff.c sqlite3.c sqlite3.h
   472    478   	$(TCCX) -o sqldiff$(EXE) -DSQLITE_THREADSAFE=0 \
   473    479   		$(TOP)/tool/sqldiff.c sqlite3.c $(TLIBS) $(THREADLIB)
   474    480   
   475         -fuzzershell$(EXE):	$(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h
          481  +fuzzershell$(EXE):	$(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h $(JSON1_DEP)
   476    482   	$(TCCX) -o fuzzershell$(EXE) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION \
   477         -		$(TOP)/tool/fuzzershell.c sqlite3.c $(TLIBS) $(THREADLIB)
          483  +	  $(JSON1_OPT)	$(TOP)/tool/fuzzershell.c $(JSON1_SRC) sqlite3.c \
          484  +	  $(TLIBS) $(THREADLIB)
   478    485   
   479         -fuzzcheck$(EXE):	$(TOP)/test/fuzzcheck.c sqlite3.c sqlite3.h
          486  +fuzzcheck$(EXE):	$(TOP)/test/fuzzcheck.c sqlite3.c sqlite3.h $(JSON1_DEP)
   480    487   	$(TCCX) -o fuzzcheck$(EXE) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION \
   481         -		-DSQLITE_ENABLE_MEMSYS5 \
   482         -		$(TOP)/test/fuzzcheck.c sqlite3.c $(TLIBS) $(THREADLIB)
          488  +		-DSQLITE_ENABLE_MEMSYS5 $(JSON1_OPT) \
          489  +		$(TOP)/test/fuzzcheck.c $(JSON1_SRC) sqlite3.c $(TLIBS) $(THREADLIB)
   483    490   
   484    491   mptester$(EXE):	sqlite3.c $(TOP)/mptest/mptest.c
   485    492   	$(TCCX) -o $@ -I. $(TOP)/mptest/mptest.c sqlite3.c \
   486    493   		$(TLIBS) $(THREADLIB)
   487    494   
   488    495   MPTEST1=./mptester$(EXE) mptest.db $(TOP)/mptest/crash01.test --repeat 20
   489    496   MPTEST2=./mptester$(EXE) mptest.db $(TOP)/mptest/multiwrite01.test --repeat 20

Changes to test/fuzzcheck.c.

  1035   1035           openFlags = SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE;
  1036   1036           if( nativeFlag && pDb->sz==0 ){
  1037   1037             openFlags |= SQLITE_OPEN_MEMORY;
  1038   1038             zVfs = 0;
  1039   1039           }
  1040   1040           rc = sqlite3_open_v2("main.db", &db, openFlags, zVfs);
  1041   1041           if( rc ) fatalError("cannot open inmem database");
         1042  +#ifdef SQLITE_ENABLE_JSON1
         1043  +        {
         1044  +          extern int sqlite3_json_init(sqlite3*);
         1045  +          sqlite3_json_init(db);
         1046  +        }
         1047  +#endif
  1042   1048           if( cellSzCkFlag ) runSql(db, "PRAGMA cell_size_check=ON", runFlags);
  1043   1049           setAlarm(iTimeout);
  1044   1050   #ifndef SQLITE_OMIT_PROGRESS_CALLBACK
  1045   1051           if( sqlFuzz || vdbeLimitFlag ){
  1046   1052             sqlite3_progress_handler(db, 100000, progressHandler, &vdbeLimitFlag);
  1047   1053           }
  1048   1054   #endif

Changes to tool/fuzzershell.c.

   596    596     }
   597    597   
   598    598     /* Initialize the input buffer used to hold SQL text */
   599    599     if( nInFile==0 ) nInFile = 1;
   600    600     nAlloc = 1000;
   601    601     zIn = malloc(nAlloc);
   602    602     if( zIn==0 ) fatalError("out of memory");
          603  +
          604  +#ifdef SQLITE_ENABLE_JSON1
          605  +  {
          606  +    extern int sqlite3_json_init(sqlite3*);
          607  +    sqlite3_auto_extension((void(*)(void))sqlite3_json_init);
          608  +  }
          609  +#endif
   603    610   
   604    611     /* Loop over all input files */
   605    612     for(jj=0; jj<nInFile; jj++){
   606    613   
   607    614       /* Read the complete content of the next input file into zIn[] */
   608    615       FILE *in;
   609    616       if( azInFile ){